Package adams.gui.goe
Class AbstractAdvancedScriptEditor
- java.lang.Object
-
- java.beans.PropertyEditorSupport
-
- adams.gui.goe.AbstractPropertyEditorSupport
-
- adams.gui.goe.AbstractAdvancedScriptEditor
-
- All Implemented Interfaces:
HelpProvider
,CustomStringRepresentationHandler
,InlineEditorSupport
,PropertyEditor
- Direct Known Subclasses:
AbstractAdvancedScriptEditorWithTemplates
public class AbstractAdvancedScriptEditor extends AbstractPropertyEditorSupport implements CustomStringRepresentationHandler, InlineEditorSupport
A PropertyEditor for AbstractAdvancedScript-derived objects.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
AbstractAdvancedScript
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractTextAreaPanelWithAdvancedSyntaxHighlighting
m_TextStatement
The text area with the script.-
Fields inherited from class adams.gui.goe.AbstractPropertyEditorSupport
APPROVE_OPTION, CANCEL_OPTION, EMPTY, m_ChosenOption, m_CustomEditor, m_WindowAdapter, NULL
-
-
Constructor Summary
Constructors Constructor Description AbstractAdvancedScriptEditor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addAdditionalMenuItems(JPopupMenu menu)
Hook-method to add further menu items to the menu of the "..." button.protected JComponent
createCustomEditor()
Gets the custom editor component.protected JPopupMenu
createPopupMenu()
Creates the popup menu for "..." button.Object
fromCustomStringRepresentation(String str)
Returns an object created from the custom string representation.protected Dimension
getDefaultSize()
Returns the default size to use for the panels.String
getInlineValue()
Returns the current value.String
getJavaInitializationString()
Returns a representation of the current property value as java source.protected void
initForDisplay()
Initializes the display of the value.boolean
isInlineEditingAvailable()
Checks whether inline editing is available.boolean
isInlineValueValid(String value)
Checks whether the value id valid.void
paintValue(Graphics gfx, Rectangle box)
Paints a representation of the current Object.void
setInlineValue(String value)
Sets the value to use.String
toCustomStringRepresentation(Object obj)
Returns a custom string representation of the object.-
Methods inherited from class adams.gui.goe.AbstractPropertyEditorSupport
addWindowAdapter, cleanUp, closeDialog, createPopup, createTipText, createWindowAdapter, getChosenOption, getCustomEditor, getHelpDescription, getHelpIcon, getHelpTitle, getHelpURL, getParentDialog, getParentFrame, initialize, isPaintable, resetChosenOption, setValue, supportsCustomEditor
-
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getAsText, getSource, getTags, getValue, removePropertyChangeListener, setAsText, setSource
-
-
-
-
Field Detail
-
m_TextStatement
protected AbstractTextAreaPanelWithAdvancedSyntaxHighlighting m_TextStatement
The text area with the script.
-
-
Method Detail
-
toCustomStringRepresentation
public String toCustomStringRepresentation(Object obj)
Returns a custom string representation of the object.- Specified by:
toCustomStringRepresentation
in interfaceCustomStringRepresentationHandler
- Parameters:
obj
- the object to turn into a string- Returns:
- the string representation
-
fromCustomStringRepresentation
public Object fromCustomStringRepresentation(String str)
Returns an object created from the custom string representation.- Specified by:
fromCustomStringRepresentation
in interfaceCustomStringRepresentationHandler
- Parameters:
str
- the string to turn into an object- Returns:
- the object
-
getJavaInitializationString
public String getJavaInitializationString()
Returns a representation of the current property value as java source.- Specified by:
getJavaInitializationString
in interfacePropertyEditor
- Overrides:
getJavaInitializationString
in classPropertyEditorSupport
- Returns:
- a value of type 'String'
-
paintValue
public void paintValue(Graphics gfx, Rectangle box)
Paints a representation of the current Object.- Specified by:
paintValue
in interfacePropertyEditor
- Overrides:
paintValue
in classPropertyEditorSupport
- Parameters:
gfx
- the graphics context to usebox
- the area we are allowed to paint into
-
getDefaultSize
protected Dimension getDefaultSize()
Returns the default size to use for the panels.- Returns:
- the size
-
createCustomEditor
protected JComponent createCustomEditor()
Gets the custom editor component.- Specified by:
createCustomEditor
in classAbstractPropertyEditorSupport
- Returns:
- the editor
-
createPopupMenu
protected JPopupMenu createPopupMenu()
Creates the popup menu for "..." button.- Returns:
- the menu
-
addAdditionalMenuItems
protected void addAdditionalMenuItems(JPopupMenu menu)
Hook-method to add further menu items to the menu of the "..." button.
Default implementation does nothing.- Parameters:
menu
- the popup menu for the button
-
initForDisplay
protected void initForDisplay()
Initializes the display of the value.- Overrides:
initForDisplay
in classAbstractPropertyEditorSupport
-
isInlineEditingAvailable
public boolean isInlineEditingAvailable()
Checks whether inline editing is available.- Specified by:
isInlineEditingAvailable
in interfaceInlineEditorSupport
- Returns:
- true if editing available
-
setInlineValue
public void setInlineValue(String value)
Sets the value to use.- Specified by:
setInlineValue
in interfaceInlineEditorSupport
- Parameters:
value
- the value to use
-
getInlineValue
public String getInlineValue()
Returns the current value.- Specified by:
getInlineValue
in interfaceInlineEditorSupport
- Returns:
- the current value
-
isInlineValueValid
public boolean isInlineValueValid(String value)
Checks whether the value id valid.- Specified by:
isInlineValueValid
in interfaceInlineEditorSupport
- Parameters:
value
- the value to check- Returns:
- true if valid
-
-