public class SwingValidatorUtil
extends org.nuiton.validator.bean.simple.SimpleBeanValidators
| 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 <O> void |
addHightLighterOnEditor(org.nuiton.validator.bean.list.BeanListValidator<O> validator,
org.jdesktop.swingx.JXTable editor,
SwingListValidatorDataLocator<O> dataLocator,
org.nuiton.validator.NuitonValidatorScope... scopes)
Add hightlighters on the editor of beans.
|
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(SwingListValidatorMessage model,
String value) |
static String |
getFieldName(SwingValidatorMessage model,
String value) |
static String |
getFieldName(UnifiedValidatorMessage model,
String value) |
static String |
getFieldName(UnifiedValidatorMessage model,
String value,
String valueFallBack) |
static ImageIcon |
getIcon(org.nuiton.validator.NuitonValidatorScope scope) |
static EnumMap<org.nuiton.validator.NuitonValidatorScope,ImageIcon> |
getIcons() |
static ImageIcon |
getInfoIcon() |
static SwingValidatorMessageTableMouseListener |
getListErrorTableMouseListener(JTable table) |
static String |
getMessage(org.nuiton.validator.bean.simple.SimpleBeanValidatorMessage model) |
static String |
getMessage(SwingListValidatorMessage model) |
static String |
getMessage(SwingValidatorMessage model) |
static String |
getMessage(UnifiedValidatorMessage model) |
protected static com.google.common.collect.Multimap<JComponent,ValidatorField> |
getValidatorEditors(JAXXValidator ui) |
static ImageIcon |
getWarningIcon() |
static void |
installTabUI(JAXXValidator ui,
TabInfoWithValidator tab) |
static void |
installUI(JAXXValidator ui)
To install all the stuff for validation on a
JAXXValidator ui. |
static void |
installUI(JTable errorTable,
SimpleBeanValidatorMessageTableRenderer render)
Prepare the ui where to display the validators messages.
|
static void |
installUI(JTable errorTable,
SwingListValidatorMessageTableRenderer render)
Prepare the ui where to display the validators messages.
|
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
|
static <O> void |
registerListValidator(org.nuiton.validator.bean.list.BeanListValidator<O> validator,
SwingListValidatorMessageTableModel errorTableModel,
JTable dataTable,
JTable errorTable,
SwingListValidatorDataLocator<O> dataLocator)
Prepare the ui where to display the validators messages.
|
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.
|
static void |
uninstallTabUI(Collection<TabInfoWithValidator> tabEditors,
SwingValidatorMessageTableModel errorTableModel) |
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 been 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 void installUI(JTable errorTable, SimpleBeanValidatorMessageTableRenderer render)
errorTable - the table where to display simpleBean validators messagesrender - renderer to usepublic static void installUI(JTable errorTable, SwingListValidatorMessageTableRenderer render)
errorTable - the table where to display validators messagesrender - renderer to usepublic static void installTabUI(JAXXValidator ui, TabInfoWithValidator tab)
public static void uninstallTabUI(Collection<TabInfoWithValidator> tabEditors, SwingValidatorMessageTableModel errorTableModel)
public static <O> void registerListValidator(org.nuiton.validator.bean.list.BeanListValidator<O> validator,
SwingListValidatorMessageTableModel errorTableModel,
JTable dataTable,
JTable errorTable,
SwingListValidatorDataLocator<O> dataLocator)
errorTableModel - errorTable - the table where to display validators messagespublic static <O> void addHightLighterOnEditor(org.nuiton.validator.bean.list.BeanListValidator<O> validator,
org.jdesktop.swingx.JXTable editor,
SwingListValidatorDataLocator<O> dataLocator,
org.nuiton.validator.NuitonValidatorScope... scopes)
O - type of bean to validatevalidator - the validator where to find bean stateseditor - the editor of beansdataLocator - the data locatorscopes - scopes to hightlightpublic static SwingValidatorMessageListMouseListener registerErrorListMouseListener(JList list)
Note: there is only one listener registred for a given list model, so invoking this method tiwce or more will have no effect.
list - the validation ui listSwingValidatorMessageListMouseListenerpublic static SwingValidatorMessageTableMouseListener registerErrorTableMouseListener(JTable table)
Note: there is onlt one listener registred for a givne table model, so invokin this method twice or more will have no effect.
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 SwingValidatorMessageTableMouseListener getListErrorTableMouseListener(JTable table)
table - the validator table uinull if not
foundSwingValidatorMessageTableMouseListenerpublic static String getMessage(SwingValidatorMessage model)
public static String getMessage(org.nuiton.validator.bean.simple.SimpleBeanValidatorMessage model)
public static String getMessage(SwingListValidatorMessage model)
public static String getMessage(UnifiedValidatorMessage model)
public static String getFieldName(SwingValidatorMessage model, String value)
public static String getFieldName(SwingListValidatorMessage model, String value)
public static String getFieldName(UnifiedValidatorMessage model, String value)
public static String getFieldName(UnifiedValidatorMessage model, String value, String valueFallBack)
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)
It is possible to exclude some validator to be treated.
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)
It is possible to exclude some validator to be treated.
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 com.google.common.collect.Multimap<JComponent,ValidatorField> getValidatorEditors(JAXXValidator ui)
Copyright © 2008–2018 Ultreia.io. All rights reserved.