Package ptolemy.actor.gui.properties
Class ActionGUIProperty
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.actor.gui.properties.GUIProperty
-
- ptolemy.actor.gui.properties.ActionGUIProperty
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Configurable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
Button
,ComboBox.Item
public abstract class ActionGUIProperty extends GUIProperty implements Configurable
A GUI property that is associated with an action.- Since:
- Ptolemy II 8.0
- Version:
- $Id$
- Author:
- Thomas Huining Feng
- Pt.AcceptedRating:
- Red (tfeng)
- Pt.ProposedRating:
- Red (tfeng)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected GUIAction
_action
The action.Parameter
parse
A Boolean parameter that determines whether the moml text should be parsed before applying to the current model in theperform()
method.-
Fields inherited from class ptolemy.actor.gui.properties.GUIProperty
preferredSize
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Constructor Description ActionGUIProperty(NamedObj container, java.lang.String name)
Construct a GUI property with the given name contained by the specified entity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GUIAction
_createAction()
Create the action to be used in this property.void
configure(java.net.URL base, java.lang.String source, java.lang.String text)
Configure the object with data from the specified input source (a URL) and/or textual data.java.lang.String
getConfigureSource()
Return the input source that was specified the last time the configure method was called.java.lang.String
getConfigureText()
Return the text string that represents the current configuration of this object.void
perform()
Perform this action.-
Methods inherited from class ptolemy.actor.gui.properties.GUIProperty
_createComponent, attributeChanged, clone, getComponent, setContainer
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
Constructor Detail
-
ActionGUIProperty
public ActionGUIProperty(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a GUI property with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown. This attribute will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.- Parameters:
container
- The container.name
- The name of this attribute.- Throws:
IllegalActionException
- If the attribute is not of an acceptable class for the container, or if the name contains a period.NameDuplicationException
- If the name coincides with an attribute already in the container.
-
-
Method Detail
-
configure
public void configure(java.net.URL base, java.lang.String source, java.lang.String text) throws java.lang.Exception
Configure the object with data from the specified input source (a URL) and/or textual data. The object should interpret the source first, if it is specified, followed by the literal text, if that is specified. The new configuration should usually override any old configuration wherever possible, in order to ensure that the current state can be successfully retrieved.This method is defined to throw a very general exception to allow classes that implement the interface to use whatever exceptions are appropriate.
- Specified by:
configure
in interfaceConfigurable
- Parameters:
base
- The base relative to which references within the input are found, or null if this is not known, or there is none.source
- The input source, which specifies a URL, or null if none.text
- Configuration information given as text, or null if none.- Throws:
java.lang.Exception
- If something goes wrong.
-
getConfigureSource
public java.lang.String getConfigureSource()
Return the input source that was specified the last time the configure method was called.- Specified by:
getConfigureSource
in interfaceConfigurable
- Returns:
- The string representation of the input URL, or null if the no source has been used to configure this object, or null if no external source need be used to configure this object.
-
getConfigureText
public java.lang.String getConfigureText()
Return the text string that represents the current configuration of this object. Note that any configuration that was previously specified using the source attribute need not be represented here as well.- Specified by:
getConfigureText
in interfaceConfigurable
- Returns:
- A configuration string, or null if no configuration has been used to configure this object, or null if no configuration string need be used to configure this object.
-
perform
public void perform()
Perform this action. In this base class, if a source file is specified in the configuration of this item, e.g.:<configure source="some_file.xml"> </configure>
then the source is read and its contents are used as the moml text. The moml text can also be given directly:<configure> <entity name="C" class="ptolemy.actor.lib.Const"> </entity> </configure>
Depending on whether theparse
parameter is true or false, the moml text may be parsed first or not. If it is parsed, the returned NamedObj is used to generate a new moml string to be applied to the model in the current tableau (the nearest tableau that contains this GUI property). If it is not parsed, then the moml text is directly applied to the model.
-
_createAction
protected GUIAction _createAction() throws IllegalActionException, NameDuplicationException
Create the action to be used in this property.- Returns:
- The action.
- Throws:
IllegalActionException
- If the attribute is not of an acceptable class for the container, or if the name contains a period.NameDuplicationException
- If the name coincides with an attribute already in the container.
-
-