|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.validator.bean.BeanValidatorUtil
jaxx.runtime.validator.swing.SwingValidatorUtil
public class SwingValidatorUtil
The helper class for swing validation module.
| Nested Class Summary | |
|---|---|
static class |
SwingValidatorUtil.DefaultSwingValidatorCreator
Default bean validator creator to use in the BeanValidatorFactory. |
| Field Summary | |
|---|---|
protected static EnumMap<org.nuiton.validator.NuitonValidatorScope,Color> |
colors
|
protected static EnumMap<org.nuiton.validator.NuitonValidatorScope,ImageIcon> |
icons
|
| Constructor Summary | |
|---|---|
protected |
SwingValidatorUtil()
|
| Method Summary | ||
|---|---|---|
static void |
detectValidatorFields(JAXXValidator ui)
Detects on a JAXXValidator ui all the validator fields it
contains. |
|
static List<String> |
detectValidators(JAXXValidator ui)
Given a JAXXValidator ui, detects on it all the validators it
contains. |
|
static Color |
getColor(org.nuiton.validator.NuitonValidatorScope scope)
|
|
static EnumMap<org.nuiton.validator.NuitonValidatorScope,Color> |
getColors()
|
|
static ImageIcon |
getErrorIcon()
|
|
static SwingValidatorMessageListMouseListener |
getErrorListMouseListener(JList list)
|
|
static SwingValidatorMessageTableMouseListener |
getErrorTableMouseListener(JTable table)
|
|
static ImageIcon |
getFatalIcon()
|
|
static String |
getFieldName(SwingValidatorMessage model,
String value)
|
|
static ImageIcon |
getIcon(org.nuiton.validator.NuitonValidatorScope scope)
|
|
static EnumMap<org.nuiton.validator.NuitonValidatorScope,ImageIcon> |
getIcons()
|
|
static ImageIcon |
getInfoIcon()
|
|
static String |
getMessage(SwingValidatorMessage model)
|
|
protected static Map<JComponent,ValidatorField> |
getValidatorEditors(JAXXValidator ui)
|
|
static ImageIcon |
getWarningIcon()
|
|
static void |
installUI(JAXXValidator ui)
To install all the stuff for validation on a JAXXValidator ui. |
|
static void |
installUI(JTable errorTable,
SwingValidatorMessageTableRenderer render)
Prepare the ui where to display the validators messages. |
|
static void |
listenValidatorContextNameAndRefreshFields(SwingValidator<?> validator,
JAXXValidator ui)
Method to listen the modification of the context name and at each time reload fields of the ui. |
|
static
|
newValidator(Class<O> type,
String context)
|
|
static SwingValidatorMessageListMouseListener |
registerErrorListMouseListener(JList list)
Register for a given validator list ui a validator mouse listener. |
|
static SwingValidatorMessageTableMouseListener |
registerErrorTableMouseListener(JTable table)
Register for a given validator table ui a validator mouse listener Note: there is onlt one listener registred for a givne table model, so invokin this method twice or more will have no effect. |
|
static void |
setValidatorBean(JAXXObject ui,
Object bean,
String... excludeIds)
Convinient method to attach a bean to all validators of an JAXXObject. |
|
static void |
setValidatorChanged(JAXXObject ui,
boolean newValue,
String... excludeIds)
Convinient method to set the changed property to all validators of an JAXXObject. |
|
| Methods inherited from class org.nuiton.validator.bean.BeanValidatorUtil |
|---|
convert, getScopes, getScopesCount |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static EnumMap<org.nuiton.validator.NuitonValidatorScope,ImageIcon> icons
protected static EnumMap<org.nuiton.validator.NuitonValidatorScope,Color> colors
| Constructor Detail |
|---|
protected SwingValidatorUtil()
| Method Detail |
|---|
public static EnumMap<org.nuiton.validator.NuitonValidatorScope,ImageIcon> getIcons()
public static EnumMap<org.nuiton.validator.NuitonValidatorScope,Color> getColors()
public static Color getColor(org.nuiton.validator.NuitonValidatorScope scope)
public static ImageIcon getIcon(org.nuiton.validator.NuitonValidatorScope scope)
public static ImageIcon getFatalIcon()
public static ImageIcon getErrorIcon()
public static ImageIcon getWarningIcon()
public static ImageIcon getInfoIcon()
public static <O> SwingValidator<O> newValidator(Class<O> type,
String context)
public static void installUI(JAXXValidator ui)
JAXXValidator ui.
This method is called after validators has beeen detected in the ui (via
the method detectValidators(JAXXValidator))..
It will first find and register all validator field via the method
JAXXValidator.registerValidatorFields(), then for each
validators it will install ui for it (says connect validator to ui via layers)
and will reload attached bean to make visible bean validation state on ui.
This method is always inovked by a generated jaxx-validator file at the
end of the $completeSetup method.
ui - the validator ui to init.public static List<String> detectValidators(JAXXValidator ui)
JAXXValidator ui, detects on it all the validators it
contains.
A validator is detected from the annotation Validator placed on
his field.
This method is always inovked by a generated jaxx-validator file at the
end of the $completeSetup method.
ui - the ui where to seek for validators.
public static void detectValidatorFields(JAXXValidator ui)
JAXXValidator ui all the validator fields it
contains.
A validator field is detected via the annotation placed on his field or
his getter (in cas of inheritance).
Each field found will be registred to his corresponding validator via
the method SwingValidator.setFieldRepresentation(String, JComponent).
By default, this method is invoked in the generated method
JAXXValidator.registerValidatorFields() by a generated
jaxx-validator file.
ui - the ui to seek
public static void installUI(JTable errorTable,
SwingValidatorMessageTableRenderer render)
errorTable - the table where to display validators messagesrender - renderer to usepublic static SwingValidatorMessageListMouseListener registerErrorListMouseListener(JList list)
list - the validation ui list
SwingValidatorMessageListMouseListenerpublic static SwingValidatorMessageTableMouseListener registerErrorTableMouseListener(JTable table)
table - the validator table ui
SwingValidatorMessageTableMouseListenerpublic static SwingValidatorMessageListMouseListener getErrorListMouseListener(JList list)
list - the validator list ui
null if not
foundSwingValidatorMessageListMouseListenerpublic static SwingValidatorMessageTableMouseListener getErrorTableMouseListener(JTable table)
table - the validator table ui
null if not
foundSwingValidatorMessageTableMouseListenerpublic static String getMessage(SwingValidatorMessage model)
public static String getFieldName(SwingValidatorMessage model,
String value)
public static void listenValidatorContextNameAndRefreshFields(SwingValidator<?> validator,
JAXXValidator ui)
validator - validator to listenui - ui to refresh when context name has changed
public static void setValidatorBean(JAXXObject ui,
Object bean,
String... excludeIds)
ui - the ui containing the validatros to treatebean - the bean to attach in validators (can be null)excludeIds - the list of validator id to exclude
public static void setValidatorChanged(JAXXObject ui,
boolean newValue,
String... excludeIds)
ui - the ui containing the validatros to treatenewValue - the new value to set in changed validator propertyexcludeIds - the list of validator id to excludeprotected static Map<JComponent,ValidatorField> getValidatorEditors(JAXXValidator ui)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||