| java.lang.Object com.jgoodies.validation.view.ValidationComponentUtils
Inner Class :public static interface Visitor | |
Method Summary | |
public static ValidationResult | getAssociatedResult(JComponent comp, Map<Object, ValidationResult> keyMap) Returns the ValidationResult associated with the given component
using the specified validation result key map,
or null if the component has no message key set,
or ValidationResult.EMPTY if the key map contains
no result for the component. | public static Color | getErrorBackground() Returns the error background color used to mark components
that have an associated validation error. | public static Object | getInputHint(JComponent comp) Returns the component's input hint that is stored in a client property.
Useful to indicate the format of valid data to the user.
The input hint object can be a plain String or a
compound object, for example that is able to localize the input hint
for the active
java.util.Locale .
To make use of this information an editor should register a
listener with the focus management. | public static Color | getMandatoryBackground() Returns a default background color that can be used as the component
background for components with mandatory content. | public static Border | getMandatoryBorder() Lazily creates and returns a
Border instance that is used
to indicate that a component's content is mandatory. | public static Color | getMandatoryForeground() Returns a default foreground color that can be used as the component
foreground for components with mandatory content. | public static Object[] | getMessageKeys(JComponent comp) Returns the message key that has been set to associate the given
component with a set of ValidationMessages. | public static Severity | getSeverity(JComponent comp) Returns the component's
Severity if it has been set before. | public static Color | getWarningBackground() Returns the warning background color used to mark components
that have an associated validation warning. | public static boolean | hasError(JComponent comp, ValidationResult result) Checks and answers if the specified component is associated with an
error message in the given validation result. | public static boolean | hasWarning(JComponent comp, ValidationResult result) Checks and answers if the specified component is associated with a
warning message in the given validation result. | public static boolean | isMandatory(JComponent comp) Returns if the component has been marked as mandatory. | public static boolean | isMandatoryAndBlank(JComponent comp) Returns if the component is a
JTextComponent with blank content
and has been marked as mandatory. | public static void | setErrorBackground(JTextComponent comp) Sets the text component's background to a color that shall indicate
that the component's content has is invalid with error severity.
Note: The component background colors are
managed by the look&feel implementation. | public static void | setInputHint(JComponent comp, Object hint) Sets the input hint for the given component. | public static void | setMandatory(JComponent comp, boolean mandatory) Marks the given component as mandatory or optional. | public static void | setMandatoryBackground(JTextComponent comp) Sets the text component's background to a color that shall indicate
that the component's content is mandatory.
Note: The component background colors are
managed by the look&feel implementation. | public static void | setMandatoryBorder(JTextComponent comp) Sets the text component's border to use a new border that shall indicate
that the component's content is mandatory.
Note: The component foreground and border colors are
managed by the look&feel implementation. | public static void | setMessageKey(JComponent comp, Object messageKey) Associates the given component with the specified message key.
That in turn will associate the component with all ValidationMessages
that share this key. | public static void | setMessageKeys(JComponent comp, Object[] messageKeys) Associates the given component with the specified message keys.
That in turn will associate the component with all ValidationMessages
that share these keys. | public static void | setSeverity(JComponent comp, Severity severity) Marks the given component with the specified severity. | public static void | setWarningBackground(JTextComponent comp) Sets the text component's background to a color that shall indicate
that the component's content is invalid with warning severity.
Note: The component background colors are
managed by the look&feel implementation. | public static void | updateComponentTreeMandatoryAndBlankBackground(Container container) Traverses a component tree and sets mandatory backgrounds
to text components that have blank content and have been marked
as mandatory with
ValidationComponentUtils.setMandatory(JComponent,boolean) before. | public static void | updateComponentTreeMandatoryBackground(Container container) Traverses a component tree and sets mandatory backgrounds
to text components that have been marked as mandatory
with
ValidationComponentUtils.setMandatory(JComponent,boolean) before. | public static void | updateComponentTreeMandatoryBorder(Container container) Traverses a component tree and sets mandatory borders
to text components that have been marked as mandatory
with
ValidationComponentUtils.setMandatory(JComponent,boolean) before. | public static void | updateComponentTreeSeverity(Container container, ValidationResult result) Traverses a component tree and sets the severity for all text components.
The iteration starts at the given container. | public static void | updateComponentTreeSeverityBackground(Container container, ValidationResult result) Traverses a component tree and sets the text component backgrounds
according to the severity of an associated validation result - if any. | public static void | visitComponentTree(Container container, Map<Object, ValidationResult> keyMap, Visitor visitor) Traverses the component tree starting at the given container and invokes
the given visitor's #visit method on each instance of
JTextComponent . |
getAssociatedResult | public static ValidationResult getAssociatedResult(JComponent comp, Map<Object, ValidationResult> keyMap)(Code) | | Returns the ValidationResult associated with the given component
using the specified validation result key map,
or null if the component has no message key set,
or ValidationResult.EMPTY if the key map contains
no result for the component.
Parameters: comp - the component may be marked with a validation message keys Parameters: keyMap - maps validation message keys to ValidationResults the ValidationResult associated with the given componentas provided by the specified validation key mapor null if the component has no message key set,or ValidationResult.EMPTY if no result is associatedwith the component since: 1.4 |
getInputHint | public static Object getInputHint(JComponent comp)(Code) | | Returns the component's input hint that is stored in a client property.
Useful to indicate the format of valid data to the user.
The input hint object can be a plain String or a
compound object, for example that is able to localize the input hint
for the active
java.util.Locale .
To make use of this information an editor should register a
listener with the focus management. Whenever the focused component
changes, the mechanism can request the input hint for the focus owner
using this service and can display the result hint in the user interface.
Parameters: comp - the component to be requested the component's input hint See Also: ValidationComponentUtils.setInputHint(JComponent,Object) |
getMandatoryBackground | public static Color getMandatoryBackground()(Code) | | Returns a default background color that can be used as the component
background for components with mandatory content. Typically this
color will be used with instances of
JTextComponent .
Note: The component background colors are managed
by the look&feel implementation. Many l&fs will honor a
custom background color. However, some l&fs may ignore custom
background colors. It is recommended to check the
appearance in all l&fs available in an application.
a background color useful for components with mandatory content See Also: ValidationComponentUtils.getMandatoryForeground() |
getMandatoryBorder | public static Border getMandatoryBorder()(Code) | | Lazily creates and returns a
Border instance that is used
to indicate that a component's content is mandatory.
a Border that is used to indicate thata component's content is mandatory |
getMandatoryForeground | public static Color getMandatoryForeground()(Code) | | Returns a default foreground color that can be used as the component
foreground for components with mandatory content. Typically this
color will be used with instances of
JTextComponent .
Note: The component foreground and border colors are
managed by the look&feel implementation. Many l&fs will honor a
custom foreground color and custom border configuration. However, some
l&fs may ignore these custom settings. It is recommended to check
the appearance in all l&fs available in an application.
a foreground color useful for components with mandatory content See Also: ValidationComponentUtils.getMandatoryBackground() See Also: ValidationComponentUtils.getMandatoryBorder() |
setErrorBackground | public static void setErrorBackground(JTextComponent comp)(Code) | | Sets the text component's background to a color that shall indicate
that the component's content has is invalid with error severity.
Note: The component background colors are
managed by the look&feel implementation. Many l&fs will honor a
custom foreground color and custom border configuration. However, some
l&fs may ignore these custom settings. It is recommended to check
the appearance in all l&fs available in an application.
Parameters: comp - the text component that shall get a new background See Also: ValidationComponentUtils.setMandatoryBackground(JTextComponent) See Also: ValidationComponentUtils.setWarningBackground(JTextComponent) |
setInputHint | public static void setInputHint(JComponent comp, Object hint)(Code) | | Sets the input hint for the given component. This hint can be later
retrieved to indicate to the user the format of valid data for the
focused component.
Parameters: comp - the component to set a hint for Parameters: hint - the input hint to be associated with the component See Also: ValidationComponentUtils.getInputHint(JComponent) |
setMandatoryBorder | public static void setMandatoryBorder(JTextComponent comp)(Code) | | Sets the text component's border to use a new border that shall indicate
that the component's content is mandatory.
Note: The component foreground and border colors are
managed by the look&feel implementation. Many l&fs will honor a
custom foreground color and custom border configuration. However, some
l&fs may ignore these custom settings. It is recommended to check
the appearance in all l&fs available in an application.
Parameters: comp - the component that gets a new border See Also: ValidationComponentUtils.setMandatoryBackground(JTextComponent) See Also: ValidationComponentUtils.getMandatoryBorder() |
setWarningBackground | public static void setWarningBackground(JTextComponent comp)(Code) | | Sets the text component's background to a color that shall indicate
that the component's content is invalid with warning severity.
Note: The component background colors are
managed by the look&feel implementation. Many l&fs will honor a
custom foreground color and custom border configuration. However, some
l&fs may ignore these custom settings. It is recommended to check
the appearance in all l&fs available in an application.
Parameters: comp - the text component that shall get a new background See Also: ValidationComponentUtils.setMandatoryBackground(JTextComponent) See Also: ValidationComponentUtils.setErrorBackground(JTextComponent) |
visitComponentTree | public static void visitComponentTree(Container container, Map<Object, ValidationResult> keyMap, Visitor visitor)(Code) | | Traverses the component tree starting at the given container and invokes
the given visitor's #visit method on each instance of
JTextComponent . Useful to perform custom component tree updates
that are not already provided by the #updateComponentTreeXXX
methods.
The arguments passed to the #visit method are the visited component and
its associated validation subresult. This subresult is requested from
the specified keyMap using the component's message key.
Before you use this method, associate text component with validation
messages using
ValidationComponentUtils.setMessageKey(JComponent,Object) .
Parameters: container - the component tree root Parameters: keyMap - maps messages keys to associated validation results Parameters: visitor - the visitor that is applied to all text components See Also: ValidationComponentUtils.setMessageKey(JComponent,Object) See Also: Visitor |
|
|