org.processmining.framework.util
Class GUIPropertySetEnumeration

java.lang.Object
  extended by org.processmining.framework.util.GUIPropertySetEnumeration
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class GUIPropertySetEnumeration
extends java.lang.Object
implements java.awt.event.ActionListener

An 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, a notification target may 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));
HashSet values = new HashSet(); values.add("Male"); values.add("Female"); GUIPropertySetEnumeration gender = new GUIPropertySetEnumeration("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

Constructor Summary
GUIPropertySetEnumeration(java.lang.String name, java.util.Set values)
          Creates an enumeration property without a discription and notification.
GUIPropertySetEnumeration(java.lang.String name, java.util.Set values, GuiNotificationTarget target)
          Creates an enumeration property without a discription.
GUIPropertySetEnumeration(java.lang.String name, java.lang.String description, java.util.Set values)
          Creates an enumeration property without notification.
GUIPropertySetEnumeration(java.lang.String name, java.lang.String description, java.util.Set values, GuiNotificationTarget target)
          Creates an enumeration property.
GUIPropertySetEnumeration(java.lang.String name, java.lang.String description, java.util.Set values, GuiNotificationTarget target, int width)
          Creates an enumeration property.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          The method automatically invoked when changing the combobox status.
 java.util.Set 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GUIPropertySetEnumeration

public GUIPropertySetEnumeration(java.lang.String name,
                                 java.util.Set values)
Creates an enumeration property without a discription and notification.

Parameters:
name - the name of this property
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

GUIPropertySetEnumeration

public GUIPropertySetEnumeration(java.lang.String name,
                                 java.lang.String description,
                                 java.util.Set values)
Creates an enumeration property without notification.

Parameters:
name - the name of this property
description - 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

GUIPropertySetEnumeration

public GUIPropertySetEnumeration(java.lang.String name,
                                 java.util.Set values,
                                 GuiNotificationTarget target)
Creates an enumeration property without a discription.

Parameters:
name - the name of this property
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
target - the object to be notified as soon the state of this property changes

GUIPropertySetEnumeration

public GUIPropertySetEnumeration(java.lang.String name,
                                 java.lang.String description,
                                 java.util.Set values,
                                 GuiNotificationTarget target)
Creates an enumeration property.

Parameters:
name - the name of this property
description - 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
target - the object to be notified as soon the state of this property changes

GUIPropertySetEnumeration

public GUIPropertySetEnumeration(java.lang.String name,
                                 java.lang.String description,
                                 java.util.Set values,
                                 GuiNotificationTarget target,
                                 int width)
Creates an enumeration property.

Parameters:
name - the name of this property
description - 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
target - the object to be notified as soon the state of this property changes
width - 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:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - the passed action event (not used)

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

getAllValues

public java.util.Set getAllValues()
Retrieves all the possible values specified for this property.

Returns:
all possible values (including the current value)

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