org.processmining.framework.util
Class GUIPropertyString

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

public class GUIPropertyString
extends java.lang.Object
implements java.awt.event.KeyListener

A string property that can be readily displayed as it maintains its own GUI panel. The property will be graphically represented as a (single line) text field that can be edited. 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));
GUIPropertyString name = new GUIPropertyString("Name", "Anne");
testPanel.add(name.getPropertyPanel()); // add one property
GUIPropertyString city = new GUIPropertyString("City", "Eindhoven");
testPanel.add(city.getPropertyPanel()); // add another property
return testPanel;

See Also:
getValue, getPropertyPanel

Field Summary
protected  java.lang.String myDescription
           
protected  java.lang.String myName
           
protected  GuiNotificationTarget myTarget
           
protected  javax.swing.JTextField myTextField
           
protected  java.lang.String myValue
           
protected  int myWidth
           
 
Constructor Summary
GUIPropertyString(java.lang.String name, java.lang.String defaultValue)
          Creates a boolean property without a discription and notification.
GUIPropertyString(java.lang.String name, java.lang.String defaultValue, GuiNotificationTarget target)
          Creates a boolean property without a discription.
GUIPropertyString(java.lang.String name, java.lang.String description, java.lang.String defaultValue)
          Creates a boolean property without notification.
GUIPropertyString(java.lang.String name, java.lang.String description, java.lang.String defaultValue, GuiNotificationTarget target)
          Creates a boolean property.
GUIPropertyString(java.lang.String name, java.lang.String description, java.lang.String defaultValue, GuiNotificationTarget target, int width)
          Creates a boolean property.
 
Method Summary
 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.
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
          The method automatically invoked when changing the text field status.
 
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

myValue

protected java.lang.String myValue

myWidth

protected int myWidth

myTarget

protected GuiNotificationTarget myTarget

myTextField

protected javax.swing.JTextField myTextField
Constructor Detail

GUIPropertyString

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

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

GUIPropertyString

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

GUIPropertyString

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

GUIPropertyString

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

GUIPropertyString

public GUIPropertyString(java.lang.String name,
                         java.lang.String description,
                         java.lang.String defaultValue,
                         GuiNotificationTarget target,
                         int width)
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
width - a custom width may be specified (default value is 100 otherwise)
Method Detail

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
The method automatically invoked when changing the text field status.

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

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

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

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