Package adams.gui.goe
Class JdbcUrlEditor
- java.lang.Object
-
- java.beans.PropertyEditorSupport
-
- adams.gui.goe.AbstractPropertyEditorSupport
-
- adams.gui.goe.JdbcUrlEditor
-
- All Implemented Interfaces:
HelpProvider
,CustomStringRepresentationHandler
,InlineEditorSupport
,InlineEditorSupportWithFavorites
,MultiSelectionEditor
,PropertyEditor
public class JdbcUrlEditor extends AbstractPropertyEditorSupport implements CustomStringRepresentationHandler, MultiSelectionEditor, InlineEditorSupportWithFavorites, HelpProvider
A PropertyEditor for JdbcUrl objects.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
JdbcUrl
-
-
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 BaseButton
m_ButtonHistory
the button for the history.protected JTextComponent
m_TextValue
The text field with the value.-
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 JdbcUrlEditor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
acceptInput()
Accepts the input and closes the dialog.protected void
connect(ConnectionParameters params)
Connects using the parameters.protected JComponent
createCustomEditor()
Gets the custom editor component.protected void
discardInput()
Discards the input and closes the dialog.Object
fromCustomStringRepresentation(String str)
Returns an object created from the custom string representation.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.Class
getInlineFavoritesClass()
Returns the class to use for favorites.String
getInlineValue()
Returns the current value.String
getJavaInitializationString()
Returns a representation of the current property value as java source.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.boolean
isInlineEditingAvailable()
Checks whether inline editing is available.boolean
isInlineFavoritesEnabled()
Checks whether favorites support is available.boolean
isInlineValueValid(String value)
Checks whether the value id valid.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.void
paintValue(Graphics gfx, Rectangle box)
Paints a representation of the current Object.protected JdbcUrl
parse(String s)
Parses the given string and returns the generated object.void
setInlineValue(String value)
Sets the value to use.protected void
showConnectionsPopup()
Shows the popup menu with the connections.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, 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_TextValue
protected JTextComponent m_TextValue
The text field with the value.
-
m_ButtonHistory
protected BaseButton m_ButtonHistory
the button for the history.
-
m_ButtonHelp
protected BaseButton m_ButtonHelp
the help button for bringing up a browser with the Java Pattern class.
-
-
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'
-
getStringToPaint
protected String getStringToPaint()
Returns the string to paint.- Returns:
- the string
- See Also:
paintValue(Graphics, Rectangle)
-
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- See Also:
getStringToPaint()
-
parse
protected JdbcUrl 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.- Parameters:
s
- the string to parse- Returns:
- the generated object, or null in case of an error
-
createCustomEditor
protected JComponent createCustomEditor()
Gets the custom editor component.- Specified by:
createCustomEditor
in classAbstractPropertyEditorSupport
- Returns:
- always null
-
showConnectionsPopup
protected void showConnectionsPopup()
Shows the popup menu with the connections.
-
connect
protected void connect(ConnectionParameters params)
Connects using the parameters.- Parameters:
params
- the connection parameters
-
isValid
protected boolean isValid(String s)
Checks whether the string is valid.- 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.- Parameters:
s
- the string to check- Returns:
- true if the strings are the same
-
acceptInput
protected void acceptInput()
Accepts the input and closes the dialog.
-
discardInput
protected void discardInput()
Discards the input and closes the dialog.
-
initForDisplay
protected void initForDisplay()
Initializes the display of the value.- Overrides:
initForDisplay
in classAbstractPropertyEditorSupport
-
getSelectedObjects
public Object[] getSelectedObjects(Container parent)
Returns the selected objects.- Specified by:
getSelectedObjects
in interfaceMultiSelectionEditor
- Parameters:
parent
- the parent container- Returns:
- the objects
-
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
-
isInlineFavoritesEnabled
public boolean isInlineFavoritesEnabled()
Checks whether favorites support is available.- Specified by:
isInlineFavoritesEnabled
in interfaceInlineEditorSupportWithFavorites
- Returns:
- true if enabled
-
getInlineFavoritesClass
public Class getInlineFavoritesClass()
Returns the class to use for favorites.- Specified by:
getInlineFavoritesClass
in interfaceInlineEditorSupportWithFavorites
- Returns:
- the class to use
-
getHelpURL
public String getHelpURL()
Returns a URL with additional information.- Specified by:
getHelpURL
in interfaceHelpProvider
- Overrides:
getHelpURL
in classAbstractPropertyEditorSupport
- Returns:
- the URL (or multiple URLs tab-separated), null if not available
-
getHelpDescription
public String getHelpDescription()
Returns a long help description, e.g., used in tiptexts.- Specified by:
getHelpDescription
in interfaceHelpProvider
- Overrides:
getHelpDescription
in classAbstractPropertyEditorSupport
- Returns:
- the help text, null if not available
-
getHelpTitle
public String getHelpTitle()
Returns a short title for the help, e.g., used for buttons.- Specified by:
getHelpTitle
in interfaceHelpProvider
- Overrides:
getHelpTitle
in classAbstractPropertyEditorSupport
- Returns:
- the short title, null if not available
-
getHelpIcon
public String getHelpIcon()
Returns the name of a help icon, e.g., used for buttons.- Specified by:
getHelpIcon
in interfaceHelpProvider
- Overrides:
getHelpIcon
in classAbstractPropertyEditorSupport
- Returns:
- the icon name, null if not available
-
-