|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectswingwt.awt.Component
swingwt.awt.Container
swingwtx.swing.JComponent
swingwtx.swing.JPanel
swingwtx.custom.validation.ValidatableComponent
This is the superclass of all components that can be validated through
the ValidationGroup
class. When a component fails validation,
an icon is shown next to the component with a tooltip stating why
the component failed validation.
Nested Class Summary |
Nested classes inherited from class swingwtx.swing.JComponent |
JComponent.InternalFrameSelectionListener |
Field Summary | |
protected JComponent |
comp
The component we are holding |
protected java.lang.String |
errorMessage
|
protected JLabel |
errorOutput
The component that will display the icon/tooltip |
protected boolean |
isValid
whether the component currently matches it's validation rules |
protected ValidationGroup |
validationGroup
The validation group containing this component |
protected java.util.Vector |
validationListeners
Validation listeners |
Fields inherited from class swingwtx.swing.JPanel |
opaque, ppeer |
Fields inherited from class swingwtx.swing.JComponent |
accessibleContext, actionMap, ancestorInputMap, border, clientProperties, descendantHasPeer, focusInputMap, internalFrameAdapter, internalFrameParent, propertyChangeListeners, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, windowInputMap |
Fields inherited from class swingwt.awt.Container |
composite, comps, containerListeners, layout, queuedValidateRequest |
Fields inherited from interface swingwt.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
ValidatableComponent()
|
Method Summary | |
void |
addActionListener(ActionListener l)
Add an ActionListener to this component |
void |
addFocusListener(FocusListener l)
Add a KeyListener to this component |
void |
addKeyListener(KeyListener l)
Add a KeyListener to this component |
void |
addMouseListener(MouseListener l)
Add a MouseListener to this component |
void |
addValidationListener(ValidationListener l)
|
void |
dispose()
Destroys the component |
protected void |
fireValidation(boolean forcePass)
Sends the validation event to the component listeners. |
Color |
getBackground()
Returns the background colour of the component |
JComponent |
getComponent()
|
java.lang.String |
getErrorMessage()
|
Font |
getFont()
Returns the Font used on the component |
Color |
getForeground()
Returns the foreground colour of the component |
java.lang.String |
getToolTipText()
Returns the tooltip text used on the component |
ValidationGroup |
getValidationGroup()
Getter for property validationGroup. |
void |
grabFocus()
Forces keyboard focus to the component |
boolean |
isEnabled()
Returns true if the component is enabled |
boolean |
isValid()
|
boolean |
isVisible()
Returns true if the component is visible |
void |
removeActionListener(ActionListener l)
Remove an ActionListener from the component |
void |
removeFocusListener(FocusListener l)
Remove an KeyListener from the component |
void |
removeKeyListener(KeyListener l)
Remove an KeyListener from the component |
void |
removeMouseListener(MouseListener l)
Remove an MouseListener from the component |
void |
removeValidationListener(ValidationListener l)
|
void |
requestFocus()
Requests the component receives the focus |
void |
setBackground(Color c)
Sets the background colour of the component |
void |
setEnabled(boolean b)
Change the enabled state of the component |
void |
setErrorMessage(java.lang.String s)
|
void |
setFont(Font f)
Sets the font used by the component |
void |
setForeground(Color c)
Sets the foreground colour of the component |
void |
setIsValid(boolean b)
|
void |
setToolTipText(java.lang.String text)
Sets the tooltip text used on the component |
void |
setupComponent()
Should be called by subclasses after component creation |
void |
setValidationGroup(ValidationGroup validationGroup)
Setter for property validationGroup. |
void |
setVisible(boolean b)
Change the visibility of the component |
Methods inherited from class swingwtx.swing.JPanel |
calculatePreferredSize, getHeight, getSize, getWidth, setBorder, setSwingWTParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected JComponent comp
protected JLabel errorOutput
protected ValidationGroup validationGroup
protected boolean isValid
protected java.lang.String errorMessage
protected java.util.Vector validationListeners
Constructor Detail |
public ValidatableComponent()
Method Detail |
public void dispose()
JComponent
dispose
in class JComponent
public JComponent getComponent()
public void addValidationListener(ValidationListener l)
public void removeValidationListener(ValidationListener l)
public void setupComponent()
public void setIsValid(boolean b)
public boolean isValid()
public void setErrorMessage(java.lang.String s)
public java.lang.String getErrorMessage()
protected void fireValidation(boolean forcePass)
forcePass
- If set to true, it is assumed that validation
passes - even if it wouldn't, and the event is not called.
This is used by the clearErrors() call to reset fields.public void setVisible(boolean b)
Component
setVisible
in class Component
public boolean isVisible()
Component
isVisible
in class Component
public void setEnabled(boolean b)
Component
setEnabled
in class Component
public boolean isEnabled()
Component
isEnabled
in class Component
public void requestFocus()
Component
requestFocus
in class Component
public void grabFocus()
Component
grabFocus
in class Component
public Color getBackground()
Component
getBackground
in class Component
public void setBackground(Color c)
Component
setBackground
in class Component
public Color getForeground()
Component
getForeground
in class Component
public void setForeground(Color c)
Component
setForeground
in class Component
public Font getFont()
Component
getFont
in interface MenuContainer
getFont
in class Component
public void setFont(Font f)
Component
setFont
in class Component
public java.lang.String getToolTipText()
Component
getToolTipText
in class Component
public void setToolTipText(java.lang.String text)
Component
setToolTipText
in class Component
public void addActionListener(ActionListener l)
Component
ActionListener
to this component
addActionListener
in class Component
public void removeActionListener(ActionListener l)
Component
ActionListener
from the component
removeActionListener
in class Component
public void addMouseListener(MouseListener l)
Component
MouseListener
to this component
addMouseListener
in class Component
public void removeMouseListener(MouseListener l)
Component
MouseListener
from the component
removeMouseListener
in class Component
public void addKeyListener(KeyListener l)
Component
KeyListener
to this component
addKeyListener
in class Component
public void removeKeyListener(KeyListener l)
Component
KeyListener
from the component
removeKeyListener
in class Component
public void addFocusListener(FocusListener l)
Component
KeyListener
to this component
addFocusListener
in class Component
public void removeFocusListener(FocusListener l)
Component
KeyListener
from the component
removeFocusListener
in class Component
public ValidationGroup getValidationGroup()
public void setValidationGroup(ValidationGroup validationGroup)
validationGroup
- New value of property validationGroup.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |