|
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 y.option.ObjectOptionItem y.option.EnumOptionItem
public class EnumOptionItem
An option item for a value that is chosen from a fixed range of
possible values.
Note:
Editors for this item created by the DefaultEditorFactory
and
the TableEditorFactory
are aware of the value range of this
item;
they will update the value range when commitValue
is invoked,
they will adopt the value range when adoptItemValue
is invoked,
and they will adopt the backup value range when resetValue
is
invoked.
Field Summary | |
---|---|
static java.lang.String |
ATTRIBUTE_ITEM_LISTENER
Attribute key used to store an ItemListener . |
static java.lang.String |
ATTRIBUTE_RENDERER
Attribute key used to store an ListCellRenderer . |
static java.lang.String |
PROPERTY_BACKUP_ENUM
Name of property backupEnum . |
static java.lang.String |
PROPERTY_BACKUP_VALUE
Name of property backupValue . |
static java.lang.String |
PROPERTY_ENUM
Name of property enum . |
Fields inherited from class y.option.OptionItem |
---|
ATTRIBUTE_CONTEXT, ATTRIBUTE_GROUPS, ATTRIBUTE_LONG_DESCRIPTION, COLOR_UNDEFINED, name, PROPERTY_CLASS_TYPE, PROPERTY_ENABLED, PROPERTY_TIP_TEXT, PROPERTY_VALUE, PROPERTY_VALUE_UNDEFINED, UNDEFINED |
Constructor Summary | |
---|---|
EnumOptionItem(java.lang.String name)
Creates a new instance of EnumOptionItem. |
|
EnumOptionItem(java.lang.String name,
java.lang.Object[] values,
int index)
Creates a new instance of EnumOptionItem. |
|
EnumOptionItem(java.lang.String name,
java.lang.Object[] values,
java.lang.Object value)
Creates a new instance of EnumOptionItem. |
Method Summary | |
---|---|
void |
add(java.lang.Object item)
Convenience method that just calls add(Object, Object) with item
as both of the arguments. |
void |
add(java.lang.Object item,
java.lang.Object i18nKey)
Populates the choices for this EnumOptionItem. |
void |
addAll(java.util.Map itemI18nPairs)
This method is a convenience for the add(Object, Object) method. |
java.lang.Object[] |
getBackupEnum()
Returns the backup value range. |
java.lang.Object[] |
getEnum()
Returns the range of possible values. |
java.lang.Object[] |
getEnumRange()
Returns the range of possible values. |
int |
getIndex()
Returns the index of the currently set value. |
java.lang.Object |
getInterpretedValue()
This method can be used in conjunction with the empty constructor and the add(Object, Object) method. |
java.lang.String |
getStringValue()
Returns the stringified value of this option item. |
java.lang.String |
getType()
Returns "Enum". |
void |
resetValue()
Overwritten to reset not only the value of this item, but the value range and the valueUndefined property as well. |
void |
setBackupEnum(java.lang.Object[] values)
Sets the backup value range of the item. |
void |
setBackupValue(java.lang.Object value)
Sets the backup value of the item. |
void |
setEnum(java.lang.Object[] values)
Sets the range of possible values. |
void |
setEnum(java.lang.Object[] values,
java.lang.Object value)
Sets the range of possible values. |
void |
setIndex(int index)
Specifies the index of the currently set value. |
void |
setInterpretedValue(java.lang.Object valueObject)
This method can be used in conjunction with the empty constructor and the add(Object, Object) method. |
void |
setItemListener(java.awt.event.ItemListener il)
Deprecated. Customize the used editors. |
void |
setRenderer(javax.swing.ListCellRenderer lcr)
Deprecated. Customize the used editors. |
void |
setStringValue(java.lang.String value)
Sets the stringified value of this option item. |
void |
setUsingIntegers(boolean use)
This implementation invokes setClassType . |
void |
setValue(java.lang.Object value)
Overwritten to update the valueUndefined property as well. |
void |
setValueUndefined(boolean valueUndefined)
Overwritten to take the current state of the item into account. |
Methods inherited from class y.option.ObjectOptionItem |
---|
getBackupValue, getValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ATTRIBUTE_ITEM_LISTENER
ItemListener
.
This attribute exists only for legacy reasons and should not be used
explicitly.
public static final java.lang.String ATTRIBUTE_RENDERER
ListCellRenderer
.
This attribute exists only for legacy reasons and should not be used
explicitly.
public static final java.lang.String PROPERTY_BACKUP_ENUM
backupEnum
.
public static final java.lang.String PROPERTY_BACKUP_VALUE
backupValue
.
public static final java.lang.String PROPERTY_ENUM
enum
.
Constructor Detail |
---|
public EnumOptionItem(java.lang.String name)
name
- the name of this itempublic EnumOptionItem(java.lang.String name, java.lang.Object[] values, java.lang.Object value)
name
- the name of this itemvalues
- the possible values of the optionvalue
- the initial value of the option (must be contained in
values).public EnumOptionItem(java.lang.String name, java.lang.Object[] values, int index)
name
- the name of this itemvalues
- the possible values of the optionindex
- the array index of the initial value.Method Detail |
---|
public java.lang.String getType()
getType
in class ObjectOptionItem
public void setBackupValue(java.lang.Object value)
value
- the new backup valuepublic java.lang.Object[] getBackupEnum()
public void setBackupEnum(java.lang.Object[] values)
values
- the new backup value rangepublic void setIndex(int index)
public int getIndex()
public java.lang.Object[] getEnumRange()
public java.lang.Object[] getEnum()
public void setEnum(java.lang.Object[] values, java.lang.Object value)
values
- the value rangevalue
- the initial valuepublic void setEnum(java.lang.Object[] values)
values
- the value rangepublic java.lang.String getStringValue()
getStringValue
in class OptionItem
public void setStringValue(java.lang.String value)
setIndex
,
setValueUndefined
, setValue
, and/or
resetValue
.
setStringValue
in class OptionItem
public void setUsingIntegers(boolean use)
setClassType
.
public void setValueUndefined(boolean valueUndefined)
setValueUndefined( true )
.
setValueUndefined
in class OptionItem
public void setRenderer(javax.swing.ListCellRenderer lcr)
ListCellRenderer
for the editors to use.
This implementation invokes
setAttribute( ATTRIBUTE_RENDERER, lcr );
public void setItemListener(java.awt.event.ItemListener il)
ItemListener
for the editors to use.
This implementation invokes
setAttribute( ATTRIBUTE_ITEM_LISTENER, il );
public void addAll(java.util.Map itemI18nPairs)
add(Object, Object)
method.
For all entries in the map, the add method will be called using the keys as
the first argument and the values as the second one.
public void add(java.lang.Object item)
add(Object, Object)
with item
as both of the arguments.
public void add(java.lang.Object item, java.lang.Object i18nKey)
getInterpretedValue()
and setInterpretedValue(Object)
methods. The i18nKey will be used as the internal "value".
item
- the item that can be queried and set using the
getInterpretedValue()
and
setInterpretedValue(Object)
methods.i18nKey
- the value as it would have been set using the 3 argument
constructorpublic java.lang.Object getInterpretedValue()
add(Object, Object)
method.
It will not return the internal "value"/i18nKey, but the item,
that was the first argument of the add method.
isValueUndefined
.
public void setInterpretedValue(java.lang.Object valueObject)
add(Object, Object)
method.
It will set the corresponding internal "value"/i18nKey, for the item,
which has previously been passed to the add method as the first value.
setValue
or
setValueUndefined
.
public void setValue(java.lang.Object value)
valueUndefined
property as well.
setValue
in class ObjectOptionItem
OptionItem.publishValue(Object)
public void resetValue()
valueUndefined
property as well.
resetValue
in class ObjectOptionItem
OptionItem.publishValue(Object)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |