public abstract class AbstractTextComponentValidator extends Object implements ActionListener, FocusListener, DocumentListener, PropertyChangeListener
validate(). validate() is invoked whenever
DocumentListener)FocusListener)JosmTextField and an ActionEvent is detected| Modifier and Type | Field and Description |
|---|---|
private static Color |
ERROR_BACKGROUND |
private static Border |
ERROR_BORDER |
private String |
msg |
private JTextComponent |
tc |
private Boolean |
valid
remembers whether the content of the text component is currently valid or not; null means,
we don't know yet
|
| Constructor and Description |
|---|
AbstractTextComponentValidator(JTextComponent tc)
Creates the validator and weires it to the text component
tc. |
AbstractTextComponentValidator(JTextComponent tc,
boolean addActionListener)
Alternative constructor that allows to turn off the actionListener.
|
AbstractTextComponentValidator(JTextComponent tc,
boolean addFocusListener,
boolean addDocumentListener,
boolean addActionListener) |
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(ActionEvent arg0) |
void |
changedUpdate(DocumentEvent arg0) |
protected void |
feedbackDisabled() |
protected void |
feedbackInvalid(String msg) |
protected void |
feedbackValid(String msg) |
void |
focusGained(FocusEvent arg0) |
void |
focusLost(FocusEvent arg0) |
JTextComponent |
getComponent()
Replies the decorated text component
|
void |
insertUpdate(DocumentEvent arg0) |
abstract boolean |
isValid()
Replies true if the current content of the decorated text component is valid;
false otherwise
|
void |
propertyChange(PropertyChangeEvent evt) |
void |
removeUpdate(DocumentEvent arg0) |
abstract void |
validate()
Implement in subclasses to validate the content of the text component.
|
private static final Border ERROR_BORDER
private static final Color ERROR_BACKGROUND
private JTextComponent tc
private Boolean valid
public AbstractTextComponentValidator(JTextComponent tc) throws IllegalArgumentException
tc.tc - the text component. Must not be null.IllegalArgumentException - thrown if tc is nullpublic AbstractTextComponentValidator(JTextComponent tc, boolean addActionListener) throws IllegalArgumentException
IllegalArgumentExceptionpublic AbstractTextComponentValidator(JTextComponent tc, boolean addFocusListener, boolean addDocumentListener, boolean addActionListener) throws IllegalArgumentException
IllegalArgumentExceptionprotected void feedbackInvalid(String msg)
protected void feedbackDisabled()
protected void feedbackValid(String msg)
public JTextComponent getComponent()
public abstract void validate()
public abstract boolean isValid()
public void focusGained(FocusEvent arg0)
focusGained in interface FocusListenerpublic void focusLost(FocusEvent arg0)
focusLost in interface FocusListenerpublic void actionPerformed(ActionEvent arg0)
actionPerformed in interface ActionListenerpublic void changedUpdate(DocumentEvent arg0)
changedUpdate in interface DocumentListenerpublic void insertUpdate(DocumentEvent arg0)
insertUpdate in interface DocumentListenerpublic void removeUpdate(DocumentEvent arg0)
removeUpdate in interface DocumentListenerpublic void propertyChange(PropertyChangeEvent evt)
propertyChange in interface PropertyChangeListener