Package adams.gui.goe
Class AbstractPropertyEditorSupport
- java.lang.Object
-
- java.beans.PropertyEditorSupport
-
- adams.gui.goe.AbstractPropertyEditorSupport
-
- All Implemented Interfaces:
HelpProvider
,PropertyEditor
- Direct Known Subclasses:
AbstractAdvancedScriptEditor
,AbstractBaseDateTypeEditor
,AbstractBasicTypePropertyEditor
,AbstractDatabaseConnectionAwarePropertyEditorSupport
,AbstractSimpleScriptEditor
,ActorPathEditor
,BaseAnnotationEditor
,BaseBooleanEditor
,BaseClassnameEditor
,BaseColorEditor
,BaseCommandLineEditor
,BaseObjectEditor
,BaseTextEditor
,CallableActorReferenceEditor
,ColorEditor
,CronScheduleEditor
,EmailAddressEditor
,EventReferenceEditor
,FieldEditor
,FileEditor
,FlowFileEditor
,FontEditor
,IndexEditor
,JdbcUrlEditor
,PdfFontEditor
,PlaceholderDirectoryEditor
,PlaceholderFileEditor
,RangeEditor
,UnorderedRangeEditor
,WekaExperimentFileEditor
public abstract class AbstractPropertyEditorSupport extends PropertyEditorSupport implements HelpProvider
A superclass for editors with custom editors.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static int
APPROVE_OPTION
the user approved the dialog.static int
CANCEL_OPTION
the user canceled the dialog.static String
EMPTY
the string to use if there is an empty string to be display.protected int
m_ChosenOption
the option that the user chose.protected JComponent
m_CustomEditor
the custom editor.protected WindowAdapter
m_WindowAdapter
the window adapter for de-registering the DB change listener.static String
NULL
the string to use if there is null value to be display.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPropertyEditorSupport()
Initializes the editor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addWindowAdapter()
Adds a window listener to the dialog.protected void
cleanUp()
Cleans up when the dialog is closed.protected void
closeDialog(int option)
Closes the dialog.protected abstract JComponent
createCustomEditor()
Creates the custom editor.protected BasePopupMenu
createPopup()
Creates a popup menu.String
createTipText(String help)
Creates a tip text from the given help string.protected WindowAdapter
createWindowAdapter()
Creates the window adapater to attach.int
getChosenOption()
Returns the option that the user chose.Component
getCustomEditor()
Gets the custom editor component.String
getHelpDescription()
Returns a long help description, e.g., used in tiptexts.String
getHelpIcon()
Returns the name of a help icon, e.g., used for buttons.String
getHelpTitle()
Returns a short title for the help, e.g., used for buttons.String
getHelpURL()
Returns a URL with additional information.protected Dialog
getParentDialog()
Returns the parent dialog if possible.protected Frame
getParentFrame()
Returns the parent frame if possible.protected void
initForDisplay()
Initializes the display of the value.protected void
initialize()
For initializing members.boolean
isPaintable()
Returns true since this editor is paintable.protected void
resetChosenOption()
Resets the chosen option to CANCEL.void
setValue(Object value)
Set (or change) the object that is to be edited.boolean
supportsCustomEditor()
Returns true because we do support a custom editor.-
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getAsText, getJavaInitializationString, getSource, getTags, getValue, paintValue, removePropertyChangeListener, setAsText, setSource
-
-
-
-
Field Detail
-
CANCEL_OPTION
public static final int CANCEL_OPTION
the user canceled the dialog.- See Also:
- Constant Field Values
-
APPROVE_OPTION
public static final int APPROVE_OPTION
the user approved the dialog.- See Also:
- Constant Field Values
-
NULL
public static final String NULL
the string to use if there is null value to be display.- See Also:
- Constant Field Values
-
EMPTY
public static final String EMPTY
the string to use if there is an empty string to be display.- See Also:
- Constant Field Values
-
m_CustomEditor
protected JComponent m_CustomEditor
the custom editor.
-
m_WindowAdapter
protected WindowAdapter m_WindowAdapter
the window adapter for de-registering the DB change listener.
-
m_ChosenOption
protected int m_ChosenOption
the option that the user chose.
-
-
Method Detail
-
initialize
protected void initialize()
For initializing members.
Default implementation does nothing.
-
isPaintable
public boolean isPaintable()
Returns true since this editor is paintable.- Specified by:
isPaintable
in interfacePropertyEditor
- Overrides:
isPaintable
in classPropertyEditorSupport
- Returns:
- always true.
-
supportsCustomEditor
public boolean supportsCustomEditor()
Returns true because we do support a custom editor.- Specified by:
supportsCustomEditor
in interfacePropertyEditor
- Overrides:
supportsCustomEditor
in classPropertyEditorSupport
- Returns:
- always true
-
setValue
public void setValue(Object value)
Set (or change) the object that is to be edited.- Specified by:
setValue
in interfacePropertyEditor
- Overrides:
setValue
in classPropertyEditorSupport
- Parameters:
value
- The new target object to be edited. Note that this object should not be modified by the PropertyEditor, rather the PropertyEditor should create a new object to hold any modified value.
-
createWindowAdapter
protected WindowAdapter createWindowAdapter()
Creates the window adapater to attach.- Returns:
- the WindowAdapter to use
-
addWindowAdapter
protected void addWindowAdapter()
Adds a window listener to the dialog.- See Also:
initForDisplay()
-
cleanUp
protected void cleanUp()
Cleans up when the dialog is closed.
Default implementation does nothing.
-
closeDialog
protected void closeDialog(int option)
Closes the dialog.- Parameters:
option
- the chosen option- See Also:
getChosenOption()
-
getParentDialog
protected Dialog getParentDialog()
Returns the parent dialog if possible.- Returns:
- the parent dialog, null if not available
-
getParentFrame
protected Frame getParentFrame()
Returns the parent frame if possible.- Returns:
- the parent frame, null if not available
-
createCustomEditor
protected abstract JComponent createCustomEditor()
Creates the custom editor.- Returns:
- the editor
-
resetChosenOption
protected void resetChosenOption()
Resets the chosen option to CANCEL.- See Also:
getChosenOption()
,CANCEL_OPTION
-
initForDisplay
protected void initForDisplay()
Initializes the display of the value.
-
getChosenOption
public int getChosenOption()
Returns the option that the user chose.- Returns:
- the option
- See Also:
APPROVE_OPTION
,CANCEL_OPTION
-
getCustomEditor
public Component getCustomEditor()
Gets the custom editor component.- Specified by:
getCustomEditor
in interfacePropertyEditor
- Overrides:
getCustomEditor
in classPropertyEditorSupport
- Returns:
- the editor
-
createPopup
protected BasePopupMenu createPopup()
Creates a popup menu.- Returns:
- the popup menu, null if not supported
-
createTipText
public String createTipText(String help)
Creates a tip text from the given help string.- Parameters:
help
- the help string, can be null- Returns:
- the generated tip text string
-
getHelpURL
public String getHelpURL()
Returns a URL with additional information.
If current value is an instance ofHelpProvider
, then its URL is returned, otherwise null.- Specified by:
getHelpURL
in interfaceHelpProvider
- Returns:
- the URL, null if not available
-
getHelpDescription
public String getHelpDescription()
Returns a long help description, e.g., used in tiptexts.
If current value is an instance ofHelpProvider
, then its description is returned, otherwise the value's tip text.- Specified by:
getHelpDescription
in interfaceHelpProvider
- Returns:
- the help text, null if not available
-
getHelpTitle
public String getHelpTitle()
Returns a short title for the help, e.g., used for buttons.
If current value is an instance ofHelpProvider
, then its title is returned, otherwise null.- Specified by:
getHelpTitle
in interfaceHelpProvider
- Returns:
- the short title, null if not available
-
getHelpIcon
public String getHelpIcon()
Returns the name of a help icon, e.g., used for buttons.
If current value is an instance ofHelpProvider
, then its icon is returned, otherwise null.- Specified by:
getHelpIcon
in interfaceHelpProvider
- Returns:
- the icon name, null if not available
-
-