ptolemy.actor.gui.style
Class ChoiceStyle
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.actor.gui.style.ParameterEditorStyle
ptolemy.actor.gui.style.ChoiceStyle
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
- Direct Known Subclasses:
- EditableChoiceStyle
public class ChoiceStyle
- extends ParameterEditorStyle
This attribute annotates user settable attributes to specify
an uneditable combobox style for configuring the containing attribute.
An uneditable combobox is restricted to only the values specified as the
combobox options. No arbitrary value can be entered.
For an editable combobox, use EditableChoiceStyle instead.
The choices that are presented in the combobox
are given by a set of attributes implementing the Settable interface,
such as StringAttribute, contained by this style.
- Since:
- Ptolemy II 1.0
- Version:
- $Id: ChoiceStyle.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Steve Neuendorffer
- See Also:
EditableChoiceStyle
,
EditorPaneFactory
,
ParameterEditorStyle
,
StringAttribute
,
Serialized Form
- Accepted Rating:
- Proposed Rating:
Field Summary |
protected boolean |
_isEditable
Whether or not the combobox is editable. |
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 |
ChoiceStyle()
Construct an attribute in the default workspace with an empty string
as its name. |
ChoiceStyle(NamedObj container,
java.lang.String name)
Construct an attribute with the specified container and name. |
ChoiceStyle(Workspace workspace)
Construct an attribute in the given workspace with an empty string
as its name. |
Method Summary |
boolean |
acceptable(Settable param)
Return true if this style is acceptable for the given attribute. |
void |
addEntry(PtolemyQuery query)
Create a new uneditable
combo box entry in the given query associated with the
attribute containing this style. |
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 |
_isEditable
protected boolean _isEditable
- Whether or not the combobox is editable. EditableComboBox changes
this to create an editable combo box. In this base class the
value is false.
ChoiceStyle
public ChoiceStyle()
- 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.
ChoiceStyle
public ChoiceStyle(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.
ChoiceStyle
public ChoiceStyle(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.
acceptable
public boolean acceptable(Settable param)
- Return true if this style is acceptable for the given attribute.
- Specified by:
acceptable
in class ParameterEditorStyle
- Parameters:
param
- The attribute that this annotates.
- Returns:
- True if the style contains some attributes representing the
choices.
addEntry
public void addEntry(PtolemyQuery query)
throws IllegalActionException
- Create a new uneditable
combo box entry in the given query associated with the
attribute containing this style. The name of the entry is
the name of the attribute. Attach the attribute to the created entry.
- Specified by:
addEntry
in class ParameterEditorStyle
- 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.