ptolemy.actor.gt.gui
Class GTGUIAction

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.actor.gui.properties.GUIAction
              extended by ptolemy.actor.gt.gui.GTGUIAction
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class GTGUIAction
extends GUIAction

An action that can be configured with a Ptera-based model transformation to be applied to the current model.

Since:
Ptolemy II 8.0
Version:
$Id: GTGUIAction.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Thomas Huining Feng
See Also:
Serialized Form
Accepted Rating:
Red (tfeng)
Proposed Rating:
Yellow (tfeng)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
 
Fields inherited from class ptolemy.actor.gui.properties.GUIAction
_momlSource, _momlText, _parsedObject, _parser
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
GTGUIAction(NamedObj container, java.lang.String name)
          Construct an item with the given name contained by the specified entity.
 
Method Summary
protected  void _processUnselectedObjects(NamedObj model, boolean ignore)
          Mark the unselected objects in the given model to be ignored or not ignored.
 void perform(boolean parse)
          React to this item being selected.
 
Methods inherited from class ptolemy.actor.gui.properties.GUIAction
_parseSource, configure, getConfigureSource, getConfigureText, getFrame, getModel
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, 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, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GTGUIAction

public GTGUIAction(NamedObj container,
                   java.lang.String name)
            throws IllegalActionException,
                   NameDuplicationException
Construct an item 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

perform

public void perform(boolean parse)
React to this item being selected. 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 the parse 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.

Overrides:
perform in class GUIAction
Parameters:
parse - Whether the configure text should be parsed before applying to the current model.

_processUnselectedObjects

protected void _processUnselectedObjects(NamedObj model,
                                         boolean ignore)
                                  throws NameDuplicationException,
                                         IllegalActionException
Mark the unselected objects in the given model to be ignored or not ignored.

Parameters:
model - The model that contains the selected or unselected objects.
ignore - Whether the objects should be ignored.
Throws:
NameDuplicationException - If instances of IgnoringAttribute cannot be created for the objects.
IllegalActionException - If IgnoringAttribute exists and have the same names.