de.cau.cs.kieler.kex.ui.wizards.exporting
Class TextBoxValidator

java.lang.Object
  extended by de.cau.cs.kieler.kex.ui.wizards.exporting.TextBoxValidator
All Implemented Interfaces:
EventListener, ModifyListener, org.eclipse.swt.internal.SWTEventListener

public class TextBoxValidator
extends Object
implements ModifyListener

This class can be used for nice swt text widget validation. A small image decorates the textfield and a message will pop up.

Rating red

Field Summary
static String WANTS_COMPLETE
          You can use that field for adding boolean flag to your control widget.
 
Constructor Summary
TextBoxValidator(Control control, String msg)
          When creating a new TextBoxValidator object the data Object of the control will check and depending on that flag the decoration will show or not.
 
Method Summary
 boolean check(TypedEvent e)
          Has to override for custom validation.
 String getDecorationType()
          getter for decoration-type.
 void modifyText(ModifyEvent e)
           
 void setDecorationType(String decorationType)
          Set the decoration-type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WANTS_COMPLETE

public static final String WANTS_COMPLETE
You can use that field for adding boolean flag to your control widget. All you have to do is to use the control with Control.setData(String key). When creating a new TextBoxValidator object a first check will be triggered and depending on that flag the decoration will show or not.

See Also:
Constant Field Values
Constructor Detail

TextBoxValidator

public TextBoxValidator(Control control,
                        String msg)
When creating a new TextBoxValidator object the data Object of the control will check and depending on that flag the decoration will show or not. Note: if WANTS_COMPLETE is not set it will be ignored and not shown as initial.

Parameters:
control - , control-field widget which should become decorate.
msg - , the popup msg.
Method Detail

modifyText

public final void modifyText(ModifyEvent e)
Specified by:
modifyText in interface ModifyListener
Parameters:
e - ModifyEvent
See Also:
ModifyListener.

check

public boolean check(TypedEvent e)
Has to override for custom validation. This check will be used to show decoration or not.

Parameters:
e - the triggered typed-event
Returns:
true, if decoration should be shown otherwise return false.

setDecorationType

public final void setDecorationType(String decorationType)
Set the decoration-type. Here you can specify, what decoration should be used.

Parameters:
decorationType - String

getDecorationType

public final String getDecorationType()
getter for decoration-type.

Returns:
String of current decorationType.