|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.option.OptionItem
public abstract class OptionItem
Abstract class that serves as base class for all items that can be
added to an OptionHandler
.
Past versions of this class were responsible for providing an editor
component for a specific kind of parameter or option type.
This task falls now to an ItemEditor
created either through
an ItemEditorFactory
or in the context of another
Editor
.
It is the responsibility of an OptionItem
to update the
value
, enabled
, and
valueUndefined
properties of registered
editors that are in autoAdopt
state. The various
publishXXX
methods can be used to this end.
An OptionItem
must also provide means to reset the value of the
parameter to its original value.
It is recommended that subclasses implement the
BackupValueOwner
interface to allow editors to access that
original value (or backup value).
publishEnabled(boolean)
,
publishValue(Object)
,
publishValueUndefined(boolean)
Field Summary | |
---|---|
static java.lang.String |
ATTRIBUTE_CONTEXT
Attribute key used to store the item context handlername.sectionname . |
static java.lang.String |
ATTRIBUTE_GROUPS
Attribute key used to store the Collection
of OptionGroup instance that the item belongs to. |
static java.lang.String |
ATTRIBUTE_LONG_DESCRIPTION
Attribute key used to store a detailed description. |
static java.awt.Color |
COLOR_UNDEFINED
A Color that is used in the editor to signal that the value is not defined (yet). |
protected java.lang.String |
name
This field stores the name of the OptionItem. |
static java.lang.String |
PROPERTY_CLASS_TYPE
Name of property classType . |
static java.lang.String |
PROPERTY_ENABLED
Name of property enabled . |
static java.lang.String |
PROPERTY_TIP_TEXT
Name of property tipText . |
static java.lang.String |
PROPERTY_VALUE
Name of property value . |
static java.lang.String |
PROPERTY_VALUE_UNDEFINED
Name of property valueUndefined . |
static java.lang.Object |
UNDEFINED
A value item that can be used to signal that there is no defined value yet. |
Constructor Summary | |
---|---|
protected |
OptionItem()
Creates a new instance of OptionItem. |
protected |
OptionItem(java.lang.Class classType)
Creates a new instance of OptionItem. |
protected |
OptionItem(java.lang.Class classType,
java.lang.String name)
Creates a new instance of OptionItem that has the given identifying name. |
protected |
OptionItem(java.lang.String name)
Creates a new instance of OptionItem that has the given identifying name. |
Method Summary | |
---|---|
ItemEditor |
addEditor(ItemEditor editor)
Adds the specified editor to this item. |
void |
addEditorListener(Editor.Listener el)
Register el so that it will receive notifications
when an editor is added or removed. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Adds a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(java.lang.String propertyname,
java.beans.PropertyChangeListener pcl)
Adds a PropertyChangeListener to the listener list for a specific property. |
void |
addVetoableChangeListener(java.lang.String propertyname,
java.beans.VetoableChangeListener vcl)
Adds a VetoableChangeListener to the listener list for a specific property. |
void |
addVetoableChangeListener(java.beans.VetoableChangeListener vcl)
Adds a VetoableChangeListener to the listener list. |
boolean |
adoptEditorValue()
Deprecated. Use Editor.commitValue() instead. |
boolean |
checkEditorValue()
Deprecated. Register a VetoableChangeListener instead. |
protected void |
firePropertyChange(java.beans.PropertyChangeEvent pce)
Fires a PropertyChangeEvent in response to a change in a bound property. |
protected void |
firePropertyChange(java.lang.String pn,
java.lang.Object oldValue,
java.lang.Object newValue)
Fires a PropertyChangeEvent in response to a change in a bound property. |
protected void |
fireVetoableChange(java.beans.PropertyChangeEvent pce)
Fires a PropertyChangeEvent in response to a change in a vetoable property. |
protected void |
fireVetoableChange(java.lang.String pn,
java.lang.Object oldValue,
java.lang.Object newValue)
Fires a PropertyChangeEvent in response to a change in a vetoable property. |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the attribute with the specified name. |
java.lang.Class |
getClassType()
Getter for property classType. |
javax.swing.JComponent |
getEditor()
Deprecated. Use ItemEditorFactory.createEditor(y.option.OptionItem) instead. |
javax.swing.JComponent |
getEditor(GuiFactory factory,
java.lang.String parentName)
Deprecated. Use ItemEditorFactory.createEditor(y.option.OptionItem) instead. |
java.util.List |
getEditors()
Returns a list of all the editors that were added to the OptionItem with addEditor(y.option.ItemEditor) . |
java.lang.String |
getName()
Returns the name of this OptionItem. |
java.lang.String |
getStringValue()
Returns the stringified value of this option item if the classType property is set, it uses the y.util.ObjectStringConversion class to perform its task, otherwise it will return null. |
java.lang.String |
getTipText()
Returns the tool tip text for the item editor. |
abstract java.lang.String |
getType()
Returns a unique identifier for the type of this OptionItem. |
abstract java.lang.Object |
getValue()
Returns the value of this option item. |
boolean |
isEnabled()
Returns the enabled state of this item. |
boolean |
isValueUndefined()
Returns whether or not the editor should start up displaying an undefined value. |
protected void |
publishEnabled(boolean enabled)
Sets the enabled property to the specified value for
all registered editors that are in autoAdopt state. |
protected void |
publishValue(java.lang.Object value)
Sets the specified value for all registered editors that are in autoAdopt state. |
protected void |
publishValueUndefined(boolean valueUndefined)
Sets the valueUndefined property to the specified value for
all registered editors that are in autoAdopt state. |
void |
removeAttribute(java.lang.String name)
Removes the attribute with the specified name. |
void |
removeEditor(ItemEditor editor)
Removes the specified editor from this item. |
void |
removeEditorListener(Editor.Listener el)
Unregister el so that it will no longer receive notifications
when an editor is added or removed. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Removes a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(java.lang.String propertyname,
java.beans.PropertyChangeListener pcl)
Removes a PropertyChangeListener from the listener list for a specific property. |
void |
removeVetoableChangeListener(java.lang.String propertyname,
java.beans.VetoableChangeListener vcl)
Removes a VetoableChangeListener from the listener list for a specific property. |
void |
removeVetoableChangeListener(java.beans.VetoableChangeListener vcl)
Removes a VetoableChangeListener from the listener list. |
abstract void |
resetValue()
Resets the value of this item to its initial value. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets an arbitrary attribute with the specified name and value. |
protected void |
setClassType(java.lang.Class classType)
Sets the value of property classType . |
void |
setEnabled(boolean enabled)
Specifies the enabled state of this item. |
void |
setStringValue(java.lang.String value)
Sets the stringified value of this option item if the classType property is set, it uses the y.util.ObjectStringConversion class to perform its task, otherwise it will return null. |
void |
setTipText(java.lang.String tipText)
Sets the tool tip text for the item editor. |
abstract void |
setValue(java.lang.Object value)
Sets the value of this option item. |
void |
setValueUndefined(boolean valueUndefined)
Whether or not the editor should start up displaying an undefined value. |
boolean |
wantsVisibleName()
Whether or not the identifying name should be displayed along with this item. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.awt.Color COLOR_UNDEFINED
public static final java.lang.Object UNDEFINED
public static final java.lang.String ATTRIBUTE_CONTEXT
handlername.sectionname
.
public static final java.lang.String ATTRIBUTE_GROUPS
Collection
of OptionGroup
instance that the item belongs to.
Collection
,
an option group can be added without triggering a
PropertyChangeEvent
.
public static final java.lang.String ATTRIBUTE_LONG_DESCRIPTION
public static final java.lang.String PROPERTY_ENABLED
enabled
.
public static final java.lang.String PROPERTY_VALUE
value
.
public static final java.lang.String PROPERTY_VALUE_UNDEFINED
valueUndefined
.
public static final java.lang.String PROPERTY_CLASS_TYPE
classType
.
public static final java.lang.String PROPERTY_TIP_TEXT
tipText
.
protected java.lang.String name
Constructor Detail |
---|
protected OptionItem()
protected OptionItem(java.lang.Class classType)
protected OptionItem(java.lang.String name)
protected OptionItem(java.lang.Class classType, java.lang.String name)
Method Detail |
---|
protected void setClassType(java.lang.Class classType)
classType
.
public java.lang.Class getClassType()
public java.lang.String getName()
public void setTipText(java.lang.String tipText)
public java.lang.String getTipText()
public boolean isEnabled()
public void setEnabled(boolean enabled)
enabled
- the new enabled state of this itempublic boolean wantsVisibleName()
true
public java.lang.String getStringValue()
public void setStringValue(java.lang.String value)
public javax.swing.JComponent getEditor()
ItemEditorFactory.createEditor(y.option.OptionItem)
instead.
Note:
Use the getEditor(GuiFactory,String)
variant instead.
public javax.swing.JComponent getEditor(GuiFactory factory, java.lang.String parentName)
ItemEditorFactory.createEditor(y.option.OptionItem)
instead.
public boolean adoptEditorValue()
Editor.commitValue()
instead.
true
public abstract void resetValue()
Note:
It is the responsibility of the OptionItem
to update
registered editors that are in autoAdopt
state.
publishValue(Object)
public boolean checkEditorValue()
VetoableChangeListener
instead.
true
public boolean isValueUndefined()
public void setValueUndefined(boolean valueUndefined)
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface AttributeOwner
name
- the name of the attribute being queried
public void removeAttribute(java.lang.String name)
PropertyChange
events.
removeAttribute
in interface AttributeOwner
name
- the name of the attribute being removedpublic void setAttribute(java.lang.String name, java.lang.Object value)
null
, this method will remove the attribute.
PropertyChange
events.
setAttribute
in interface AttributeOwner
name
- the name of the attribute being addedvalue
- the value of the attribute being addedpublic abstract java.lang.String getType()
public abstract java.lang.Object getValue()
public abstract void setValue(java.lang.Object value)
OptionItem
to update
registered editors that are in autoAdopt
state.
publishValue(Object)
protected void publishValue(java.lang.Object value)
autoAdopt
state.
protected void publishValueUndefined(boolean valueUndefined)
valueUndefined
property to the specified value for
all registered editors that are in autoAdopt
state.
protected void publishEnabled(boolean enabled)
enabled
property to the specified value for
all registered editors that are in autoAdopt
state.
public ItemEditor addEditor(ItemEditor editor)
editor
- the editor to be added
WeakReference
public void removeEditor(ItemEditor editor)
editor
- the editor to be removedpublic java.util.List getEditors()
addEditor(y.option.ItemEditor)
.
addEditor(y.option.ItemEditor)
.public void addEditorListener(Editor.Listener el)
el
so that it will receive notifications
when an editor is added or removed.
public void removeEditorListener(Editor.Listener el)
el
so that it will no longer receive notifications
when an editor is added or removed.
public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
addPropertyChangeListener
in interface PropertyChangeReporter
pcl
- the PropertyChangeListener to be addedremovePropertyChangeListener(java.beans.PropertyChangeListener)
,
addPropertyChangeListener(String,java.beans.PropertyChangeListener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
removePropertyChangeListener
in interface PropertyChangeReporter
pcl
- the PropertyChangeListener to be removedaddPropertyChangeListener(java.beans.PropertyChangeListener)
,
removePropertyChangeListener(String,java.beans.PropertyChangeListener)
public void addPropertyChangeListener(java.lang.String propertyname, java.beans.PropertyChangeListener pcl)
addPropertyChangeListener
in interface PropertyChangeReporter
propertyname
- one of the property names listed abovepcl
- the PropertyChangeListener to be addedaddPropertyChangeListener(java.beans.PropertyChangeListener)
,
removePropertyChangeListener(String,java.beans.PropertyChangeListener)
public void removePropertyChangeListener(java.lang.String propertyname, java.beans.PropertyChangeListener pcl)
removePropertyChangeListener
in interface PropertyChangeReporter
propertyname
- a valid property namepcl
- the PropertyChangeListener to be removedaddPropertyChangeListener(String,java.beans.PropertyChangeListener)
,
removePropertyChangeListener(java.beans.PropertyChangeListener)
protected void firePropertyChange(java.lang.String pn, java.lang.Object oldValue, java.lang.Object newValue)
pn
- the name of the property that has changedoldValue
- the property's previous valuenewValue
- the property's new valueprotected void firePropertyChange(java.beans.PropertyChangeEvent pce)
pce
- the PropertyChangeEvent to be firedpublic void addVetoableChangeListener(java.beans.VetoableChangeListener vcl)
addVetoableChangeListener
in interface VetoableChangeReporter
vcl
- the VetoableChangeListener to be addedremoveVetoableChangeListener(java.beans.VetoableChangeListener)
,
addVetoableChangeListener(String,java.beans.VetoableChangeListener)
public void removeVetoableChangeListener(java.beans.VetoableChangeListener vcl)
removeVetoableChangeListener
in interface VetoableChangeReporter
vcl
- the VetoableChangeListener to be removedaddVetoableChangeListener(java.beans.VetoableChangeListener)
,
removeVetoableChangeListener(String,java.beans.VetoableChangeListener)
public void addVetoableChangeListener(java.lang.String propertyname, java.beans.VetoableChangeListener vcl)
addVetoableChangeListener
in interface VetoableChangeReporter
propertyname
- one of the property names listed abovevcl
- the VetoableChangeListener to be addedaddVetoableChangeListener(java.beans.VetoableChangeListener)
,
removeVetoableChangeListener(java.beans.VetoableChangeListener)
public void removeVetoableChangeListener(java.lang.String propertyname, java.beans.VetoableChangeListener vcl)
removeVetoableChangeListener
in interface VetoableChangeReporter
propertyname
- a valid property namevcl
- the VetoableChangeListener to be removedaddVetoableChangeListener(java.beans.VetoableChangeListener)
,
removeVetoableChangeListener(java.beans.VetoableChangeListener)
protected void fireVetoableChange(java.lang.String pn, java.lang.Object oldValue, java.lang.Object newValue) throws java.beans.PropertyVetoException
pn
- the name of the property that has changedoldValue
- the property's previous valuenewValue
- the property's new value
java.beans.PropertyVetoException
- if a
VetoableChangeListener
threw
PropertyVetoException
protected void fireVetoableChange(java.beans.PropertyChangeEvent pce) throws java.beans.PropertyVetoException
pce
- the PropertyChangeEvent to be fired
java.beans.PropertyVetoException
- if a
VetoableChangeListener
threw
PropertyVetoException
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |