public class SwingValidatorUtil
extends org.nuiton.validator.bean.BeanValidatorUtil
| Modifier and Type | Class and Description |
|---|---|
static class |
SwingValidatorUtil.DefaultSwingValidatorCreator
Default bean validator creator to use in the
BeanValidatorFactory. |
| Modifier and Type | Field and Description |
|---|---|
protected static EnumMap<org.nuiton.validator.NuitonValidatorScope,Color> |
colors |
protected static EnumMap<org.nuiton.validator.NuitonValidatorScope,ImageIcon> |
icons |
| Modifier | Constructor and Description |
|---|---|
protected |
SwingValidatorUtil() |
| Modifier and Type | Method and Description |
|---|---|
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 <O> SwingValidator<O> |
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.
|
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 seekpublic 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 listSwingValidatorMessageListMouseListenerpublic static SwingValidatorMessageTableMouseListener registerErrorTableMouseListener(JTable table)
table - the validator table uiSwingValidatorMessageTableMouseListenerpublic static SwingValidatorMessageListMouseListener getErrorListMouseListener(JList list)
list - the validator list uinull if not
foundSwingValidatorMessageListMouseListenerpublic static SwingValidatorMessageTableMouseListener getErrorTableMouseListener(JTable table)
table - the validator table uinull 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 changedpublic 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 excludepublic 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)
Copyright © 2008-2012 CodeLutin. All Rights Reserved.