|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator
public abstract class AbstractTextComponentValidator
This is an abstract class for a validator on a text component.
Subclasses implement validate()
. validate()
is invoked whenever
DocumentListener
)FocusListener
)JTextField
and an ActionEvent
is detected
Field Summary | |
---|---|
private static java.awt.Color |
ERROR_BACKGROUND
|
private static javax.swing.border.Border |
ERROR_BORDER
|
private java.lang.String |
msg
|
private javax.swing.text.JTextComponent |
tc
|
private java.lang.Boolean |
valid
remembers whether the content of the text component is currently valid or not; null means, we don't know yet |
Constructor Summary | |
---|---|
AbstractTextComponentValidator(javax.swing.text.JTextComponent tc)
Creates the validator and weires it to the text component tc . |
|
AbstractTextComponentValidator(javax.swing.text.JTextComponent tc,
boolean addActionListener)
Alternative constructor that allows to turn off the actionListener. |
|
AbstractTextComponentValidator(javax.swing.text.JTextComponent tc,
boolean addFocusListener,
boolean addDocumentListener,
boolean addActionListener)
|
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent arg0)
|
void |
changedUpdate(javax.swing.event.DocumentEvent arg0)
|
protected void |
feedbackDisabled()
|
protected void |
feedbackInvalid(java.lang.String msg)
|
protected void |
feedbackValid(java.lang.String msg)
|
void |
focusGained(java.awt.event.FocusEvent arg0)
|
void |
focusLost(java.awt.event.FocusEvent arg0)
|
javax.swing.text.JTextComponent |
getComponent()
Replies the decorated text component |
void |
insertUpdate(javax.swing.event.DocumentEvent arg0)
|
abstract boolean |
isValid()
Replies true if the current content of the decorated text component is valid; false otherwise |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
|
void |
removeUpdate(javax.swing.event.DocumentEvent arg0)
|
abstract void |
validate()
Implement in subclasses to validate the content of the text component. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final javax.swing.border.Border ERROR_BORDER
private static final java.awt.Color ERROR_BACKGROUND
private javax.swing.text.JTextComponent tc
private java.lang.Boolean valid
private java.lang.String msg
Constructor Detail |
---|
public AbstractTextComponentValidator(javax.swing.text.JTextComponent tc) throws java.lang.IllegalArgumentException
tc
.
tc
- the text component. Must not be null.
java.lang.IllegalArgumentException
- thrown if tc is nullpublic AbstractTextComponentValidator(javax.swing.text.JTextComponent tc, boolean addActionListener) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public AbstractTextComponentValidator(javax.swing.text.JTextComponent tc, boolean addFocusListener, boolean addDocumentListener, boolean addActionListener) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
Method Detail |
---|
protected void feedbackInvalid(java.lang.String msg)
protected void feedbackDisabled()
protected void feedbackValid(java.lang.String msg)
public javax.swing.text.JTextComponent getComponent()
public abstract void validate()
public abstract boolean isValid()
public void focusGained(java.awt.event.FocusEvent arg0)
focusGained
in interface java.awt.event.FocusListener
public void focusLost(java.awt.event.FocusEvent arg0)
focusLost
in interface java.awt.event.FocusListener
public void actionPerformed(java.awt.event.ActionEvent arg0)
actionPerformed
in interface java.awt.event.ActionListener
public void changedUpdate(javax.swing.event.DocumentEvent arg0)
changedUpdate
in interface javax.swing.event.DocumentListener
public void insertUpdate(javax.swing.event.DocumentEvent arg0)
insertUpdate
in interface javax.swing.event.DocumentListener
public void removeUpdate(javax.swing.event.DocumentEvent arg0)
removeUpdate
in interface javax.swing.event.DocumentListener
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |