public class ConnectionPanel
extends javax.swing.JPanel
implements javax.swing.event.CaretListener
javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
HISTORY_NAME
the name of the history.
|
protected javax.swing.JButton |
m_ButtonConnect
the button for connecting to the database.
|
protected javax.swing.JButton |
m_ButtonDatabase
the button for the DB-Dialog.
|
protected javax.swing.JButton |
m_ButtonHistory
the button for the history.
|
protected javax.swing.JButton |
m_ButtonSetup
the button for the setup.
|
protected java.util.HashSet<ConnectionListener> |
m_ConnectionListeners
the connection listeners.
|
protected DatabaseConnectionDialog |
m_DbDialog
the database connection dialog.
|
protected DbUtils |
m_DbUtils
for connecting to the database.
|
protected javax.swing.DefaultListModel |
m_History
the history of connections.
|
protected java.util.HashSet<HistoryChangedListener> |
m_HistoryChangedListeners
the history listeners.
|
protected javax.swing.JLabel |
m_LabelURL
the label for the URL.
|
protected javax.swing.JFrame |
m_Parent
the parent frame.
|
protected java.lang.String |
m_Password
the password to use for connecting to the DB.
|
protected javax.swing.JFileChooser |
m_SetupFileChooser
the file chooser for the setup files.
|
protected javax.swing.JTextField |
m_TextURL
the textfield for the URL.
|
protected java.lang.String |
m_URL
the URL to use.
|
protected java.lang.String |
m_User
the user to use for connecting to the DB.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
ConnectionPanel(javax.swing.JFrame parent)
initializes the panel.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionListener(ConnectionListener l)
adds the given listener to the list of listeners.
|
protected void |
addHistory(java.lang.String s)
adds the given string to the history (removes duplicates).
|
void |
addHistoryChangedListener(HistoryChangedListener l)
adds the given listener to the list of listeners.
|
void |
caretUpdate(javax.swing.event.CaretEvent event)
Called when the caret position is updated.
|
void |
clear()
sets the parameters back to standard.
|
protected void |
connect()
connects to the database, notifies the listeners.
|
protected void |
createPanel()
builds the panel with all its components.
|
javax.swing.DefaultListModel |
getHistory()
returns the history.
|
java.lang.String |
getPassword()
returns the current Password.
|
java.lang.String |
getURL()
returns the current URL.
|
java.lang.String |
getUser()
returns the current User.
|
protected void |
notifyConnectionListeners(int type)
notifies the connection listeners of the event.
|
protected void |
notifyConnectionListeners(int type,
java.lang.Exception ex)
notifies the connection listeners of the event.
|
protected void |
notifyHistoryChangedListeners()
notifies the history listeners of the event.
|
void |
removeConnectionListener(ConnectionListener l)
removes the given listener from the list of listeners.
|
void |
removeHistoryChangedListener(HistoryChangedListener l)
removes the given listener from the list of listeners.
|
protected void |
setButtons()
sets the buttons according to the connected-state.
|
void |
setFocus()
sets the focus in a designated control.
|
void |
setHistory(javax.swing.DefaultListModel history)
sets the local history to the given one.
|
void |
setPassword(java.lang.String pw)
sets the Password.
|
void |
setURL(java.lang.String url)
sets the URL.
|
void |
setUser(java.lang.String user)
sets the User.
|
protected void |
showDialog()
displays the database dialog.
|
void |
showHistory()
displays the query history.
|
void |
switchSetup()
Lets the user select a props file for changing the database connection
parameters.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, 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, validateTreeaction, 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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final java.lang.String HISTORY_NAME
protected javax.swing.JFrame m_Parent
protected DatabaseConnectionDialog m_DbDialog
protected java.lang.String m_URL
protected java.lang.String m_User
protected java.lang.String m_Password
protected javax.swing.JLabel m_LabelURL
protected javax.swing.JTextField m_TextURL
protected javax.swing.JButton m_ButtonDatabase
protected javax.swing.JButton m_ButtonConnect
protected javax.swing.JButton m_ButtonHistory
protected javax.swing.JButton m_ButtonSetup
protected java.util.HashSet<ConnectionListener> m_ConnectionListeners
protected java.util.HashSet<HistoryChangedListener> m_HistoryChangedListeners
protected DbUtils m_DbUtils
protected javax.swing.DefaultListModel m_History
protected javax.swing.JFileChooser m_SetupFileChooser
public ConnectionPanel(javax.swing.JFrame parent)
parent - the parent of this panelprotected void createPanel()
protected void setButtons()
public void clear()
public void setFocus()
public void setURL(java.lang.String url)
url - the new value of the URLpublic java.lang.String getURL()
public void setUser(java.lang.String user)
user - the new value of the Userpublic java.lang.String getUser()
public void setPassword(java.lang.String pw)
pw - the new value of the Passwordpublic java.lang.String getPassword()
protected void addHistory(java.lang.String s)
s - the string to addpublic void setHistory(javax.swing.DefaultListModel history)
history - the history to usepublic javax.swing.DefaultListModel getHistory()
protected void showDialog()
protected void connect()
public void showHistory()
public void switchSetup()
public void addConnectionListener(ConnectionListener l)
l - the listener to add to the listpublic void removeConnectionListener(ConnectionListener l)
l - the listener to removeprotected void notifyConnectionListeners(int type)
type - the type of the action, CONNECT or DISCONNECTprotected void notifyConnectionListeners(int type,
java.lang.Exception ex)
type - the type of the action, CONNECT or DISCONNECTex - an optional exception that happened (indicates failure!)public void addHistoryChangedListener(HistoryChangedListener l)
l - the listener to add to the listpublic void removeHistoryChangedListener(HistoryChangedListener l)
l - the listener to removeprotected void notifyHistoryChangedListeners()
public void caretUpdate(javax.swing.event.CaretEvent event)
caretUpdate in interface javax.swing.event.CaretListenerevent - the event to process