jaxx.runtime.validator.swing
Class SwingValidatorUtil

java.lang.Object
  extended by org.nuiton.validator.bean.BeanValidatorUtil
      extended by jaxx.runtime.validator.swing.SwingValidatorUtil

public class SwingValidatorUtil
extends org.nuiton.validator.bean.BeanValidatorUtil

The helper class for swing validation module.

Author:
tchemit

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 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 List<String> initUI(JAXXValidator ui)
           
static void installFields(JAXXValidator ui)
           
static void installUI(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.
 
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

icons

protected static EnumMap<org.nuiton.validator.NuitonValidatorScope,ImageIcon> icons

colors

protected static EnumMap<org.nuiton.validator.NuitonValidatorScope,Color> colors
Constructor Detail

SwingValidatorUtil

protected SwingValidatorUtil()
Method Detail

getIcons

public static EnumMap<org.nuiton.validator.NuitonValidatorScope,ImageIcon> getIcons()

getColors

public static EnumMap<org.nuiton.validator.NuitonValidatorScope,Color> getColors()

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)

initUI

public static List<String> initUI(JAXXValidator ui)

installFields

public static void installFields(JAXXValidator ui)

installUI

public static void installUI(JAXXValidator ui)

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 messages
render - renderer to use

registerErrorListMouseListener

public static SwingValidatorMessageListMouseListener registerErrorListMouseListener(JList list)
Register for a given validator list ui a validator mouse listener.

Note: there is only one listener registred for a given list model, so invoking this method tiwce or more will have no effect.

Parameters:
list - the validation ui list
Returns:
the listener instanciate or found
See Also:
SwingValidatorMessageListMouseListener

registerErrorTableMouseListener

public 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.

Parameters:
table - the validator table ui
Returns:
the listener instanciate 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 null if 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 null if not found
See Also:
SwingValidatorMessageTableMouseListener

getMessage

public static String getMessage(SwingValidatorMessage model)

getFieldName

public static String getFieldName(SwingValidatorMessage model,
                                  String value)

listenValidatorContextNameAndRefreshFields

public 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.

Parameters:
validator - validator to listen
ui - ui to refresh when context name has changed
Since:
2.2.1

setValidatorBean

public static void setValidatorBean(JAXXObject ui,
                                    Object bean,
                                    String... excludeIds)
Convinient 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 validatros to treate
bean - the bean to attach in validators (can be null)
excludeIds - the list of validator id to exclude

setValidatorChanged

public static void setValidatorChanged(JAXXObject ui,
                                       boolean newValue,
                                       String... excludeIds)
Convinient 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 validatros to treate
newValue - the new value to set in changed validator property
excludeIds - the list of validator id to exclude

getValidatorEditors

protected static Map<JComponent,ValidatorField> getValidatorEditors(JAXXValidator ui)


Copyright © 2008-2011 CodeLutin. All Rights Reserved.