Class AbstractColumnConstraintEditor<T>

java.lang.Object
docking.widgets.table.constrainteditor.AbstractColumnConstraintEditor<T>
Type Parameters:
T - the column type
All Implemented Interfaces:
ColumnConstraintEditor<T>
Direct Known Subclasses:
BooleanConstraintEditor, DataLoadingConstraintEditor, DateRangeConstraintEditor, DateValueConstraintEditor, DoNothingColumnConstraintEditor, DoubleRangeConstraintEditor, DoubleValueConstraintEditor, EnumConstraintEditor, IntegerConstraintEditor, IntegerRangeConstraintEditor, StringConstraintEditor, UnsignedLongConstraintEditor, UnsignedLongRangeConstraintEditor

public abstract class AbstractColumnConstraintEditor<T> extends Object implements ColumnConstraintEditor<T>
Base class for many constraint editors, providing implementation for much of the interface.
  • Field Details

    • currentConstraint

      protected ColumnConstraint<T> currentConstraint
    • VALID_INPUT_COLOR

      protected static final Color VALID_INPUT_COLOR
      Color indicating a valid value is defined by the editor widget(s)
    • INVALID_INPUT_COLOR

      protected static final Color INVALID_INPUT_COLOR
      Color indicating a invalid value is defined by the editor widget(s)
  • Constructor Details

    • AbstractColumnConstraintEditor

      protected AbstractColumnConstraintEditor(ColumnConstraint<T> constraint)
      Constructor.
      Parameters:
      constraint - the constraint this class is an editor for
  • Method Details

    • getValueFromComponent

      protected abstract ColumnConstraint<T> getValueFromComponent()
      Get the constraints' new value from the editor component. This expects the UI to have been constructed.
      Returns:
      the value
      See Also:
    • buildInlineEditorComponent

      protected abstract Component buildInlineEditorComponent()
      Delegate the construction of the inline editor component.
      Returns:
      the editors inline component
      See Also:
    • updateEditorComponent

      protected abstract void updateEditorComponent()
      Indicates to subclasses that the constraint has changed, and the user interface needs to be updated to reflect the new state.
    • buildDetailEditorComponent

      protected Component buildDetailEditorComponent()
      Delegate the construction of the detail editor component.

      Subclasses should override this method if they choose to provide a detailed constraint editor. This is an optional feature, and this implementation returns null to satisfy the ColumnConstraintEditor contract.

      Returns:
      the editors detail component; null in this implementation
      See Also:
    • getValue

      public final ColumnConstraint<T> getValue()
      Description copied from interface: ColumnConstraintEditor
      Get the current value from the editor, in the form of a constraint.
      Specified by:
      getValue in interface ColumnConstraintEditor<T>
      Returns:
      the editors' current value
    • setValue

      public final void setValue(ColumnConstraint<T> value)
      Description copied from interface: ColumnConstraintEditor
      Set the current value within the editor
      Specified by:
      setValue in interface ColumnConstraintEditor<T>
      Parameters:
      value - the new value to set
    • addChangeListener

      public void addChangeListener(ChangeListener l)
      Description copied from interface: ColumnConstraintEditor
      Register a callback handler for responding to changes made within the editor
      Specified by:
      addChangeListener in interface ColumnConstraintEditor<T>
      Parameters:
      l - listener callback
    • removeChangeListener

      public void removeChangeListener(ChangeListener l)
      Description copied from interface: ColumnConstraintEditor
      Remove a callback handler that was responding changes made within the editor
      Specified by:
      removeChangeListener in interface ColumnConstraintEditor<T>
      Parameters:
      l - listener callback
    • valueChanged

      protected void valueChanged()
      Notification that the editors' value has changed.
    • updateInfoMessage

      protected abstract void updateInfoMessage(boolean isValid)
    • checkEditorValueValidity

      protected abstract boolean checkEditorValueValidity()
      Template method that subclasses must implement. This class will call this method whenever the value changes so that the validity state is updated.

      Only called when the editor component has been constructed and UI elements are defined.

      Returns:
      true if the UI defines a valid value, false otherwise
      See Also:
    • hasValidValue

      public final boolean hasValidValue()
      Description copied from interface: ColumnConstraintEditor
      Determine if the editor contains a valid value; do the UI widgets and state match, is the state sensible for the constraint.
      Specified by:
      hasValidValue in interface ColumnConstraintEditor<T>
      Returns:
      true if the configuration is valid, false otherwise
    • notifyConstraintChanged

      protected void notifyConstraintChanged()
      Notify all monitors that the configuration of the constraint has changed.
    • getInlineComponent

      public final Component getInlineComponent()
      Description copied from interface: ColumnConstraintEditor
      The inline component resides in the configuration interface on the same visual line as the column and constraint selection widgets. It is intended to be a relatively small and simple interface for configuring the constraints' values.
      Specified by:
      getInlineComponent in interface ColumnConstraintEditor<T>
      Returns:
      the inline editor component
    • getDetailComponent

      public final Component getDetailComponent()
      Description copied from interface: ColumnConstraintEditor
      The detail component resides in the configuration interface below the column and constraint selection widgets, and is afforded greater space. It is intended to be a more feature-rich editor that provides greater insight or control of the constraints value definition.
      Specified by:
      getDetailComponent in interface ColumnConstraintEditor<T>
      Returns:
      the detail editor component
    • hasEditorComponents

      protected final boolean hasEditorComponents()
      Determine if the graphical elements of the editor have been constructed.
      Returns:
      true if the inline or detail editors have been built, false otherwise
    • formatStatus

      protected static final String formatStatus(String message, boolean error)
      Uses HTML to format and color a string depending on if it is an error or not.
      Parameters:
      message - the message to format.
      error - true if the message is an error; false otherwise
      Returns:
      an HTML string suitable for a JLabel.