proper.gui.core.panel
Class DatabasePanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by proper.gui.core.panel.ProperPanel
                      extended by proper.gui.core.panel.DatabasePanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, javax.swing.event.DocumentListener

public class DatabasePanel
extends ProperPanel

This Panel represents an easy way to connect to a database.
It supports PropertyChangeListeners for the names database and table, if other components should react to changes.
The two buttons "Connect" and "Select" also fire Property Changes, where the propertyName of the Event contains the action command of the button.

Version:
$Revision: 1.2 $
Author:
FracPete
See Also:
ACTION_CONNECT, ACTION_SELECTDATABASE, ACTION_SELECTTABLE, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
static java.lang.String ACTION_CONNECT
          the action of the Connect-Button
static java.lang.String ACTION_SELECTDATABASE
          the action of the Select-Button (Database)
static java.lang.String ACTION_SELECTTABLE
          the action of the Select-Button (Table)
static java.lang.String PROPERTY_COLUMN
          the column property
static java.lang.String PROPERTY_DATABASE
          the database property
static java.lang.String PROPERTY_TABLE
          the table property
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
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
DatabasePanel()
          initializes the panel
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          invoked when an action occurs
 void addActionListener(java.awt.event.ActionListener listener)
          adds the given listener to the buttons
 void addConnectorChangeListener(ConnectorChangeListener listener)
          adds the keylistener for the buttons
 void addKeyListener(java.awt.event.KeyListener listener)
          adds the keylistener for the buttons
 void addSizeChangeListener(SizeChangeListener listener)
          adds the keylistener for the buttons
 java.lang.String getColumn()
          returns the column
 Connector getConnector()
          returns the connector instance being used
 java.lang.String getDatabase()
          returns the database
 java.util.Vector getDatabases()
          returns all available databases (if connected!)
 java.lang.String getDriver()
          returns the driver for connecting
 java.lang.String getExcludes()
          returns the patterns for excluding tables
 java.lang.String getPassword()
          returns the password of the user
 java.lang.String getPreferredColumn()
          returns the preferred column
 java.lang.String getPreferredDatabase()
          returns the preferred database
 java.lang.String getPreferredTable()
          returns the preferred table
 boolean getShowColumns()
          returns whether the columns are displayed
 boolean getShowConnect()
          returns whether the driver is displayed
 boolean getShowDriver()
          returns whether the connect-part is displayed
 boolean getShowTables()
          returns whether the tables are displayed
 java.lang.String getTable()
          returns the table
 java.util.Vector getTables()
          returns all available tables (if connected!)
 java.lang.String getUrl()
          returns the connection URL
 java.lang.String getUser()
          returns the user used for connecting to the DB
 void invalidate()
          Invalidates the container.
 void itemStateChanged(java.awt.event.ItemEvent e)
          Invoked when an item has been selected or deselected by the user.
 void removeActionListener(java.awt.event.ActionListener listener)
          removes the given listener to the buttons
 void removeConnectorChangeListener(ConnectorChangeListener listener)
          removes the given listener for connector changes
 void removeKeyListener(java.awt.event.KeyListener listener)
          removes the keylistener for the buttons
 void removeSizeChangeListener(SizeChangeListener listener)
          removes the given listener for size changes
 void setColumn(java.lang.String column)
          sets the column
 void setConnector(Connector conn)
          sets the connector object to use (instead of instantiating one)
 void setDatabase(java.lang.String database)
          sets the database
 void setDriver(java.lang.String driver)
          sets the driver to use for connecting
 void setExcludes(java.lang.String excludes)
          sets the patterns for excluding tables
 void setPassword(java.lang.String password)
          sets the password of the user
 void setPreferredColumn(java.lang.String preferredColumn)
          sets the preferred column, which is preselected after connecting (if it can be found)
 void setPreferredDatabase(java.lang.String preferredDatabase)
          sets the preferred database, which is preselected after connecting (if it can be found)
 void setPreferredTable(java.lang.String preferredTable)
          sets the preferred table, which is preselected after connecting (if it can be found)
 void setShowColumns(boolean show)
          sets whether the columns should be displayed or not
 void setShowConnect(boolean show)
          sets whether the connect-part should be displayed or not
 void setShowDriver(boolean show)
          sets whether the driver should be displayed or not
 void setShowTables(boolean show)
          sets whether the tables should be displayed or not
 void setTable(java.lang.String table)
          sets the table
 void setUrl(java.lang.String url)
          sets the connection URL
 void setUser(java.lang.String user)
          sets the user to use for connecting to the DB
 
Methods inherited from class proper.gui.core.panel.ProperPanel
changedUpdate, getTitle, hasBorder, insertUpdate, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, removeUpdate, setActionListener, setBorder, setKeyListener, setTitle, showMessageBox, showMessageBox, stateChanged
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, hide, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTION_CONNECT

public static final java.lang.String ACTION_CONNECT
the action of the Connect-Button

