org.processmining.framework.util
Class GUIPropertyBoolean

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

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

A boolean property that can be readily displayed as it maintains its own GUI panel. The property will be graphically represented as a check 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));
GUIPropertyBoolean vegetarian = new GUIPropertyBoolean("Vegetarian", false);
testPanel.add(vegetarian.getPropertyPanel()); // add one property
GUIPropertyBoolean breakfast = new GUIPropertyBoolean("Breakfast", "5 Euro extra", true);
testPanel.add(breakfast.getPropertyPanel()); // add another property
return testPanel;

See Also:
getValue, getPropertyPanel

Constructor Summary
GUIPropertyBoolean(java.lang.String name, boolean defaultValue)
          Creates a boolean property without a discription and notification.
GUIPropertyBoolean(java.lang.String name, boolean defaultValue, GuiNotificationTarget target)
          Creates a boolean property without a discription.
GUIPropertyBoolean(java.lang.String name, java.lang.String description, boolean defaultValue)
          Creates a boolean property without notification.
GUIPropertyBoolean(java.lang.String name, java.lang.String description, boolean defaultValue, GuiNotificationTarget target)
          Creates a boolean property.
 
Method Summary
 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.
 javax.swing.JPanel getPropertyPanel()
          Creates GUI panel containg this property, ready to display in some settings dialog.
 boolean getValue()
          The method to be invoked when the value of this property is to be used.
 boolean isEnabled()
          Check whether the checkbox is enabled or disabled
 void mouseClicked(java.awt.event.MouseEvent e)
          The method automatically invoked when changing the checkbox status.
 void mouseEntered(java.awt.event.MouseEvent e)
          Not used.
 void mouseExited(java.awt.event.MouseEvent e)
          Not used.
 void mousePressed(java.awt.event.MouseEvent e)
          Not used.
 void mouseReleased(java.awt.event.MouseEvent e)
          Not used.
 void setSelected(boolean b)
          Sets the state of the boolean propery.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GUIPropertyBoolean

public GUIPropertyBoolean(java.lang.String name,
                          boolean defaultValue)
Creates a boolean property without a discription and notification.

Parameters:
name - the name of this property
defaultValue - the default value of this property

GUIPropertyBoolean

public GUIPropertyBoolean(java.lang.String name,
                          boolean defaultValue,
                          GuiNotificationTarget target)
Creates a boolean property without a discription.

Parameters:
name - the name of this property
defaultValue - the default value of this property
target - the object to be notified as soon the state of this property changes

GUIPropertyBoolean

public GUIPropertyBoolean(java.lang.String name,
                          java.lang.String description,
                          boolean defaultValue)
Creates a boolean property without notification.

Parameters:
name - the name of this property
description - of this property (to be displayed as a tool tip)
defaultValue - the default value of this property

GUIPropertyBoolean

public GUIPropertyBoolean(java.lang.String name,
                          java.lang.String description,
                          boolean defaultValue,
                          GuiNotificationTarget target)
Creates a boolean property.

Parameters:
name - the name of this property
description - of this property (to be displayed as a tool tip)
defaultValue - the default value of this property
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 checkbox status.

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

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Not used.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Not used.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Not used.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Not used.

Specified by:
mouseExited in interface java.awt.event.MouseListener

getValue

public boolean getValue()
The method to be invoked when the value of this property is to be used.

Returns:
the current value of this property

disable

public void disable()
Prevents that this property may be manipulated via the GUI panel.
Note, however, that invoking this method will only have any effect as soon as the GUI panel (and therefore the checkbox object will be built).

See Also:
enable()

enable

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

See Also:
disable()

setSelected

public void setSelected(boolean b)
Sets the state of the boolean propery. .

Parameters:
b - boolean true if the radio button needs to be selected, otherwise false

isEnabled

public boolean isEnabled()
Check whether the checkbox is enabled or disabled

Returns:
boolean true if the checkbox is enabled, false otherwise

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