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 BaseButtonm_ButtonHelpthe help button for bringing up a browser with the Java Pattern class.protected BaseCheckBoxm_CheckBoxEscapedInputthe 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 JComponentcreateCustomEditor()Gets the custom editor component.ObjectfromCustomStringRepresentation(String str)Returns an object created from the custom string representation.Object[]getSelectedObjects(Container parent)Returns the selected objects.protected StringgetStringToPaint()Returns the string to paint.protected voidinitForDisplay()Initializes the display of the value.protected booleanisUnchanged(String s)Checks whether the string is the same as the currently used one.protected booleanisValid(String s)Checks whether the string is valid.protected BaseObjectparse(String s)Parses the given string and returns the generated object.StringtoCustomStringRepresentation(Object obj)Returns a custom string representation of the object.protected StringunEscape(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:
createCustomEditorin 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:
isValidin 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:
isUnchangedin 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:
parsein 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:
initForDisplayin classBaseObjectEditor
-
getStringToPaint
protected String getStringToPaint()
Returns the string to paint.- Overrides:
getStringToPaintin 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:
toCustomStringRepresentationin interfaceCustomStringRepresentationHandler- Overrides:
toCustomStringRepresentationin 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:
fromCustomStringRepresentationin interfaceCustomStringRepresentationHandler- Overrides:
fromCustomStringRepresentationin 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:
getSelectedObjectsin interfaceMultiSelectionEditor- Overrides:
getSelectedObjectsin classBaseObjectEditor- Parameters:
parent- the parent container- Returns:
- the objects
-
-