public class IPAddressFormatter extends AbstractFormatter
| Modifier and Type | Field and Description |
|---|---|
protected org.eclipse.swt.widgets.Listener |
keyListener
Key listener
|
EMPTY, ignore, SPACE, text| Constructor and Description |
|---|
IPAddressFormatter()
An empty constructer.
An ip address will have an unique format,so there is no necessary to offer an new format |
| 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 input.
|
java.lang.Object |
getValue()
Returns the current value of the text control if it is a valid ip address.
If invalid, returns null. |
java.lang.Class<java.lang.String> |
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 |
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 |
verifyText(org.eclipse.swt.events.VerifyEvent e) |
beep, setIgnore, updateText, updateTextpublic IPAddressFormatter()
public void detach()
FormattedText
control. Allow to release ressources like additionnal listeners.
Removes the KeyListener on the text widget.
detach in interface ITextFormatterdetach in class AbstractFormatterITextFormatter.detach()public void setText(org.eclipse.swt.widgets.Text text)
Text widget that will be managed by this formatter.
The ancestor is overrided to add a key listener on the text widget.
setText in interface ITextFormattersetText in class AbstractFormattertext - Text widgetITextFormatter.setText(Text)public java.lang.String getDisplayString()
FormattedText when the Text
widget looses focus.
In case the input is invalid (eg. not an invalid ip address), the edit
string is returned in place of the display string.ITextFormatter.getDisplayString()public java.lang.String getEditString()
FormattedText when the Text
widget gains focus.
The value returned is the content of the StringBuilder used as cache.ITextFormatter.getEditString()public java.lang.Object getValue()
null.null elseITextFormatter.getValue()public boolean isValid()
true if current edited value is valid, else returns
false.ITextFormatter.isValid()public void setValue(java.lang.Object value)
value - new ip addressjava.lang.IllegalArgumentException - if not an invalid ipITextFormatter.setValue(java.lang.Object)public void verifyText(org.eclipse.swt.events.VerifyEvent e)
public java.lang.Class<java.lang.String> getValueType()
ITextFormatterITextFormatter handles,
i.e. returns in ITextFormatter.getValue().public boolean isEmpty()
ITextFormattertrue 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.