Class AbstractFormatter
java.lang.Object
org.eclipse.nebula.widgets.formattedtext.AbstractFormatter
- All Implemented Interfaces:
java.util.EventListener
,ITextFormatter
,org.eclipse.swt.events.VerifyListener
,org.eclipse.swt.internal.SWTEventListener
- Direct Known Subclasses:
DateTimeFormatter
,IPAddressFormatter
,MaskFormatter
,NumberFormatter
,StringFormatter
public abstract class AbstractFormatter extends java.lang.Object implements ITextFormatter
Base class of formatters. Formatters can directly implement
ITextFormatter
,
or inherit this abstract class.Provide several common functionalities and constants for the formatters.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description AbstractFormatter()
-
Method Summary
Modifier and Type Method Description protected void
beep()
Emits an audio beep.void
detach()
Called when the formatter is replaced by an other one in theFormattedText
control.void
setIgnore(boolean ignore)
Sets theignore
flag.void
setText(org.eclipse.swt.widgets.Text text)
Sets theText
widget that will be managed by this formatter.protected void
updateText(java.lang.String t)
Updates the text in theText
widget.protected void
updateText(java.lang.String t, int pos)
Updates the text in theText
widget.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.nebula.widgets.formattedtext.ITextFormatter
getDisplayString, getEditString, getValue, getValueType, isEmpty, isValid, setValue
-
Field Details
-
SPACE
protected static final char SPACESpace character- See Also:
- Constant Field Values
-
EMPTY
protected static final java.lang.String EMPTYEmpty String- See Also:
- Constant Field Values
-
text
protected org.eclipse.swt.widgets.Text textManagedText
widget -
ignore
protected boolean ignoreFlag indicating if VerifyEvent must be ignored (true) or not (false)
-
-
Constructor Details
-
AbstractFormatter
public AbstractFormatter()
-
-
Method Details
-
beep
protected void beep()Emits an audio beep. -
detach
public void detach()Called when the formatter is replaced by an other one in theFormattedText
control. Allow to release resources like additional listeners.By default, do nothing. Override if needed.
- Specified by:
detach
in interfaceITextFormatter
- See Also:
ITextFormatter.detach()
-
setIgnore
public void setIgnore(boolean ignore)Sets theignore
flag.- Specified by:
setIgnore
in interfaceITextFormatter
- Parameters:
ignore
- when true, VerifyEvent events are processed.- See Also:
ITextFormatter.setIgnore(boolean)
-
setText
public void setText(org.eclipse.swt.widgets.Text text)Sets theText
widget that will be managed by this formatter.- Specified by:
setText
in interfaceITextFormatter
- Parameters:
text
- Text widget- See Also:
ITextFormatter.setText(Text)
-
updateText
protected void updateText(java.lang.String t)Updates the text in theText
widget. The absolute position of the cursor in the widget is preserved.- Parameters:
t
- new text
-
updateText
protected void updateText(java.lang.String t, int pos)Updates the text in theText
widget. The cursor is set to the given position.- Parameters:
t
- new textpos
- new cursor's position
-