|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object swingwtx.custom.validation.ValidationGroup
This isn't a real Swing class at all! This is a useful class that someone suggested we include from C# WinForms! After all, if we're going to make a new GUI API that matches Swing there's nothing wrong with including new bits and pieces if they're useful :) Besides, I hear the JGoodies people are charging for an implementation of this - only took me a couple of hours to implement! This class allows you to monitor validation errors. Each of the validatable components supports a new event listener called "ValidateListener", passing in a ValidateEvent - your code should decide whether the component is ok and set true or false with a message. The same component can be a member of different validation groups, as each validation group allows one stock icon. I had a long think about this and decided the best way to deal with this was to make some new versions of the regular components you might want to validate. They are all prefixed with the word "Validatable" - eg: ValidatableJTextField, ValidatableJTextArea.
Field Summary | |
protected java.util.Vector |
components
|
protected java.lang.String |
errorMessage
Last seen error message from a component |
protected ImageIcon |
pImage
|
Constructor Summary | |
ValidationGroup()
Creates an error provider with the default error icon |
|
ValidationGroup(ImageIcon image)
|
Method Summary | |
void |
add(ValidatableComponent c)
|
boolean |
checkValidation()
Calls the validation routines for each component this ValidationGroup is managing |
void |
clearErrors()
Clears all error messages and icons from all components this ValidationGroup is managing. |
java.lang.String |
getErrorMessage()
|
ImageIcon |
getIcon()
|
void |
remove(ValidatableComponent c)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ImageIcon pImage
protected java.util.Vector components
protected java.lang.String errorMessage
Constructor Detail |
public ValidationGroup()
public ValidationGroup(ImageIcon image)
Method Detail |
public void add(ValidatableComponent c)
public void remove(ValidatableComponent c)
public ImageIcon getIcon()
public java.lang.String getErrorMessage()
public boolean checkValidation()
public void clearErrors()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |