Package org.esa.snap.core.param
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 Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractParamEditor(Parameter parameter, boolean useDefaultVerifier) Creates the object with a given parameter. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckParameterValue(JTextComponent textComponent) Checks whether or not the given text component provides a valid value for this parameter.Simply returnsParamEditor.getEditorComponent().protected ActionListenerprotected InputVerifierReturns an optional error handler for this editor.Gets the label component.Gets the parameter to which this editor belongs to.Gets the physical unit label component.booleanImplements the default behaviour for _parameter errors: A message box is shown for the given message string.protected voidinitUI()Initialized the UI of this editor.booleanChecks whether or not the editor is enabled,protected voidnameComponent(JComponent component, String suffix) protected voidnameEditorComponent(JComponent component) protected voidnameLabelComponent(JComponent component) protected voidnameUnitComponent(JComponent component) voidTells the UI component to reconfigure itself, since the parameter's properties have changed.protected voidsetDefaultLabelComponent(boolean ensureTrailingColon) protected voidsetDefaultPhysUnitLabelComponent(boolean ensureLeadingSpace) voidsetEnabled(boolean enabled) Enables/disables this editor.voidsetLabelComponent(JLabel labelComponent) Sets the label component.protected booleansetParameterValue(JTextComponent textComponent) voidsetPhysUnitLabelComponent(JLabel labelComponent) Sets the physical unit component.voidupdateUI()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, waitMethods inherited from interface org.esa.snap.core.param.ParamEditor
getEditorComponent
-
Constructor Details
-
AbstractParamEditor
Creates the object with a given parameter.- Parameters:
parameter- theParameterto be edited.useDefaultVerifier-trueif a default verifier should be used
-
-
Method Details
-
getParameter
Gets the parameter to which this editor belongs to.- Specified by:
getParameterin interfaceParamEditor
-
getLabelComponent
Gets the label component.- Specified by:
getLabelComponentin interfaceParamEditor
-
setLabelComponent
Sets the label component.- Specified by:
setLabelComponentin interfaceParamEditor
-
getPhysUnitLabelComponent
Gets the physical unit label component.- Specified by:
getPhysUnitLabelComponentin interfaceParamEditor
-
setPhysUnitLabelComponent
Sets the physical unit component.- Specified by:
setPhysUnitLabelComponentin interfaceParamEditor
-
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:
isEnabledin interfaceParamEditor
-
setEnabled
public void setEnabled(boolean enabled) Enables/disables this editor.- Specified by:
setEnabledin interfaceParamEditor
-
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:
updateUIin interfaceParamEditor
-
reconfigureUI
public void reconfigureUI()Tells the UI component to reconfigure itself, since the parameter's properties have changed.The default implementation simply calls the
updateUImethod.- Specified by:
reconfigureUIin interfaceParamEditor
-
handleParamException
Implements the default behaviour for _parameter errors: A message box is shown for the given message string.- Specified by:
handleParamExceptionin interfaceParamExceptionHandler- Parameters:
e- the exception- Returns:
trueif the exception was handled successfully,falseotherwise
-
getDefaultInputVerifier
-
getDefaultActionListener
-
setParameterValue
-
checkParameterValue
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:
trueif so
-
getExceptionHandler
Returns an optional error handler for this editor. The default implementation simply returnsthisinstance.- Specified by:
getExceptionHandlerin interfaceParamEditor
-
getComponent
Simply returnsParamEditor.getEditorComponent().- Specified by:
getComponentin interfaceParamEditor- Returns:
- the editor component or the editor component wrapped
- See Also:
-
nameLabelComponent
-
nameEditorComponent
-
nameUnitComponent
-
nameComponent
-