Class GUIPropertyListEnumeration
- java.lang.Object
-
- org.processmining.plugins.tsanalyzer2.gui.GUIPropertyListEnumeration
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.util.EventListener
public class GUIPropertyListEnumeration extends java.lang.Object implements java.awt.event.ActionListenerAn enumeration property that can be readily displayed as it maintains its own GUI panel. The property will be graphically represented as a combo box. If a description has been provided, it will be displayed as a tool tip.
Changes performed via the GUI will be immedeately propagated to the internally held property value. Furthermore, anotification targetmay be specified in order to be informed as soon as the value has been changed.
A typical usage scenario looks as follows:
JPanel testPanel = new Panel(); // create parent panel
testPanel.setLayout(new BoxLayout(testPanel, BoxLayout.PAGE_AXIS));
ArrayListvalues = new ArrayList (); values.add("Male"); values.add("Female"); GUIPropertyListEnumeration gender = new GUIPropertyListEnumeration("Gender", values);
testPanel.add(gender.getPropertyPanel()); // add one property
return testPanel;
Note that this property expects a list of possible values rather than a simple java enumeration in order also manage the choice between arbitrary objects. Any set of self-defined objects may be passed to the GUIPropertyListEnumeration as long as these self-defined objects provide a toString() method in a meaningful way.- See Also:
getValue(),getPropertyPanel()
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.JComboBoxmyComboBoxprotected java.lang.StringmyDescriptionprotected java.lang.StringmyNameprotected java.util.List<?>myPossibleValuesprotected GuiNotificationTargetmyTargetprotected java.lang.ObjectmyValueprotected intmyWidth
-
Constructor Summary
Constructors Constructor Description 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.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)The method automatically invoked when changing the combobox status.voiddisable()Prevents that this property may be manipulated via the GUI panel.voidenable()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.JPanelgetPropertyPanel()Creates GUI panel containg this property, ready to display in some settings dialog.java.lang.ObjectgetValue()The method to be invoked when the value of this property is to be used.voidnotifyTarget()Manually notify the target that the state of the radiolist has been changed.booleansetValue(java.lang.Object value)Sets the currently selected value of this property.
-
-
-
Field Detail
-
myName
protected java.lang.String myName
-
myDescription
protected java.lang.String myDescription
-
myPossibleValues
protected java.util.List<?> myPossibleValues
-
myValue
protected java.lang.Object myValue
-
myTarget
protected GuiNotificationTarget myTarget
-
myComboBox
protected javax.swing.JComboBox myComboBox
-
myWidth
protected int myWidth
-
-
Constructor Detail
-
GUIPropertyListEnumeration
public GUIPropertyListEnumeration(java.lang.String name, java.util.List<?> values)Creates an enumeration property without a discription and notification.- Parameters:
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 value
-
GUIPropertyListEnumeration
public GUIPropertyListEnumeration(java.lang.String name, java.lang.String description, java.util.List<?> values)Creates an enumeration property without notification.- Parameters:
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 value
-
GUIPropertyListEnumeration
public GUIPropertyListEnumeration(java.lang.String name, java.util.List<?> values, GuiNotificationTarget target)Creates an enumeration property without a discription.- Parameters:
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 changes
-
GUIPropertyListEnumeration
public GUIPropertyListEnumeration(java.lang.String name, java.lang.String description, java.util.List<?> values, GuiNotificationTarget target)Creates an enumeration property.- Parameters:
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 changes
-
GUIPropertyListEnumeration
public GUIPropertyListEnumeration(java.lang.String name, java.lang.String description, java.util.List<?> values, GuiNotificationTarget target, int width)Creates an enumeration property.- Parameters:
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)
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
The method automatically invoked when changing the combobox status.- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener- Parameters:
e- the passed action event (not used)
-
notifyTarget
public void notifyTarget()
Manually notify the target that the state of the radiolist has been changed.
-
getValue
public java.lang.Object getValue()
The method to be invoked when the value of this property is to be used.- Returns:
- the current value of this property
-
setValue
public boolean setValue(java.lang.Object value)
Sets the currently selected value of this property. Note that it is assumed that this value is in the list of possible values- Parameters:
value- the value to be selected in the combo box
-
getAllValues
public java.util.List<?> getAllValues()
Retrieves all the possible values specified for this property.- Returns:
- all possible values (including the current value)
-
disable
public void disable()
Prevents that this property may be manipulated via the GUI panel.- See Also:
enable()
-
enable
public void enable()
Re-activates the possibility to manipulate this property via the GUI panel.- See Also:
disable()
-
getPropertyPanel
public javax.swing.JPanel getPropertyPanel()
Creates GUI panel containg this property, ready to display in some settings dialog.- Returns:
- the graphical panel representing this property
-
-