org.processmining.framework.util
Class GuiPropertyListRadio

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

public class GuiPropertyListRadio
extends java.lang.Object
implements java.awt.event.MouseListener

A list of strings property that can be readily displayed as it maintains its own GUI panel. The property will be graphically represented as a set of radio buttons. 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));
ArrayList values = new ArrayList(); values.add("Male"); values.add("Female"); GuiPropertyListRadio gender = new GuiPropertyListRadio("Gender", values);
testPanel.add(gender.getPropertyPanel()); // add one property
return testPanel;

See Also:
getValue, getPropertyPanel

Field Summary
protected  java.lang.String myDescription
           
protected  java.lang.String myName
           
protected  java.util.List<java.lang.String> myPossibleValues
           
protected  javax.swing.ButtonGroup myRadioButtons
           
protected  GuiNotificationTarget myTarget
           
protected  java.lang.String myValue
           
 
Constructor Summary
GuiPropertyListRadio(java.lang.String name, java.util.List<java.lang.String> values)
          Creates an enumeration property without a discription and notification.
GuiPropertyListRadio(java.lang.String name, java.util.List<java.lang.String> values, GuiNotificationTarget target)
          Creates an enumeration property without a discription.
GuiPropertyListRadio(java.lang.String name, java.lang.String description, java.util.List<java.lang.String> values)
          Creates an enumeration property without notification.
GuiPropertyListRadio(java.lang.String name, java.lang.String description, java.util.List<java.lang.String> values, GuiNotificationTarget target)
          Creates an enumeration property.
 
Method Summary
 void disable(java.lang.String toDisable)
          Prevents that this property may be manipulated via the GUI panel.
 void enable(java.lang.String toEnable)
          Re-activates the possibility to manipulate this property via the GUI panel.
 java.util.List<java.lang.String> 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.String getValue()
          The method to be invoked when the value of this property is to be used.
 boolean isEnabled(java.lang.String toCheck)
          Check whether one of the radio buttons is enabled or disabled
 void mouseClicked(java.awt.event.MouseEvent e)
          The method automatically invoked when changing the combobox status.
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void notifyTarget()
          Manually notify the target that the state of the radiolist has been changed.
 void setSelected(java.lang.String toSetSelected, boolean b)
          Sets the state of respective radio button.
 void stateChanged()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myName

protected java.lang.String myName

myDescription

protected java.lang.String myDescription

myPossibleValues

protected java.util.List<java.lang.String> myPossibleValues

myValue

protected java.lang.String myValue

myTarget

protected GuiNotificationTarget myTarget

myRadioButtons

protected javax.swing.ButtonGroup myRadioButtons
Constructor Detail

GuiPropertyListRadio

public GuiPropertyListRadio(java.lang.String name,
                            java.util.List<java.lang.String> 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

GuiPropertyListRadio

public GuiPropertyListRadio(java.lang.String name,
                            java.lang.String description,
                            java.util.List<java.lang.String> 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

GuiPropertyListRadio

public GuiPropertyListRadio(java.lang.String name,
                            java.util.List<java.lang.String> 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

GuiPropertyListRadio

public GuiPropertyListRadio(java.lang.String name,
                            java.lang.String description,
                            java.util.List<java.lang.String> 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
Method Detail

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
The method automatically invoked when changing the combobox status.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - the passed action event (not used)

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

stateChanged

public void stateChanged()

getValue

public java.lang.String 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.List<java.lang.String> getAllValues()
Retrieves all the possible values specified for this property.

Returns:
all possible values (including the current value)

disable

public void disable(java.lang.String toDisable)
Prevents that this property may be manipulated via the GUI panel.

Parameters:
the - name of the radio button to disable
See Also:
enable(String)

enable

public void enable(java.lang.String toEnable)
Re-activates the possibility to manipulate this property via the GUI panel.

Parameters:
the - name of the radio button to enable
See Also:
disable(String)

setSelected

public void setSelected(java.lang.String toSetSelected,
                        boolean b)
Sets the state of respective radio button. In the case that the radiobutton had been disabled and it needs to be selected, the call will be ignored.

Parameters:
toSetSelected - String the name of the radio button to select/deselect
b - boolean true if the radio button is selected, otherwise false

isEnabled

public boolean isEnabled(java.lang.String toCheck)
Check whether one of the radio buttons is enabled or disabled

Parameters:
toCheck - String the name of the radiobutton
Returns:
boolean true when there exists in this property an radiobox with the same name which is enabled, false otherwise

notifyTarget

public void notifyTarget()
Manually notify the target that the state of the radiolist has been changed.


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