org.esa.beam.framework.param
Class AbstractParamEditor

java.lang.Object
  extended by org.esa.beam.framework.param.AbstractParamEditor
All Implemented Interfaces:
ParamEditor, ParamExceptionHandler
Direct Known Subclasses:
AbstractParamXEditor, BooleanEditor, ComboBoxEditor, DateEditor, 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$
Author:
Norman Fomferra
See Also:
ParamEditor, ParamValidator, ParamExceptionHandler

Constructor Summary
protected AbstractParamEditor(Parameter parameter, boolean useDefaultVerifier)
          Creates the object with a given parameter.
 
Method Summary
protected  boolean checkParameterValue(JTextComponent textComponent)
          Checks whether or not the given text component provides a valid value for this parameter.
 JComponent getComponent()
          Simply returns ParamEditor.getEditorComponent().
protected  ActionListener getDefaultActionListener()
           
protected  InputVerifier getDefaultInputVerifier()
           
 ParamExceptionHandler getExceptionHandler()
          Returns an optional error handler for this editor.
 JLabel getLabelComponent()
          Gets the label component.
 Parameter getParameter()
          Gets the parameter to which this editor belongs to.
 JLabel getPhysUnitLabelComponent()
          Gets the physical unit label component.
 boolean handleParamException(ParamException e)
          Implements the default behaviour for _parameter errors: A message box is shown for the given message string.
protected  void initUI()
          Initialized the UI of this editor.
 boolean isEnabled()
          Checks whether or not the editor is enabled,
protected  void nameComponent(JComponent component, String suffix)
           
protected  void nameEditorComponent(JComponent component)
           
protected  void nameLabelComponent(JComponent component)
           
protected  void nameUnitComponent(JComponent component)
           
 void reconfigureUI()
          Tells the UI component to reconfigure itself, since the parameter's properties have changed.
protected  void setDefaultLabelComponent(boolean ensureTrailingColon)
           
protected  void setDefaultPhysUnitLabelComponent(boolean ensureLeadingSpace)
           
 void setEnabled(boolean enabled)
          Enables/disables this editor.
 void setLabelComponent(JLabel labelComponent)
          Sets the label component.
protected  boolean setParameterValue(JTextComponent textComponent)
           
 void setPhysUnitLabelComponent(JLabel labelComponent)
          Sets the physical unit component.
 void updateUI()
          Tells the UI to update it's state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.esa.beam.framework.param.ParamEditor
getEditorComponent
 

Constructor Detail

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 Detail

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()
Simply returns ParamEditor.getEditorComponent().

Specified by:
getComponent in interface ParamEditor
Returns:
the editor component or the editor component wrapped
See Also:
ParamEditor.getEditorComponent()

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)


Copyright © 2002-2013 Brockmann Consult GmbH. All Rights Reserved.