Class SwingValidatorUtil
- java.lang.Object
-
- org.nuiton.validator.bean.simple.SimpleBeanValidators
-
- org.nuiton.jaxx.validator.swing.SwingValidatorUtil
-
public class SwingValidatorUtil extends org.nuiton.validator.bean.simple.SimpleBeanValidatorsThe helper class for swing validation module.- Author:
- Tony Chemit - dev@tchemit.fr
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSwingValidatorUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <O> voidaddHightLighterOnEditor(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 ColorgetColor(org.nuiton.validator.NuitonValidatorScope scope)static EnumMap<org.nuiton.validator.NuitonValidatorScope,Color>getColors()static ImageIcongetErrorIcon()static SwingValidatorMessageListMouseListenergetErrorListMouseListener(JList<?> list)static SwingValidatorMessageTableMouseListenergetErrorTableMouseListener(JTable table)static ImageIcongetFatalIcon()static StringgetFieldName(SwingListValidatorMessage model, String value)static StringgetFieldName(SwingValidatorMessage model, String value)static ImageIcongetIcon(org.nuiton.validator.NuitonValidatorScope scope)static EnumMap<org.nuiton.validator.NuitonValidatorScope,ImageIcon>getIcons()static ImageIcongetInfoIcon()static SwingValidatorMessageTableMouseListenergetListErrorTableMouseListener(JTable table)static StringgetMessage(SwingListValidatorMessage model)static StringgetMessage(SwingValidatorMessage model)static StringgetMessage(org.nuiton.validator.bean.simple.SimpleBeanValidatorMessage<?> model)static ImageIcongetWarningIcon()static voidinstallTabUI(JAXXValidator ui, TabInfoWithValidator tab)Deprecated.static voidinstallUI(JTable errorTable, SimpleBeanValidatorMessageTableRenderer render)Prepare the ui where to display the validators messages.static voidinstallUI(JTable errorTable, SwingListValidatorMessageTableRenderer render)Prepare the ui where to display the validators messages.static voidinstallUI(JTable errorTable, SwingValidatorMessageTableRenderer render)Prepare the ui where to display the validators messages.static voidinstallUI(JAXXValidator ui)Deprecated.static voidlistenValidatorContextNameAndRefreshFields(SwingValidator<?> validator, JAXXValidator ui)Deprecated.static <O> SwingValidator<O>newValidator(Class<O> type, String context)static SwingValidatorMessageListMouseListenerregisterErrorListMouseListener(JList<?> list)Register for a given validator list ui a validator mouse listener.static SwingValidatorMessageTableMouseListenerregisterErrorTableMouseListener(JTable table)Register for a given validator table ui a validator mouse listenerstatic <O> voidregisterListValidator(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 voidsetValidatorBean(JAXXObject ui, Object bean, String... excludeIds)Deprecated.static voidsetValidatorChanged(JAXXObject ui, boolean newValue, String... excludeIds)Deprecated.static voiduninstallTabUI(JAXXValidator ui, Collection<TabInfoWithValidator> tabEditors, SwingValidatorMessageTableModel errorTableModel)Deprecated.
-
-
-
Method Detail
-
getColor
public static Color getColor(org.nuiton.validator.NuitonValidatorScope scope)
-
getIcon
public static ImageIcon getIcon(org.nuiton.validator.NuitonValidatorScope scope)
-
getFatalIcon
public static ImageIcon getFatalIcon()
-
getErrorIcon
public static ImageIcon getErrorIcon()
-
getWarningIcon
public static ImageIcon getWarningIcon()
-
getInfoIcon
public static ImageIcon getInfoIcon()
-
newValidator
public static <O> SwingValidator<O> newValidator(Class<O> type, String context)
-
installUI
@Deprecated public static void installUI(JAXXValidator ui)
Deprecated.To install all the stuff for validation on aJAXXValidatorui.This method is called after validators has been detected in the ui (via the method
JAXXValidator.registerValidatorFields()).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 invoked by a generated jaxx-validator file at the end of the
$completeSetupmethod.- Parameters:
ui- the validator ui to init.
-
installUI
public static void installUI(JTable errorTable, SwingValidatorMessageTableRenderer render)
Prepare the ui where to display the validators messages.- Parameters:
errorTable- the table where to display validators messagesrender- renderer to use
-
installUI
public static void installUI(JTable errorTable, SimpleBeanValidatorMessageTableRenderer render)
Prepare the ui where to display the validators messages.- Parameters:
errorTable- the table where to display simpleBean validators messagesrender- renderer to use- Since:
- 2.6.23
-
installUI
public static void installUI(JTable errorTable, SwingListValidatorMessageTableRenderer render)
Prepare the ui where to display the validators messages.- Parameters:
errorTable- the table where to display validators messagesrender- renderer to use- Since:
- 2.5.3
-
installTabUI
@Deprecated public static void installTabUI(JAXXValidator ui, TabInfoWithValidator tab)
Deprecated.
-
uninstallTabUI
@Deprecated public static void uninstallTabUI(JAXXValidator ui, Collection<TabInfoWithValidator> tabEditors, SwingValidatorMessageTableModel errorTableModel)
Deprecated.
-
registerListValidator
public 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.- Parameters:
validator- validator to useerrorTableModel- error table modeldataTable- data tableerrorTable- the table where to display validators messagesdataLocator- data locator- Since:
- 2.5.3
-
addHightLighterOnEditor
public 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.- Type Parameters:
O- type of bean to validate- Parameters:
validator- the validator where to find bean stateseditor- the editor of beansdataLocator- the data locatorscopes- scopes to hightlight- Since:
- 2.5.3
-
registerErrorListMouseListener
public static SwingValidatorMessageListMouseListener registerErrorListMouseListener(JList<?> list)
Register for a given validator list ui a validator mouse listener.Note: there is only one listener registered for a given list model, so invoking this method twice or more will have no effect.
- Parameters:
list- the validation ui list- Returns:
- the listener instantiate or found
- See Also:
SwingValidatorMessageListMouseListener
-
registerErrorTableMouseListener
public static SwingValidatorMessageTableMouseListener registerErrorTableMouseListener(JTable table)
Register for a given validator table ui a validator mouse listenerNote: there is only one listener registered for a given table model, so invoking this method twice or more will have no effect.
- Parameters:
table- the validator table ui- Returns:
- the listener instantiate or found
- See Also:
SwingValidatorMessageTableMouseListener
-
getErrorListMouseListener
public static SwingValidatorMessageListMouseListener getErrorListMouseListener(JList<?> list)
- Parameters:
list- the validator list ui- Returns:
- the validator list mouse listener, or
nullif not found - See Also:
SwingValidatorMessageListMouseListener
-
getErrorTableMouseListener
public static SwingValidatorMessageTableMouseListener getErrorTableMouseListener(JTable table)
- Parameters:
table- the validator table ui- Returns:
- the validator table mouse listener, or
nullif not found - See Also:
SwingValidatorMessageTableMouseListener
-
getListErrorTableMouseListener
public static SwingValidatorMessageTableMouseListener getListErrorTableMouseListener(JTable table)
- Parameters:
table- the validator table ui- Returns:
- the validator table mouse listener, or
nullif not found - See Also:
SwingValidatorMessageTableMouseListener
-
getMessage
public static String getMessage(SwingValidatorMessage model)
-
getMessage
public static String getMessage(org.nuiton.validator.bean.simple.SimpleBeanValidatorMessage<?> model)
-
getMessage
public static String getMessage(SwingListValidatorMessage model)
-
getFieldName
public static String getFieldName(SwingValidatorMessage model, String value)
-
getFieldName
public static String getFieldName(SwingListValidatorMessage model, String value)
-
listenValidatorContextNameAndRefreshFields
@Deprecated public static void listenValidatorContextNameAndRefreshFields(SwingValidator<?> validator, JAXXValidator ui)
Deprecated.Method to listen the modification of the context name and at each time reload fields of the ui.- Parameters:
validator- validator to listenui- ui to refresh when context name has changed- Since:
- 2.2.1
-
setValidatorBean
@Deprecated public static void setValidatorBean(JAXXObject ui, Object bean, String... excludeIds)
Deprecated.method to attach a bean to all validators of an JAXXObject.It is possible to exclude some validator to be treated.
- Parameters:
ui- the ui containing the validators to treatbean- the bean to attach in validators (can be null)excludeIds- the list of validator id to exclude
-
setValidatorChanged
@Deprecated public static void setValidatorChanged(JAXXObject ui, boolean newValue, String... excludeIds)
Deprecated.method to set the changed property to all validators of an JAXXObject.It is possible to exclude some validator to be treated.
- Parameters:
ui- the ui containing the validators to treatnewValue- the new value to set in changed validator propertyexcludeIds- the list of validator id to exclude
-
-