|
ProgramixGenericLib v5.0.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.text.JTextComponent javax.swing.JTextField com.programix.gui.text.FormatField
public class FormatField
A special kind of JTextField that generally restricts the
characters that can be typed in the field and has the ability to
retrieve the state as a Value
.
Nested Class Summary | |
---|---|
static interface |
FormatField.ValueListener
Implementations of this interface can use addValueListener(ValueListener)
to be notified when the value inside a FormatField changes. |
Nested classes/interfaces inherited from class javax.swing.JTextField |
---|
JTextField.AccessibleJTextField |
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent |
---|
JTextComponent.AccessibleJTextComponent, JTextComponent.KeyBinding |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected boolean |
allowValueListenerNotification
|
protected Value |
emptyReplacement
|
protected Object |
lock
|
protected Value |
value
|
protected String |
valueStr
|
Fields inherited from class javax.swing.JTextField |
---|
notifyAction |
Fields inherited from class javax.swing.text.JTextComponent |
---|
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
FormatField()
|
|
FormatField(int maxColumnCount)
|
|
FormatField(int maxColumnCount,
int visibleColumnCount,
String validInputChar,
Value initialValue)
|
|
FormatField(int maxColumnCount,
String validInputChar,
Value initialValue)
|
|
FormatField(int maxColumnCount,
Value initialValue)
|
Method Summary | |
---|---|
void |
addValueListener(FormatField.ValueListener l)
|
FilterChainDocument |
appendFilter(FilterChainDocument.Filter filter)
|
protected Value |
approveValue(Value proposedValue)
Gives subclasses a chance to approved the proposed new value. |
Value |
getEmptyReplacement()
Returns the current Value to substitute when the proposed value is empty. |
FilterChainDocument |
getFilterChainDocument()
|
String |
getString()
Returns the current value as a trimmed String or null if the field is empty. |
Value |
getValue()
Returns the current contents of the field as a Value . |
boolean |
isEmpty()
Returns true if the current value of this field is null, a zero-length string, or a string of all whitespace. |
boolean |
isNotEmpty()
Returns true if the current value of this field is not "empty" (see isEmpty() }. |
protected void |
notifyValueListeners()
|
protected void |
parseCurrentText()
|
void |
removeValueListener(FormatField.ValueListener l)
|
void |
setEmptyReplacement(String emptyReplacement)
Specifies the String to substitute when the proposed value is empty. |
void |
setEmptyReplacement(Value newEmptyReplacement)
Specifies the Value to substitute when the proposed value is empty. |
void |
setText(String text)
Overridden to call setValue(String) . |
void |
setValue(String text)
Sets the value specified as a String. |
void |
setValue(Value newValue)
Specifies the value to display and notifies any value listeners if there is a visible change in the value. |
protected void |
signalWarning()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Object lock
protected Value value
protected String valueStr
protected Value emptyReplacement
protected boolean allowValueListenerNotification
Constructor Detail |
---|
public FormatField(int maxColumnCount, int visibleColumnCount, String validInputChar, Value initialValue)
public FormatField(int maxColumnCount, String validInputChar, Value initialValue)
public FormatField(int maxColumnCount, Value initialValue)
public FormatField(int maxColumnCount)
public FormatField()
Method Detail |
---|
protected void parseCurrentText()
public void setText(String text)
setValue(String)
.
If a subclass needs to override this method, the subclass should call super.setText().
setText
in class JTextComponent
public void setValue(Value newValue)
getEmptyReplacement()
)
if the passed newValue is either null or if the
Value's isEmpty() method returns true.
If a subclass needs to override this method, the subclass should call super.setValue().
newValue
- the value to try. If null, then the empty
replacement is used instead.protected Value approveValue(Value proposedValue)
The original version of this method on FormatField simply returns the value unchanged.
public Value getValue()
Value
.
Unlike most of the other getters, a Value is always
returned—null is never returned.
public void setValue(String text)
setEmptyReplacement(Value)
).
public String getString()
JTextComponent.getText()
.
Specifically, if isEmpty()
returns true
then this method returns null.
public boolean isEmpty()
public boolean isNotEmpty()
isEmpty()
}.
public FilterChainDocument getFilterChainDocument()
public FilterChainDocument appendFilter(FilterChainDocument.Filter filter)
public void setEmptyReplacement(Value newEmptyReplacement)
public void setEmptyReplacement(String emptyReplacement)
public Value getEmptyReplacement()
protected void signalWarning()
public void addValueListener(FormatField.ValueListener l)
public void removeValueListener(FormatField.ValueListener l)
protected void notifyValueListeners()
|
ProgramixGenericLib v5.0.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |