Class ValidatedWorkerComboBox<T>

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.jidesoft.swing.DefaultOverlayable
com.inductiveautomation.ignition.designer.gui.opencreate.form.ValidatedWorkerComboBox<T>
Type Parameters:
T - The type of objects that will be returned by the doInBackground() method to populate a DefaultComboBoxModel for the backing JComboBox
All Implemented Interfaces:
ValidatedField, com.jidesoft.swing.Overlayable, ComponentListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, SwingConstants

public abstract class ValidatedWorkerComboBox<T> extends com.jidesoft.swing.DefaultOverlayable implements ValidatedField
An abstract class that extends ValidatedComboBox with an abstract doInBackground() method to return a List of the supplied type T.
See Also:
  • Field Details

    • selectedValue

      protected T selectedValue
  • Constructor Details

    • ValidatedWorkerComboBox

      public ValidatedWorkerComboBox(T selectedValue, String errorBundleGroup, String workerBundleKey, boolean blockingError, ValidatedWorkerComboBox.AttentionLevel attentionLevel, boolean showErrorMessage)
      An abstract class that extends ValidatedComboBox with an abstract doInBackground() method to return a List of the supplied type T. that will be used in the DefaultComboBoxModel backing the internal ComboBox.
      Parameters:
      selectedValue - The currently selected value or previously selected value.
      errorBundleGroup - The bundle key for this component see validate(Object)
      workerBundleKey - The bundle key used by the worker in the event that there is an error
      blockingError - Whether this component should enter an error state or an invalid one when the combobox model fails to have the selected value.
      attentionLevel - What attention level the overlay icon should be in the ValidatedComboBox
      showErrorMessage - Whether to show error message when the combobox model fails to have the selected value.
    • ValidatedWorkerComboBox

      public ValidatedWorkerComboBox(T selectedValue, String errorBundleGroup, String workerBundleKey, boolean blockingError, ValidatedWorkerComboBox.AttentionLevel attentionLevel)
      An abstract class that extends ValidatedComboBox with an abstract doInBackground() method to return a List of the supplied type T. that will be used in the DefaultComboBoxModel backing the internal ComboBox.
      Parameters:
      selectedValue - The currently selected value or previously selected value.
      errorBundleGroup - The bundle key for this component see validate(Object)
      workerBundleKey - The bundle key used by the worker in the event that there is an error
      blockingError - Whether this component should enter an error state or an invalid one when the combobox model fails to have the selected value.
      attentionLevel - What attention level the overlay icon should be in the ValidatedComboBox
  • Method Details

    • isDataValid

      public boolean isDataValid()
    • doInBackground

      protected abstract List<T> doInBackground() throws Exception
      Should execute whatever command is required to return the List that will back this combobox.
      Throws:
      Exception
    • evaluateItem

      protected void evaluateItem(T item)
    • validate

      protected String validate(T selectedItem)
    • getInnerComboBox

      public JComboBox<T> getInnerComboBox()
    • getCurrentValue

      @Nullable public T getCurrentValue()
      Get the selected value of the underlying combobox
    • setEnabled

      public void setEnabled(boolean enabled)
      Overrides:
      setEnabled in class JComponent
    • blockingError

      public boolean blockingError()
      Description copied from interface: ValidatedField
      Whether or not this field is one that should block form submission.
      Specified by:
      blockingError in interface ValidatedField
    • addValidationStateListener

      public void addValidationStateListener(ValidationStateListener validationStateListener)
      Description copied from interface: ValidatedField
      Adds a ValidationStateListener which is notified upon the changed validity state of the component.
      Specified by:
      addValidationStateListener in interface ValidatedField
    • removeValidationStateListener

      public void removeValidationStateListener(ValidationStateListener validationStateListener)
      Description copied from interface: ValidatedField
      Specified by:
      removeValidationStateListener in interface ValidatedField
    • done

      protected void done(List<T> values)
      Receives the values from the ValidatedWorkerComboBox<T>.com.inductiveautomation.ignition.designer.gui.opencreate.form.ValidatedWorkerComboBox.ListReturningSwingWorker and applies them to the combobox via a DefaultComboBoxModel, sets the selected item in the combobox, and calls doFinally(List) with the values for any remaining work that is required.
    • reset

      public void reset()