public class GUIPropertyListEnumeration
extends java.lang.Object
implements java.awt.event.ActionListener
notification target
may be specified in order to be informed as soon as the
value has been changed.
JPanel testPanel = new Panel(); // create parent panel
testPanel.setLayout(new BoxLayout(testPanel, BoxLayout.PAGE_AXIS));
ArrayList values = new ArrayList();
values.add("Male");
values.add("Female");
GUIPropertyListEnumeration gender = new GUIPropertyListEnumeration("Gender", values);
testPanel.add(gender.getPropertyPanel()); // add one property
return testPanel;
getValue
,
getPropertyPanel
Modifier and Type | Field and Description |
---|---|
protected javax.swing.JComboBox |
myComboBox |
protected java.lang.String |
myDescription |
protected java.lang.String |
myName |
protected java.util.List<?> |
myPossibleValues |
protected GuiNotificationTarget |
myTarget |
protected java.lang.Object |
myValue |
protected int |
myWidth |
Constructor and Description |
---|
GUIPropertyListEnumeration(java.lang.String name,
java.util.List<?> values)
Creates an enumeration property without a discription and notification.
|
GUIPropertyListEnumeration(java.lang.String name,
java.util.List<?> values,
GuiNotificationTarget target)
Creates an enumeration property without a discription.
|
GUIPropertyListEnumeration(java.lang.String name,
java.lang.String description,
java.util.List<?> values)
Creates an enumeration property without notification.
|
GUIPropertyListEnumeration(java.lang.String name,
java.lang.String description,
java.util.List<?> values,
GuiNotificationTarget target)
Creates an enumeration property.
|
GUIPropertyListEnumeration(java.lang.String name,
java.lang.String description,
java.util.List<?> values,
GuiNotificationTarget target,
int width)
Creates an enumeration property.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
The method automatically invoked when changing the combobox status.
|
void |
disable()
Prevents that this property may be manipulated via the GUI panel.
|
void |
enable()
Re-activates the possibility to manipulate this property via the GUI
panel.
|
java.util.List<?> |
getAllValues()
Retrieves all the possible values specified for this property.
|
javax.swing.JPanel |
getPropertyPanel()
Creates GUI panel containg this property, ready to display in some
settings dialog.
|
java.lang.Object |
getValue()
The method to be invoked when the value of this property is to be used.
|
void |
notifyTarget()
Manually notify the target that the state of the radiolist has been
changed.
|
boolean |
setValue(java.lang.Object value)
Sets the currently selected value of this property.
|
protected java.lang.String myName
protected java.lang.String myDescription
protected java.util.List<?> myPossibleValues
protected java.lang.Object myValue
protected GuiNotificationTarget myTarget
protected javax.swing.JComboBox myComboBox
protected int myWidth
public GUIPropertyListEnumeration(java.lang.String name, java.util.List<?> values)
name
- the name of this propertyvalues
- the possible values of this property. The objects in this list
should either be simple strings or override the toString()
method, which is then displayed as the name of this value in
the ComboBox. The first value in the list is considered as the
default valuepublic GUIPropertyListEnumeration(java.lang.String name, java.lang.String description, java.util.List<?> values)
name
- the name of this propertydescription
- of this property (to be displayed as a tool tip)values
- the possible values of this property. The objects in this list
should either be simple strings or override the toString()
method, which is then displayed as the name of this value in
the ComboBox. The first value in the list is considered as the
default valuepublic GUIPropertyListEnumeration(java.lang.String name, java.util.List<?> values, GuiNotificationTarget target)
name
- the name of this propertyvalues
- the possible values of this property. The objects in this list
should either be simple strings or override the toString()
method, which is then displayed as the name of this value in
the ComboBox. The first value in the list is considered as the
default valuetarget
- the object to be notified as soon the state of this property
changespublic GUIPropertyListEnumeration(java.lang.String name, java.lang.String description, java.util.List<?> values, GuiNotificationTarget target)
name
- the name of this propertydescription
- of this property (to be displayed as a tool tip)values
- the possible values of this property. The objects in this list
should either be simple strings or override the toString()
method, which is then displayed as the name of this value in
the ComboBox. The first value in the list is considered as the
default valuetarget
- the object to be notified as soon the state of this property
changespublic GUIPropertyListEnumeration(java.lang.String name, java.lang.String description, java.util.List<?> values, GuiNotificationTarget target, int width)
name
- the name of this propertydescription
- of this property (to be displayed as a tool tip)values
- the possible values of this property. The objects in this list
should either be simple strings or override the toString()
method, which is then displayed as the name of this value in
the ComboBox. The first value in the list is considered as the
default valuetarget
- the object to be notified as soon the state of this property
changeswidth
- a custom width may be specified (default value is 100
otherwise)public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- the passed action event (not used)public void notifyTarget()
public java.lang.Object getValue()
public boolean setValue(java.lang.Object value)
value
- the value to be selected in the combo boxpublic java.util.List<?> getAllValues()
public void disable()
enable()
public void enable()
disable()
public javax.swing.JPanel getPropertyPanel()