org.processmining.framework.util
Class GUIPropertyFloat

java.lang.Object
  extended by org.processmining.framework.util.GUIPropertyFloat
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ChangeListener

public class GUIPropertyFloat
extends java.lang.Object
implements javax.swing.event.ChangeListener

A float property that can be readily displayed as it maintains its own GUI panel. The property will be graphically represented as a label containing the name of the property and a spinner according to the provided value range and step size. 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));
GUIPropertyFloat width = new GUIPropertyFloat("Width", 0.0, 0.0, 10.0, 0.1);
testPanel.add(width.getPropertyPanel()); // add one property
GUIPropertyFloat height = new GUIPropertyFloat("Height", "Height in cm", 0.0, 0.0, 20.0, 0.1);
testPanel.add(height.getPropertyPanel()); // add another property
return testPanel;

See Also:
getValue, getPropertyPanel

Constructor Summary
GUIPropertyFloat(java.lang.String name, float defaultValue, float minValue, float maxValue, float stepSize)
          Creates a float property without a discription and notification.
GUIPropertyFloat(java.lang.String name, float defaultValue, float minValue, float maxValue, float stepSize, GuiNotificationTarget target)
          Creates a float property without a discription.
GUIPropertyFloat(java.lang.String name, java.lang.String description, float defaultValue, float minValue, float maxValue, float stepSize)
          Creates a float property without a notification.
GUIPropertyFloat(java.lang.String name, java.lang.String description, float defaultValue, float minValue, float maxValue, float stepSize, GuiNotificationTarget target)
          Creates a float property.
 
Method Summary
 javax.swing.JPanel getPropertyPanel()
          Creates GUI panel containg this property, ready to display in some settings dialog.
 float getValue()
          The method to be invoked when the value of this property is to be used.
 void stateChanged(javax.swing.event.ChangeEvent e)
          The method automatically invoked when changing the spinner status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GUIPropertyFloat

public GUIPropertyFloat(java.lang.String name,
                        float defaultValue,
                        float minValue,
                        float maxValue,
                        float stepSize)
Creates a float property without a discription and notification.

Parameters:
name - the name of this property
defaultValue - the default value of this property
minValue - the minimal value that can be assigned to this property
maxValue - the maximal value that can be assigned to this property
stepSize - the distance between two adjacent values

GUIPropertyFloat

public GUIPropertyFloat(java.lang.String name,
                        java.lang.String description,
                        float defaultValue,
                        float minValue,
                        float maxValue,
                        float stepSize)
Creates a float property without a 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
minValue - the minimal value that can be assigned to this property
maxValue - the maximal value that can be assigned to this property
stepSize - the distance between two adjacent values

GUIPropertyFloat

public GUIPropertyFloat(java.lang.String name,
                        float defaultValue,
                        float minValue,
                        float maxValue,
                        float stepSize,
                        GuiNotificationTarget target)
Creates a float property without a discription.

Parameters:
name - the name of this property
defaultValue - the default value of this property
minValue - the minimal value that can be assigned to this property
maxValue - the maximal value that can be assigned to this property
stepSize - the distance between two adjacent values
target - the object to be notified as soon the state of this property changes

GUIPropertyFloat

public GUIPropertyFloat(java.lang.String name,
                        java.lang.String description,
                        float defaultValue,
                        float minValue,
                        float maxValue,
                        float stepSize,
                        GuiNotificationTarget target)
Creates a float 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
minValue - the minimal value that can be assigned to this property
maxValue - the maximal value that can be assigned to this property
stepSize - the distance between two adjacent values
target - the object to be notified as soon the state of this property changes
Method Detail

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
The method automatically invoked when changing the spinner status.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e - The passed change event (not used).

getValue

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

Returns:
the current value of this property

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