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,StringEditor,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 intAPPROVE_OPTIONthe user approved the dialog.static intCANCEL_OPTIONthe user canceled the dialog.static StringEMPTYthe string to use if there is an empty string to be display.protected intm_ChosenOptionthe option that the user chose.protected JComponentm_CustomEditorthe custom editor.protected WindowAdapterm_WindowAdapterthe window adapter for de-registering the DB change listener.static StringNULLthe string to use if there is null value to be display.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPropertyEditorSupport()Initializes the editor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddWindowAdapter()Adds a window listener to the dialog.protected voidcleanUp()Cleans up when the dialog is closed.protected voidcloseDialog(int option)Closes the dialog.protected abstract JComponentcreateCustomEditor()Creates the custom editor.protected BasePopupMenucreatePopup()Creates a popup menu.StringcreateTipText(String help)Creates a tip text from the given help string.protected WindowAdaptercreateWindowAdapter()Creates the window adapater to attach.intgetChosenOption()Returns the option that the user chose.ComponentgetCustomEditor()Gets the custom editor component.StringgetHelpDescription()Returns a long help description, e.g., used in tiptexts.StringgetHelpIcon()Returns the name of a help icon, e.g., used for buttons.StringgetHelpTitle()Returns a short title for the help, e.g., used for buttons.StringgetHelpURL()Returns a URL with additional information.protected DialoggetParentDialog()Returns the parent dialog if possible.protected FramegetParentFrame()Returns the parent frame if possible.protected voidinitForDisplay()Initializes the display of the value.protected voidinitialize()For initializing members.booleanisPaintable()Returns true since this editor is paintable.protected voidresetChosenOption()Resets the chosen option to CANCEL.voidsetValue(Object value)Set (or change) the object that is to be edited.booleansupportsCustomEditor()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:
isPaintablein interfacePropertyEditor- Overrides:
isPaintablein classPropertyEditorSupport- Returns:
- always true.
-
supportsCustomEditor
public boolean supportsCustomEditor()
Returns true because we do support a custom editor.- Specified by:
supportsCustomEditorin interfacePropertyEditor- Overrides:
supportsCustomEditorin classPropertyEditorSupport- Returns:
- always true
-
setValue
public void setValue(Object value)
Set (or change) the object that is to be edited.- Specified by:
setValuein interfacePropertyEditor- Overrides:
setValuein 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:
getCustomEditorin interfacePropertyEditor- Overrides:
getCustomEditorin 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:
getHelpURLin 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:
getHelpDescriptionin 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:
getHelpTitlein 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:
getHelpIconin interfaceHelpProvider- Returns:
- the icon name, null if not available
-
-