org.netbeans.validation.api.ui
Class ComponentDecorator

java.lang.Object
  extended by org.netbeans.validation.api.ui.ComponentDecorator

public class ComponentDecorator
extends java.lang.Object

Class which can decorate a component when it has errors. Decoration is done through providing a border that can be applied to a component.

Author:
Tim Boudreau

Constructor Summary
ComponentDecorator()
           
 
Method Summary
 javax.swing.border.Border createProblemBorder(java.awt.Component c, javax.swing.border.Border originalBorder, Severity severity)
          Create a border to apply to the component which shows an error.
static ComponentDecorator noOpComponentDecorator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentDecorator

public ComponentDecorator()
Method Detail

createProblemBorder

public javax.swing.border.Border createProblemBorder(java.awt.Component c,
                                                     javax.swing.border.Border originalBorder,
                                                     Severity severity)
Create a border to apply to the component which shows an error. A useful way to create custom borders is to wrap the original border and paint it, then paint over it. If the insets of the border returned by this method are different than the insets of the original border, then the UI layout will "jump".

Severity.color() and Severity.image() are handy here.

Parameters:
c - The component
originalBorder - The original border of the component
severity - The severity of the problem
Returns:
A border. May not be null. To have no effect, simply return the original border.

noOpComponentDecorator

public static final ComponentDecorator noOpComponentDecorator()