|
JClass 4.5.0 API Documentation |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.klg.jclass.field.Field
Note that this class is not a part of the public API and is public as a side-effect of the implementation.
This is the "glue" class for JClass Field. It takes events from the Swing visual components and passes this information on to the generic "validator" that is set on the field. For clarity we note here that JClass Field "Validators" are actually "validators/formatters/parsers" Also that this class controls the posting of the Validation and Field events.
Inner Class Summary | |
class |
Field.TextFieldContent
|
Field Summary | |
protected boolean |
allow_text_change
|
static int |
AS_IS
|
protected boolean |
beepOnInvalid
|
static int |
CLEAR_FIELD
|
protected Locale |
current
|
protected Object |
defaultValue
|
protected com.klg.jclass.field.Field.TextFieldDocument |
document
|
protected Class |
edit_class
|
protected Object |
edit_initial_value
|
protected Object |
event_source
|
protected boolean |
has_focus
|
protected boolean |
internal_text_change
|
protected boolean |
internalBackgroundChange
|
protected boolean |
internalForegroundChange
|
static int |
INVALID
|
protected Color |
invalidBackground
|
protected Color |
invalidForeground
|
protected int |
invalidPolicy
|
protected boolean |
is_cell_editor
|
protected com.klg.jclass.field.Field.Listeners |
listener
|
static int |
LOWERCASE
|
protected boolean |
okayToBeep
|
protected Object |
previousValue
|
protected com.klg.jclass.util.JCListenerList |
propertyListeners
|
static int |
RESTORE_DEFAULT
|
static int |
RESTORE_PREVIOUS
|
protected boolean |
restoringPrevious
|
protected boolean |
select_all
|
protected boolean |
select_on_enter
|
static int |
SHOW_INVALID
|
protected int |
state
|
static int |
UNDEREDIT
|
static int |
UPPERCASE
|
static int |
VALID
|
protected JCValidator |
validator
|
protected Color |
validBackground
|
protected Color |
validForeground
|
protected com.klg.jclass.util.JCListenerList |
valueListeners
|
protected com.klg.jclass.util.value.JCValueModel |
valueModel
|
protected Component |
vc
|
Constructor Summary | |
Field(Component vc,
JCValidator validator)
|
Method Summary | |
void |
addListDataListener(ListDataListener l)
|
void |
addNotify()
This should be called by the "vc" to inform the component that it has been added. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
void |
addValueListener(com.klg.jclass.util.value.JCValueListener listener)
Adds a listener for changes to the value. |
void |
commitEdit()
Commits the current field under edit. |
void |
commitEdit(AWTEvent e)
Commits the current field under edit. |
protected void |
fireValueChangedEvent(com.klg.jclass.util.value.JCValueEvent event)
Fires a valueChanged event to the JCValuelisteners. |
protected void |
fireValueChangingEvent(com.klg.jclass.util.value.JCValueEvent event)
Fires a valueChanging event to the JCValuelisteners. |
boolean |
getAllowTextChange()
Used by the Visual Component to see if a call that has been made to its setText() method is permitted. |
protected boolean |
getBeepOnInvalid()
Returns the value of beepOnInvalid. |
Component |
getComponent()
Returns the visual component currently being used. |
DataProperties |
getDataProperties()
Gets the Bean property which wraps the validator, data model, and Field objects properties into one property. |
Object |
getElementAt(int index)
Returns the element at a given index in a pick list. |
Object |
getEventSource()
Returns the Object that is being used as the source of posted events. |
protected Color |
getInvalidBackground()
Returns the background color used in the visual component if the field is invalid. |
protected Color |
getInvalidForeground()
Returns the foreground color used in the visual component if the field is invalid. |
JCInvalidInfo |
getInvalidInfo()
Returns the Invalid properties. |
protected int |
getInvalidPolicy()
Returns the value of invalidPolicy. |
Object |
getSelectedItem()
|
boolean |
getSelectOnEnter()
Returns a flag indicating the selection status on entering the field. |
int |
getSize()
Returns the number of items in the pick list. |
int |
getState()
Returns the state of the field. |
protected JTextField |
getTextField()
Returns a JTextField given a component. |
JCValidator |
getValidator()
Returns the current validator being used by this field of the field. |
protected Color |
getValidBackground()
Returns the background color used in the visual component if the field is valid. |
protected Color |
getValidForeground()
Returns the foreground color used in the visual component if the field is valid. |
Object |
getValue()
Returns the internal value of the field. |
com.klg.jclass.util.value.JCValueModel |
getValueModel()
Returns the data model being used by the field. |
Component |
getVisualComponent()
This method is internal. |
protected void |
processFailure()
Called either from after a failed parse or after a failed. |
void |
removeListDataListener(ListDataListener l)
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
void |
removeValueListener(com.klg.jclass.util.value.JCValueListener listener)
Removes a listener for changes to the value. |
protected void |
setBeepOnInvalid(boolean beep)
Sets the value of beepOnInvalid. |
void |
setClass(Class c)
Sets the internal value of the field. |
protected void |
setColors(Color background,
Color foreground)
Sets the background and foreground of the component. |
void |
setDataProperties(DataProperties data_properties)
Sets a Bean property which wraps the validator, data model, and Field objects properties into one property. |
void |
setEventSource(Object o)
Sets the Object that is being used as the source of posted events. |
protected void |
setInvalidBackground(Color background)
Sets the background color used in the visual component if the field is invalid. |
protected void |
setInvalidForeground(Color foreground)
Sets the foreground color used in the visual component if the field is invalid. |
void |
setInvalidInfo(JCInvalidInfo info)
Sets the Invalid properties. |
protected void |
setInvalidPolicy(int policy)
Sets the invalid policy. |
void |
setSelectedItem(Object anItem)
|
void |
setSelectOnEnter(boolean select)
Sets the flag that determines whether of not the Text Component is automatically selected when the component gains focus. |
protected void |
setStateInvalid()
Does everything necessary to make the state invalid, including swapping colors. |
protected void |
setStateUnderEdit()
Does everything necessary to make the state "under edit," including swapping colors. |
protected void |
setStateValid()
Does everything necessary to make the state valid, including swapping colors. |
protected void |
setText(String text_string)
Sets the actual text string of the visual component. |
void |
setValidator(JCValidator validator)
Sets the validator being used by the field. |
void |
setValue(Object new_value)
Sets the internal value of the field. |
protected void |
setValue(Object new_value,
boolean exit_on_detecting_equality)
Sets the internal value of the field. |
protected void |
setValueAndReformat(Object new_value)
Sets the internal value of the field. |
void |
setValueModel(com.klg.jclass.util.value.JCValueModel value_model)
Sets the data model being used by the field. |
void |
textCursorMoveBegin(TextCursorEvent e)
Invoked before the field's cursor is moved. |
void |
textValueChangeBegin(TextEvent e)
Invoked before the field's value is changed. |
void |
textValueChangeEnd(TextEvent e)
Invoked after the field's value is changed. |
void |
valueChanged(com.klg.jclass.util.value.JCValueEvent event)
|
void |
valueChanging(com.klg.jclass.util.value.JCValueEvent event)
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int VALID
public static final int UNDEREDIT
public static final int INVALID
public static final int SHOW_INVALID
public static final int RESTORE_DEFAULT
public static final int RESTORE_PREVIOUS
public static final int CLEAR_FIELD
public static final int AS_IS
public static final int UPPERCASE
public static final int LOWERCASE
protected boolean internalBackgroundChange
protected boolean internalForegroundChange
protected Color invalidBackground
protected Color invalidForeground
protected Color validBackground
protected Color validForeground
protected boolean select_on_enter
protected Object edit_initial_value
protected Class edit_class
protected Object defaultValue
protected Object previousValue
protected JCValidator validator
protected Locale current
protected Object event_source
protected Component vc
protected int state
protected int invalidPolicy
protected boolean beepOnInvalid
protected boolean internal_text_change
protected boolean has_focus
protected com.klg.jclass.util.JCListenerList propertyListeners
protected com.klg.jclass.util.JCListenerList valueListeners
protected com.klg.jclass.field.Field.Listeners listener
protected boolean okayToBeep
protected boolean allow_text_change
protected boolean is_cell_editor
protected boolean select_all
protected com.klg.jclass.util.value.JCValueModel valueModel
protected com.klg.jclass.field.Field.TextFieldDocument document
protected boolean restoringPrevious
Constructor Detail |
public Field(Component vc, JCValidator validator)
vc
- visual component used to control input;validator
- validator used to validate "value."value
- object validated by validator; This must match the validator.Method Detail |
protected JTextField getTextField()
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- The PropertyChangeListener to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
listener
- The PropertyChangeListener to be removedpublic void addValueListener(com.klg.jclass.util.value.JCValueListener listener)
listener
- The ValueListener to be addedpublic void removeValueListener(com.klg.jclass.util.value.JCValueListener listener)
listener
- The ValueListener to be removedpublic void setDataProperties(DataProperties data_properties)
public DataProperties getDataProperties()
public void addNotify()
protected Color getInvalidBackground()
protected void setInvalidBackground(Color background)
Component.setBackground(java.awt.Color)
protected Color getInvalidForeground()
protected void setInvalidForeground(Color foreground)
Component.setForeground(java.awt.Color)
protected Color getValidBackground()
protected Color getValidForeground()
protected boolean getBeepOnInvalid()
setBeepOnInvalid(boolean)
protected void setBeepOnInvalid(boolean beep)
setStateInvalid()
protected int getInvalidPolicy()
setInvalidPolicy(int)
protected void setInvalidPolicy(int policy)
Value | Meaning |
---|---|
SHOW_INVALID | Show invalid value in the invalidBackground and Foreground colors |
RESTORE_DEFAULT | Restore the value to the defaultValue |
RESTORE_PREVIOUS | Restore the value to the previous valid value |
CLEAR_FIELD | Clear the field on invalid input |
public JCInvalidInfo getInvalidInfo()
public void setInvalidInfo(JCInvalidInfo info)
public int getState()
Value | Meaning |
---|---|
VALID | The field is valid |
INVALID | The field is invalid |
UNDEREDIT | The field is currently under edit and hence the state is indeterminate |
public boolean getSelectOnEnter()
setSelectOnEnter(boolean)
public void setSelectOnEnter(boolean select)
public Object getValue()
protected void setValueAndReformat(Object new_value)
public void setClass(Class c)
public void setValue(Object new_value)
protected void setValue(Object new_value, boolean exit_on_detecting_equality)
public boolean getAllowTextChange()
protected void setText(String text_string)
public com.klg.jclass.util.value.JCValueModel getValueModel()
public void setValueModel(com.klg.jclass.util.value.JCValueModel value_model)
public JCValidator getValidator()
public void setValidator(JCValidator validator)
protected void setColors(Color background, Color foreground)
background
- if background is null, it will use the default backgroundforeground
- if foreground is null, it will use the initial foregroundprotected void processFailure()
protected void setStateInvalid()
protected void setStateValid()
protected void setStateUnderEdit()
public Component getComponent()
public Object getEventSource()
public void setEventSource(Object o)
public void commitEdit()
public void commitEdit(AWTEvent e)
public Component getVisualComponent()
public void textValueChangeBegin(TextEvent e)
public void textValueChangeEnd(TextEvent e)
public void textCursorMoveBegin(TextCursorEvent e)
public int getSize()
public Object getElementAt(int index)
public void addListDataListener(ListDataListener l)
public void removeListDataListener(ListDataListener l)
public void setSelectedItem(Object anItem)
public Object getSelectedItem()
public void valueChanging(com.klg.jclass.util.value.JCValueEvent event)
public void valueChanged(com.klg.jclass.util.value.JCValueEvent event)
protected void fireValueChangingEvent(com.klg.jclass.util.value.JCValueEvent event)
protected void fireValueChangedEvent(com.klg.jclass.util.value.JCValueEvent event)
|
Copyright© 1999-2000 KL Group Inc. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |