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 voidbeep()Emits an audio beep.voiddetach()Called when the formatter is replaced by an other one in theFormattedTextcontrol.voidsetIgnore(boolean ignore)Sets theignoreflag.voidsetText(org.eclipse.swt.widgets.Text text)Sets theTextwidget that will be managed by this formatter.protected voidupdateText(java.lang.String t)Updates the text in theTextwidget.protected voidupdateText(java.lang.String t, int pos)Updates the text in theTextwidget.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 textManagedTextwidget -
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 theFormattedTextcontrol. Allow to release resources like additional listeners.By default, do nothing. Override if needed.
- Specified by:
detachin interfaceITextFormatter- See Also:
ITextFormatter.detach()
-
setIgnore
public void setIgnore(boolean ignore)Sets theignoreflag.- Specified by:
setIgnorein 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 theTextwidget that will be managed by this formatter.- Specified by:
setTextin interfaceITextFormatter- Parameters:
text- Text widget- See Also:
ITextFormatter.setText(Text)
-
updateText
protected void updateText(java.lang.String t)Updates the text in theTextwidget. 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 theTextwidget. The cursor is set to the given position.- Parameters:
t- new textpos- new cursor's position
-