Package adams.gui.goe
Class BaseRegExpEditor
- java.lang.Object
-
- java.beans.PropertyEditorSupport
-
- adams.gui.goe.AbstractPropertyEditorSupport
-
- adams.gui.goe.BaseObjectEditor
-
- adams.gui.goe.BaseRegExpEditor
-
- All Implemented Interfaces:
HelpProvider
,CustomStringRepresentationHandler
,InlineEditorSupport
,InlineEditorSupportWithFavorites
,MultiSelectionEditor
,PropertyEditor
public class BaseRegExpEditor extends BaseObjectEditor implements MultiSelectionEditor
Editor specifically designed for entering regular expression. In order to enter line feeds, tabs, etc. the user can enable "escaped input".- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseButton
m_ButtonHelp
the help button for bringing up a browser with the Java Pattern class.protected BaseCheckBox
m_CheckBoxEscapedInput
the checkbox for "escaped input".-
Fields inherited from class adams.gui.goe.BaseObjectEditor
m_TextValue
-
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 BaseRegExpEditor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected JComponent
createCustomEditor()
Gets the custom editor component.Object
fromCustomStringRepresentation(String str)
Returns an object created from the custom string representation.Object[]
getSelectedObjects(Container parent)
Returns the selected objects.protected String
getStringToPaint()
Returns the string to paint.protected void
initForDisplay()
Initializes the display of the value.protected boolean
isUnchanged(String s)
Checks whether the string is the same as the currently used one.protected boolean
isValid(String s)
Checks whether the string is valid.protected BaseObject
parse(String s)
Parses the given string and returns the generated object.String
toCustomStringRepresentation(Object obj)
Returns a custom string representation of the object.protected String
unEscape(String s)
Unescapes the string if necessary.-
Methods inherited from class adams.gui.goe.BaseObjectEditor
acceptInput, discardInput, getHelpDescription, getInlineFavoritesClass, getInlineValue, getJavaInitializationString, isInlineEditingAvailable, isInlineFavoritesEnabled, isInlineValueValid, paintValue, setInlineValue
-
Methods inherited from class adams.gui.goe.AbstractPropertyEditorSupport
addWindowAdapter, cleanUp, closeDialog, createPopup, createTipText, createWindowAdapter, getChosenOption, getCustomEditor, 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_CheckBoxEscapedInput
protected BaseCheckBox m_CheckBoxEscapedInput
the checkbox for "escaped input".
-
m_ButtonHelp
protected BaseButton m_ButtonHelp
the help button for bringing up a browser with the Java Pattern class.
-
-
Method Detail
-
createCustomEditor
protected JComponent createCustomEditor()
Gets the custom editor component.- Overrides:
createCustomEditor
in classBaseObjectEditor
- Returns:
- the editor
-
unEscape
protected String unEscape(String s)
Unescapes the string if necessary.- Parameters:
s
- the string to unescape- Returns:
- the processed string
-
isValid
protected boolean isValid(String s)
Checks whether the string is valid.- Overrides:
isValid
in classBaseObjectEditor
- Parameters:
s
- the string to check- Returns:
- true if the string is valid
-
isUnchanged
protected boolean isUnchanged(String s)
Checks whether the string is the same as the currently used one.- Overrides:
isUnchanged
in classBaseObjectEditor
- Parameters:
s
- the string to check- Returns:
- true if the strings are the same
-
parse
protected BaseObject parse(String s)
Parses the given string and returns the generated object. The string has to be a valid one, i.e., the isValid(String) check has been performed already and succeeded.- Overrides:
parse
in classBaseObjectEditor
- Parameters:
s
- the string to parse- Returns:
- the generated object, or null in case of an error
-
initForDisplay
protected void initForDisplay()
Initializes the display of the value.- Overrides:
initForDisplay
in classBaseObjectEditor
-
getStringToPaint
protected String getStringToPaint()
Returns the string to paint.- Overrides:
getStringToPaint
in classBaseObjectEditor
- Returns:
- the string
- See Also:
BaseObjectEditor.paintValue(Graphics, Rectangle)
-
toCustomStringRepresentation
public String toCustomStringRepresentation(Object obj)
Returns a custom string representation of the object.- Specified by:
toCustomStringRepresentation
in interfaceCustomStringRepresentationHandler
- Overrides:
toCustomStringRepresentation
in classBaseObjectEditor
- 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
- Overrides:
fromCustomStringRepresentation
in classBaseObjectEditor
- Parameters:
str
- the string to turn into an object- Returns:
- the object
-
getSelectedObjects
public Object[] getSelectedObjects(Container parent)
Returns the selected objects.- Specified by:
getSelectedObjects
in interfaceMultiSelectionEditor
- Overrides:
getSelectedObjects
in classBaseObjectEditor
- Parameters:
parent
- the parent container- Returns:
- the objects
-
-