Class AbstractParamEditor

java.lang.Object
org.esa.snap.core.param.AbstractParamEditor
All Implemented Interfaces:
ParamEditor, ParamExceptionHandler
Direct Known Subclasses:
AbstractParamXEditor, BooleanEditor, ComboBoxEditor, LabelEditor, ListEditor, RadioButtonEditor, TextFieldEditor

public abstract class AbstractParamEditor extends Object implements ParamEditor, ParamExceptionHandler
The AbstractParamEditor acts as a base class for implementations of ParamEditor interface by providing some default method implementations and several utility methods for common editors.
Version:
$Revision$ $Date$
See Also:
  • Constructor Details

    • AbstractParamEditor

      protected AbstractParamEditor(Parameter parameter, boolean useDefaultVerifier)
      Creates the object with a given parameter.
      Parameters:
      parameter - the Parameter to be edited.
      useDefaultVerifier - true if a default verifier should be used
  • Method Details

    • getParameter

      public Parameter getParameter()
      Gets the parameter to which this editor belongs to.
      Specified by:
      getParameter in interface ParamEditor
    • getLabelComponent

      public JLabel getLabelComponent()
      Gets the label component.
      Specified by:
      getLabelComponent in interface ParamEditor
    • setLabelComponent

      public void setLabelComponent(JLabel labelComponent)
      Sets the label component.
      Specified by:
      setLabelComponent in interface ParamEditor
    • getPhysUnitLabelComponent

      public JLabel getPhysUnitLabelComponent()
      Gets the physical unit label component.
      Specified by:
      getPhysUnitLabelComponent in interface ParamEditor
    • setPhysUnitLabelComponent

      public void setPhysUnitLabelComponent(JLabel labelComponent)
      Sets the physical unit component.
      Specified by:
      setPhysUnitLabelComponent in interface ParamEditor
    • setDefaultLabelComponent

      protected void setDefaultLabelComponent(boolean ensureTrailingColon)
    • setDefaultPhysUnitLabelComponent

      protected void setDefaultPhysUnitLabelComponent(boolean ensureLeadingSpace)
    • isEnabled

      public boolean isEnabled()
      Checks whether or not the editor is enabled,
      Specified by:
      isEnabled in interface ParamEditor
    • setEnabled

      public void setEnabled(boolean enabled)
      Enables/disables this editor.
      Specified by:
      setEnabled in interface ParamEditor
    • initUI

      protected void initUI()
      Initialized the UI of this editor. Called only once within this editor's constructor.

      The default implementation creates a label component for the parameter's "label" and "physicalUnit" properties.

    • updateUI

      public void updateUI()
      Tells the UI to update it's state. The default implementations en-/disables the label components (if any) of this editor.

      Note: If you override this method, you should call this base class version first.

      Specified by:
      updateUI in interface ParamEditor
    • reconfigureUI

      public void reconfigureUI()
      Tells the UI component to reconfigure itself, since the parameter's properties have changed.

      The default implementation simply calls the updateUI method.

      Specified by:
      reconfigureUI in interface ParamEditor
    • handleParamException

      public boolean handleParamException(ParamException e)
      Implements the default behaviour for _parameter errors: A message box is shown for the given message string.
      Specified by:
      handleParamException in interface ParamExceptionHandler
      Parameters:
      e - the exception
      Returns:
      true if the exception was handled successfully, false otherwise
    • getDefaultInputVerifier

      protected InputVerifier getDefaultInputVerifier()
    • getDefaultActionListener

      protected ActionListener getDefaultActionListener()
    • setParameterValue

      protected boolean setParameterValue(JTextComponent textComponent)
    • checkParameterValue

      protected boolean checkParameterValue(JTextComponent textComponent)
      Checks whether or not the given text component provides a valid value for this parameter. This method has no side-effects.
      Parameters:
      textComponent - the text component which provides the parameter value.
      Returns:
      true if so
    • getExceptionHandler

      public ParamExceptionHandler getExceptionHandler()
      Returns an optional error handler for this editor. The default implementation simply returns this instance.
      Specified by:
      getExceptionHandler in interface ParamEditor
    • getComponent

      public JComponent getComponent()
      Specified by:
      getComponent in interface ParamEditor
      Returns:
      the editor component or the editor component wrapped
      See Also:
    • nameLabelComponent

      protected void nameLabelComponent(JComponent component)
    • nameEditorComponent

      protected void nameEditorComponent(JComponent component)
    • nameUnitComponent

      protected void nameUnitComponent(JComponent component)
    • nameComponent

      protected void nameComponent(JComponent component, String suffix)