Class ValidationPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, ValidationGroupProvider

public final class ValidationPanel extends JPanel implements ValidationGroupProvider
A simple panel which can display a problem, fire changes when the problem changes. To use, create your own panel and call setInnerComponent() with it. Call getValidationGroup() to add other components to the validation group.
Author:
Tim Boudreau
See Also:
  • Field Details

  • Constructor Details

    • ValidationPanel

      public ValidationPanel(SwingValidationGroup group)
    • ValidationPanel

      public ValidationPanel()
  • Method Details

    • setDelegateValidationUI

      public void setDelegateValidationUI(ValidationUI ui)
    • removeDelegateValidationUI

      public void removeDelegateValidationUI(ValidationUI ui)
    • showOkCancelDialog

      public boolean showOkCancelDialog(String title)
    • getValidationGroup

      public final ValidationGroup getValidationGroup()
      Get this panel's built-in validation group, which drives its display of error messages. Add an inner panel by calling setInnerComponent(), then add your components to that, and add them to the validation group using whatever validators you want
      Specified by:
      getValidationGroup in interface ValidationGroupProvider
      Returns:
      The validation group
    • setLayout

      public final void setLayout(LayoutManager mgr)
      Overridden to disallow setting the layout manager. Use setInnerComponent().
      Overrides:
      setLayout in class Container
      Parameters:
      mgr -
    • setInnerComponent

      public final void setInnerComponent(Component c)
      Set the inner component which will be displayed above the problem label
      Parameters:
      c - The component
    • addImpl

      protected void addImpl(Component comp, Object constraints, int index)
      Overrides:
      addImpl in class Container
    • getProblem

      public final Problem getProblem()
      Get the last reported problem
      Returns:
      the problem, or null if there is none
    • isFatalProblem

      public final boolean isFatalProblem()
      Determine if there currently is a fatal problem
      Returns:
      true if there is a problem
    • addChangeListener

      public final void addChangeListener(ChangeListener cl)
      Add a change listener which will be notified when the problem returned by getProblem changes
      Parameters:
      cl - a change listener
    • removeChangeListener

      public final void removeChangeListener(ChangeListener cl)
      Add a change listener which will be notified when the problem returned by getProblem changes
      Parameters:
      cl - a change listener