ptolemy.actor.gui.style
Class ParameterEditorStyle

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.actor.gui.style.ParameterEditorStyle
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
Direct Known Subclasses:
CheckBoxStyle, ChoiceStyle, FileChooserStyle, HiddenStyle, LineStyle, NotEditableLineStyle, TextStyle

public abstract class ParameterEditorStyle
extends Attribute

This attribute annotates user settable attributes to specify the style used for configuring the containing attribute. The EditorPaneFactory class uses concrete subclasses of this base class as a strategy pattern for creating entries in an interactive parameter editor. This class expects that the container will implement the Settable interface.

Since:
Ptolemy II 1.0
Version:
$Id: ParameterEditorStyle.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Steve Neuendorffer and Edward A. Lee
See Also:
EditorPaneFactory, Settable, Serialized Form
Accepted Rating:
Yellow (neuendor)
Proposed Rating:
Green (neuendor)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
 
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
ParameterEditorStyle()
          Construct an attribute in the default workspace with an empty string as its name.
ParameterEditorStyle(NamedObj container, java.lang.String name)
          Construct an attribute with the specified container and name.
ParameterEditorStyle(Workspace workspace)
          Construct an attribute in the given workspace with an empty string as its name.
 
Method Summary
abstract  boolean acceptable(Settable param)
          Return true if this style is acceptable for the given parameter.
abstract  void addEntry(PtolemyQuery query)
          Create a new entry in the given query associated with the attribute containing this style.
 void setContainer(NamedObj container)
          Override the base class to first check that the container is an instance of Settable.
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, 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

ParameterEditorStyle

public ParameterEditorStyle()
Construct an attribute in the default workspace with an empty string as its name. The object is added to the directory of the workspace. Increment the version number of the workspace.


ParameterEditorStyle

public ParameterEditorStyle(Workspace workspace)
Construct an attribute in the given workspace with an empty string as its name. The object is added to the directory of the workspace. Increment the version number of the workspace.

Parameters:
workspace - The workspace that will contain the attribute that is being constructed.

ParameterEditorStyle

public ParameterEditorStyle(NamedObj container,
                            java.lang.String name)
                     throws IllegalActionException,
                            NameDuplicationException
Construct an attribute with the specified container and name.

Parameters:
container - The container.
name - The name of the attribute.
Throws:
IllegalActionException - If the attribute is not of an acceptable attribute for the container, or if the container is not an instance of Settable.
NameDuplicationException - If the name coincides with an attribute already in the container.
Method Detail

acceptable

public abstract boolean acceptable(Settable param)
Return true if this style is acceptable for the given parameter. For instance, a check box style would return true if the argument was a Parameter that contained a boolean token.

Parameters:
param - The attribute that this annotates.
Returns:
True if this style is acceptable.

addEntry

public abstract void addEntry(PtolemyQuery query)
                       throws IllegalActionException
Create a new entry in the given query associated with the attribute containing this style. The name of the entry should be the name of the attribute. The attribute should be attached to the entry so that changes in its value are reflected in the query.

Parameters:
query - The query into which to add the entry.
Throws:
IllegalActionException - If the containing attribute has a value that cannot be edited using this style.

setContainer

public void setContainer(NamedObj container)
                  throws IllegalActionException,
                         NameDuplicationException
Override the base class to first check that the container is an instance of Settable.

Overrides:
setContainer in class Attribute
Parameters:
container - The container to attach this attribute to.
Throws:
IllegalActionException - If this attribute is not of the expected class for the container, or it has no name, or the attribute and container are not in the same workspace, or the proposed container would result in recursive containment, or the proposed container is not an instance of Settable.
NameDuplicationException - If the container already has an attribute with the name of this attribute.
See Also:
Attribute.getContainer()