Class GUIPropertyInteger
- java.lang.Object
-
- org.processmining.plugins.tsanalyzer2.gui.GUIPropertyInteger
-
- All Implemented Interfaces:
java.util.EventListener,javax.swing.event.ChangeListener
public class GUIPropertyInteger extends java.lang.Object implements javax.swing.event.ChangeListenerAn integer 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. 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));
GUIPropertyInteger age = new GUIPropertyInteger("Age", 0, 0, 100);
testPanel.add(age.getPropertyPanel()); // add one property
GUIPropertyInteger height = new GUIPropertyInteger("Height", "Height in cm", 0, 50, 250);
testPanel.add(height.getPropertyPanel()); // add another property
return testPanel;
- See Also:
getValue(),getPropertyPanel()
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanmyEditableprotected intmyWidth
-
Constructor Summary
Constructors Constructor Description GUIPropertyInteger(java.lang.String name, int defaultValue, int minValue, int maxValue)Creates an integer property without a discription and notification.GUIPropertyInteger(java.lang.String name, int defaultValue, int minValue, int maxValue, GuiNotificationTarget target)Creates an integer property without a discription.GUIPropertyInteger(java.lang.String name, java.lang.String description, int defaultValue, int minValue, int maxValue)Creates an integer property without notification.GUIPropertyInteger(java.lang.String name, java.lang.String description, int defaultValue, int minValue, int maxValue, GuiNotificationTarget target, int width, boolean editable)Creates an integer property.GUIPropertyInteger(java.lang.String name, java.lang.String description, int defaultValue, GuiNotificationTarget target, int width, boolean editable)Creates an integer property without a minimal and minimal value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.javax.swing.JPanelgetPropertyPanel()Creates GUI panel containg this property, ready to display in some settings dialog.intgetValue()The method to be invoked when the value of this property is to be used.booleanisEnabled()Checks whether the spinner is currently enabled or disabled.voidsetValue(int value)Sets the value of this propertyvoidstateChanged(javax.swing.event.ChangeEvent e)The method automatically invoked when changing the spinner status.
-
-
-
Constructor Detail
-
GUIPropertyInteger
public GUIPropertyInteger(java.lang.String name, int defaultValue, int minValue, int maxValue)Creates an integer property without a discription and notification.- Parameters:
name- the name of this propertydefaultValue- the default value of this propertyminValue- the minimal value that can be assigned to this propertymaxValue- the maximal value that can be assigned to this property
-
GUIPropertyInteger
public GUIPropertyInteger(java.lang.String name, java.lang.String description, int defaultValue, int minValue, int maxValue)Creates an integer property without notification.- Parameters:
name- the name of this propertydescription- of this property (to be displayed as a tool tip)defaultValue- the default value of this propertyminValue- the minimal value that can be assigned to this propertymaxValue- the maximal value that can be assigned to this property
-
GUIPropertyInteger
public GUIPropertyInteger(java.lang.String name, int defaultValue, int minValue, int maxValue, GuiNotificationTarget target)Creates an integer property without a discription.- Parameters:
name- the name of this propertydefaultValue- the default value of this propertyminValue- the minimal value that can be assigned to this propertymaxValue- the maximal value that can be assigned to this propertytarget- the object to be notified as soon the state of this property changes
-
GUIPropertyInteger
public GUIPropertyInteger(java.lang.String name, java.lang.String description, int defaultValue, int minValue, int maxValue, GuiNotificationTarget target, int width, boolean editable)Creates an integer property.- Parameters:
name- the name of this propertydescription- of this property (to be displayed as a tool tip)defaultValue- the default value of this propertyminValue- the minimal value that can be assigned to this propertymaxValue- the maximal value that can be assigned to this propertytarget- the object to be notified as soon the state of this property changes
-
GUIPropertyInteger
public GUIPropertyInteger(java.lang.String name, java.lang.String description, int defaultValue, GuiNotificationTarget target, int width, boolean editable)Creates an integer property without a minimal and minimal value.- Parameters:
name- the name of this propertydescription- of this property (to be displayed as a tool tip)defaultValue- the default value of this propertytarget- 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:
stateChangedin interfacejavax.swing.event.ChangeListener- Parameters:
e- The passed change event (not used).
-
getValue
public int getValue()
The method to be invoked when the value of this property is to be used.- Returns:
- the current value of this property
-
isEnabled
public boolean isEnabled()
Checks whether the spinner is currently enabled or disabled.- Returns:
trueif is enabled,falseotherwise
-
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()
-
setValue
public void setValue(int value)
Sets the value of this property- Parameters:
value- double
-
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
-
-