See Also:
Constant Field Values

ACTION_SELECTDATABASE

public static final java.lang.String ACTION_SELECTDATABASE
the action of the Select-Button (Database)

See Also:
Constant Field Values

ACTION_SELECTTABLE

public static final java.lang.String ACTION_SELECTTABLE
the action of the Select-Button (Table)

See Also:
Constant Field Values

PROPERTY_DATABASE

public static final java.lang.String PROPERTY_DATABASE
the database property

See Also:
Constant Field Values

PROPERTY_TABLE

public static final java.lang.String PROPERTY_TABLE
the table property

See Also:
Constant Field Values

PROPERTY_COLUMN

public static final java.lang.String PROPERTY_COLUMN
the column property

See Also:
Constant Field Values
Constructor Detail

DatabasePanel

public DatabasePanel()
initializes the panel

Method Detail

invalidate

public void invalidate()
Invalidates the container.

Overrides:
invalidate in class java.awt.Container

setConnector

public void setConnector(Connector conn)
sets the connector object to use (instead of instantiating one)


getConnector

public Connector getConnector()
returns the connector instance being used


setDriver

public void setDriver(java.lang.String driver)
sets the driver to use for connecting


getDriver

public java.lang.String getDriver()
returns the driver for connecting


setUrl

public void setUrl(java.lang.String url)
sets the connection URL


getUrl

public java.lang.String getUrl()
returns the connection URL


setUser

public void setUser(java.lang.String user)
sets the user to use for connecting to the DB


getUser

public java.lang.String getUser()
returns the user used for connecting to the DB


setPassword

public void setPassword(java.lang.String password)
sets the password of the user


getPassword

public java.lang.String getPassword()
returns the password of the user


setExcludes

public void setExcludes(java.lang.String excludes)
sets the patterns for excluding tables


getExcludes

public java.lang.String getExcludes()
returns the patterns for excluding tables


setShowDriver

public void setShowDriver(boolean show)
sets whether the driver should be displayed or not


getShowDriver

public boolean getShowDriver()
returns whether the connect-part is displayed


setShowConnect

public void setShowConnect(boolean show)
sets whether the connect-part should be displayed or not


getShowConnect

public boolean getShowConnect()
returns whether the driver is displayed


setShowTables

public void setShowTables(boolean show)
sets whether the tables should be displayed or not


getShowTables

public boolean getShowTables()
returns whether the tables are displayed


setShowColumns

public void setShowColumns(boolean show)
sets whether the columns should be displayed or not


getShowColumns

public boolean getShowColumns()
returns whether the columns are displayed


setDatabase

public void setDatabase(java.lang.String database)
sets the database


getDatabase

public java.lang.String getDatabase()
returns the database


setPreferredDatabase

public void setPreferredDatabase(java.lang.String preferredDatabase)
sets the preferred database, which is preselected after connecting (if it can be found)


getPreferredDatabase

public java.lang.String getPreferredDatabase()
returns the preferred database


getDatabases

public java.util.Vector getDatabases()
returns all available databases (if connected!)


setTable

public void setTable(java.lang.String table)
sets the table


getTable

public java.lang.String getTable()
returns the table


setPreferredTable

public void setPreferredTable(java.lang.String preferredTable)
sets the preferred table, which is preselected after connecting (if it can be found)


getPreferredTable

public java.lang.String getPreferredTable()
returns the preferred table


getTables

public java.util.Vector getTables()
returns all available tables (if connected!)


setColumn

public void setColumn(java.lang.String column)
sets the column


getColumn

public java.lang.String getColumn()
returns the column


setPreferredColumn

public void setPreferredColumn(java.lang.String preferredColumn)
sets the preferred column, which is preselected after connecting (if it can be found)


getPreferredColumn

public java.lang.String getPreferredColumn()
returns the preferred column


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
invoked when an action occurs

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Overrides:
actionPerformed in class ProperPanel

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Invoked when an item has been selected or deselected by the user.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Overrides:
itemStateChanged in class ProperPanel

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
removes the given listener to the buttons


addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
adds the given listener to the buttons


removeKeyListener

public void removeKeyListener(java.awt.event.KeyListener listener)
removes the keylistener for the buttons

Overrides:
removeKeyListener in class java.awt.Component

addKeyListener

public void addKeyListener(java.awt.event.KeyListener listener)
adds the keylistener for the buttons

Overrides:
addKeyListener in class java.awt.Component

removeSizeChangeListener

public void removeSizeChangeListener(SizeChangeListener listener)
removes the given listener for size changes


addSizeChangeListener

public void addSizeChangeListener(SizeChangeListener listener)
adds the keylistener for the buttons


removeConnectorChangeListener

public void removeConnectorChangeListener(ConnectorChangeListener listener)
removes the given listener for connector changes


addConnectorChangeListener

public void addConnectorChangeListener(ConnectorChangeListener listener)
adds the keylistener for the buttons