public interface ITextFormatter
extends org.eclipse.swt.events.VerifyListener
Each formatter is associated with a Text control and can not be
shared. Formatters have and edit mask applied when the associated Text has
the focus, and a display mask for when the Text looses the focus.
The formatter must control editing keystroke by keystroke. For this is it
declared as a VerifyListener of the Text widget.
| Modifier and Type | Method and Description |
|---|---|
void |
detach()
Called when the formatter is replaced by an other one in the
FormattedText
control. |
java.lang.String |
getDisplayString()
Returns the current value formatted for display.
|
java.lang.String |
getEditString()
Returns the current value formatted for editing.
|
java.lang.Object |
getValue()
Returns the current value of the text control.
|
java.lang.Class<?> |
getValueType()
Returns the type of value this
ITextFormatter handles,
i.e. |
boolean |
isEmpty()
Returns
true if current edited value is empty, else returns
false. |
boolean |
isValid()
Returns
true if current edited value is valid, else returns
false. |
void |
setIgnore(boolean ignore)
Specify whether or not
VerifyEvent events must be processed. |
void |
setText(org.eclipse.swt.widgets.Text text)
Sets the
Text widget that will be managed by this formatter. |
void |
setValue(java.lang.Object value)
Sets the value to edit.
|
void detach()
FormattedText
control. Allow to release resources like additional listeners.java.lang.String getDisplayString()
FormattedText when the Text
widget looses focus.java.lang.String getEditString()
FormattedText when the Text
widget gains focus.java.lang.Object getValue()
null.java.lang.Class<?> getValueType()
ITextFormatter handles,
i.e. returns in getValue().boolean isEmpty()
true if current edited value is empty, else returns
false. An empty value depends of the formatter and is not
just an empty string in the Text widget.boolean isValid()
true if current edited value is valid, else returns
false.void setIgnore(boolean ignore)
VerifyEvent events must be processed.
Those events are the base of all formatters, allowing on-the-fly
processing of each text change in the Text widget.
In some situations (e.g. when focus change), the FormattedText
must change the text in the widget without formatting.ignore - when true, VerifyEvent events are processed.void setText(org.eclipse.swt.widgets.Text text)
Text widget that will be managed by this formatter.text - Text widgetvoid setValue(java.lang.Object value)
value - value