Package adams.gui.dialog
Class MongoDbConnectionPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.dialog.MongoDbConnectionPanel
-
- All Implemented Interfaces:
adams.core.StatusMessageHandler
,ImageObserver
,MenuContainer
,Serializable
,Comparable<MongoDbConnectionPanel>
,Accessible
public class MongoDbConnectionPanel extends adams.gui.core.BasePanel implements adams.core.StatusMessageHandler, Comparable<MongoDbConnectionPanel>
A panel for connecting to a MongoDB.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected adams.gui.core.BaseButton
m_ButtonConnect
the button connecting/disconnecting the database.protected adams.gui.core.BaseButton
m_ButtonMakeDefault
the button for making a connection the default one.protected HashSet<ChangeListener>
m_ChangeListeners
the change listeners.protected adams.gui.core.BaseCheckBox
m_CheckBoxConnectOnStartUp
the checkbox for connecting on startup.protected adams.gui.core.BaseCheckBox
m_CheckBoxShowPassword
the checkbox for showing the password.protected adams.gui.core.BaseComboBox
m_ComboBoxConnections
the combobox with the available connections.protected adams.gui.core.BaseComboBox
m_ComboBoxLoggingLevel
the combobox for the logging level.protected JLabel
m_LabelStatus
the label for status messages.protected adams.gui.core.ParameterPanel
m_PanelParameters
for the parameters.protected MongoDbConnectionPanel
m_Self
the panel itself.protected adams.gui.core.BaseTextField
m_TextAuthDB
the edit field for the authentication DB.protected JPasswordField
m_TextPassword
the edit field for the database password.protected adams.gui.core.BaseTextField
m_TextURL
the edit field for the database URL.protected adams.gui.core.BaseTextField
m_TextUser
the edit field for the database user.-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description MongoDbConnectionPanel()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChangeListener(ChangeListener l)
Adds the listener for changes in the connection.int
compareTo(MongoDbConnectionPanel o)
Compares this object with the specified object for order.protected void
displayParameters(MongoDbConnection conn)
Displays the parameters.protected void
displayParameters(MongoDbConnectionParameters conn)
Displays the parameters.protected void
doReconnect()
Performs the reconnection.boolean
equals(Object o)
Checks whether this object is equal to the specified one.protected void
finishInit()
Finishes the initialization.protected MongoDbConnectionParameters
getCurrentParameters()
Returns the current parameters as connection object.MongoDbConnection
getDatabaseConnection()
Returns the currently used database connection object, can be null.protected MongoDbConnection
getDefaultDatabaseConnection()
Returns the default database connection to use.static String[]
getPanels()
Returns a list with classnames of panels.protected String
getTitle()
The title of the connection panel.protected void
initGUI()
Initializes the GUI.protected void
initialize()
For initializing members.protected void
makeDefault()
Makes the current parameters the default.protected MongoDbConnectionParameters
newConnectionParameters()
Returns a new instance of a ConnectionParameters object.protected void
notifyChangeListeners()
Notifies all listeners about a change in the connection.void
removeChangeListener(ChangeListener l)
Removes the listener for changes in the connection.void
setEnabled(boolean b)
Sets the enabled state of the panel.protected void
setEnabledState(boolean b)
Sets the enabled state of the parameters.void
showStatus(String msg)
Displays a message.void
update()
updates the enabled state content etc.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, main, printErrorMessage, printException, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
m_Self
protected MongoDbConnectionPanel m_Self
the panel itself.
-
m_ComboBoxConnections
protected adams.gui.core.BaseComboBox m_ComboBoxConnections
the combobox with the available connections.
-
m_TextURL
protected adams.gui.core.BaseTextField m_TextURL
the edit field for the database URL.
-
m_TextUser
protected adams.gui.core.BaseTextField m_TextUser
the edit field for the database user.
-
m_TextPassword
protected JPasswordField m_TextPassword
the edit field for the database password.
-
m_CheckBoxShowPassword
protected adams.gui.core.BaseCheckBox m_CheckBoxShowPassword
the checkbox for showing the password.
-
m_TextAuthDB
protected adams.gui.core.BaseTextField m_TextAuthDB
the edit field for the authentication DB.
-
m_ComboBoxLoggingLevel
protected adams.gui.core.BaseComboBox m_ComboBoxLoggingLevel
the combobox for the logging level.
-
m_CheckBoxConnectOnStartUp
protected adams.gui.core.BaseCheckBox m_CheckBoxConnectOnStartUp
the checkbox for connecting on startup.
-
m_ButtonMakeDefault
protected adams.gui.core.BaseButton m_ButtonMakeDefault
the button for making a connection the default one.
-
m_ButtonConnect
protected adams.gui.core.BaseButton m_ButtonConnect
the button connecting/disconnecting the database.
-
m_LabelStatus
protected JLabel m_LabelStatus
the label for status messages.
-
m_PanelParameters
protected adams.gui.core.ParameterPanel m_PanelParameters
for the parameters.
-
m_ChangeListeners
protected HashSet<ChangeListener> m_ChangeListeners
the change listeners.
-
-
Method Detail
-
initialize
protected void initialize()
For initializing members.- Overrides:
initialize
in classadams.gui.core.BasePanel
-
getDefaultDatabaseConnection
protected MongoDbConnection getDefaultDatabaseConnection()
Returns the default database connection to use.- Returns:
- the database connection
-
initGUI
protected void initGUI()
Initializes the GUI.- Overrides:
initGUI
in classadams.gui.core.BasePanel
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInit
in classadams.gui.core.BasePanel
-
getTitle
protected String getTitle()
The title of the connection panel.- Returns:
- the title
-
displayParameters
protected void displayParameters(MongoDbConnectionParameters conn)
Displays the parameters.- Parameters:
conn
- the parameters to display
-
displayParameters
protected void displayParameters(MongoDbConnection conn)
Displays the parameters.- Parameters:
conn
- the database connection to display
-
doReconnect
protected void doReconnect()
Performs the reconnection.
-
makeDefault
protected void makeDefault()
Makes the current parameters the default.
-
newConnectionParameters
protected MongoDbConnectionParameters newConnectionParameters()
Returns a new instance of a ConnectionParameters object.- Returns:
- the empty parameters object
-
getCurrentParameters
protected MongoDbConnectionParameters getCurrentParameters()
Returns the current parameters as connection object.- Returns:
- the current setup
-
getDatabaseConnection
public MongoDbConnection getDatabaseConnection()
Returns the currently used database connection object, can be null.- Returns:
- the current object
-
update
public void update()
updates the enabled state content etc. of all the GUI elements, based on the DatabaseConnection object of the scripting engine.
-
setEnabledState
protected void setEnabledState(boolean b)
Sets the enabled state of the parameters.- Parameters:
b
- if true then the parameters will be enabled
-
setEnabled
public void setEnabled(boolean b)
Sets the enabled state of the panel.- Overrides:
setEnabled
in classJComponent
- Parameters:
b
- if true then the panel will be enabled
-
showStatus
public void showStatus(String msg)
Displays a message.- Specified by:
showStatus
in interfaceadams.core.StatusMessageHandler
- Parameters:
msg
- the message to display
-
compareTo
public int compareTo(MongoDbConnectionPanel o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. Merely uses the title of the panels for comparison.- Specified by:
compareTo
in interfaceComparable<MongoDbConnectionPanel>
- Parameters:
o
- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Throws:
ClassCastException
- if the specified object's type prevents it from being compared to this object.
-
equals
public boolean equals(Object o)
Checks whether this object is equal to the specified one.
-
addChangeListener
public void addChangeListener(ChangeListener l)
Adds the listener for changes in the connection.- Parameters:
l
- the listener to add
-
removeChangeListener
public void removeChangeListener(ChangeListener l)
Removes the listener for changes in the connection.- Parameters:
l
- the listener to remove
-
notifyChangeListeners
protected void notifyChangeListeners()
Notifies all listeners about a change in the connection.
-
getPanels
public static String[] getPanels()
Returns a list with classnames of panels.- Returns:
- the panel classnames
-
-