public class SqlViewer extends JPanel implements ConnectionListener, HistoryChangedListener, QueryExecuteListener, ResultChangedListener
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static String |
HEIGHT
the height property in the history file.
|
protected static String |
HISTORY_FILE
the name of the history file (in the home directory).
|
protected ConnectionPanel |
m_ConnectionPanel
the connection panel.
|
protected Properties |
m_History
stores the history.
|
protected InfoPanel |
m_InfoPanel
the info panel.
|
protected JFrame |
m_Parent
the parent of this panel.
|
protected String |
m_Password
the password that was used to connect to the DB.
|
protected String |
m_Query
the currently selected query.
|
protected QueryPanel |
m_QueryPanel
the query panel.
|
protected ResultPanel |
m_ResultPanel
the result panel.
|
protected String |
m_URL
the connect string with which the query was run.
|
protected String |
m_User
the user that was used to connect to the DB.
|
static String |
WIDTH
the width property in the history file.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, PROPERTIES, SOMEBITS
Constructor and Description |
---|
SqlViewer(JFrame parent)
initializes the SqlViewer.
|
Modifier and Type | Method and Description |
---|---|
void |
addConnectionListener(ConnectionListener l)
adds the given listener to the list of listeners.
|
void |
addHistoryChangedListener(HistoryChangedListener l)
adds the given listener to the list of listeners.
|
void |
addQueryExecuteListener(QueryExecuteListener l)
adds the given listener to the list of listeners.
|
void |
addResultChangedListener(ResultChangedListener l)
adds the given listener to the list of listeners.
|
void |
clear()
calls the clear method of all sub-panels to set back to default values
and free up memory.
|
void |
connectionChange(ConnectionEvent evt)
This method gets called when the connection is either established
or disconnected.
|
protected void |
createPanel()
builds the interface.
|
protected String |
getHistoryFilename()
returns the filename of the history file.
|
String |
getPassword()
returns the password from the currently active tab in the ResultPanel,
otherwise an empty string.
|
String |
getQuery()
returns the query from the currently active tab in the ResultPanel,
otherwise an empty string.
|
String |
getURL()
returns the database URL from the currently active tab in the ResultPanel,
otherwise an empty string.
|
String |
getUser()
returns the user from the currently active tab in the ResultPanel,
otherwise an empty string.
|
void |
historyChanged(HistoryChangedEvent evt)
This method gets called when a history is modified.
|
protected void |
loadHistory(boolean set)
loads the history properties of the SqlViewer in the user's home directory.
|
static void |
main(String[] args)
starts the SQL-Viewer interface.
|
protected String |
modelToString(DefaultListModel m)
converts the given model into a comma-separated string.
|
void |
queryExecuted(QueryExecuteEvent evt)
This method gets called when a query has been executed.
|
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.
|
void |
removeQueryExecuteListener(QueryExecuteListener l)
removes the given listener from the list of listeners.
|
void |
removeResultChangedListener(ResultChangedListener l)
removes the given listener from the list of listeners.
|
void |
resultChanged(ResultChangedEvent evt)
This method gets called when a query has been executed.
|
protected void |
saveHistory()
saves the history properties of the SqlViewer in the user's home directory.
|
void |
saveSize()
obtains the size of the panel and saves it in the history.
|
protected DefaultListModel |
stringToModel(String s)
transforms the given, comma-separated string into a DefaultListModel.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
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
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, 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, transferFocusUpCycle
protected static final String HISTORY_FILE
public static final String WIDTH
public static final String HEIGHT
protected JFrame m_Parent
protected ConnectionPanel m_ConnectionPanel
protected QueryPanel m_QueryPanel
protected ResultPanel m_ResultPanel
protected InfoPanel m_InfoPanel
protected String m_URL
protected String m_User
protected String m_Password
protected String m_Query
protected Properties m_History
public SqlViewer(JFrame parent)
parent
- the parent of this panelprotected void createPanel()
public void connectionChange(ConnectionEvent evt)
connectionChange
in interface ConnectionListener
evt
- the eventpublic void queryExecuted(QueryExecuteEvent evt)
queryExecuted
in interface QueryExecuteListener
evt
- the eventpublic void resultChanged(ResultChangedEvent evt)
resultChanged
in interface ResultChangedListener
evt
- the eventpublic void historyChanged(HistoryChangedEvent evt)
historyChanged
in interface HistoryChangedListener
evt
- the eventprotected String getHistoryFilename()
protected DefaultListModel stringToModel(String s)
s
- the string to break up and transform into a list modelprotected String modelToString(DefaultListModel m)
m
- the model to convertprotected void loadHistory(boolean set)
set
- whether to set the read properties in the panels or notHISTORY_FILE
protected void saveHistory()
HISTORY_FILE
public void saveSize()
saveHistory()
public void clear()
public String getURL()
ResultPanel
public String getUser()
ResultPanel
public String getPassword()
ResultPanel
public String getQuery()
ResultPanel
public void addConnectionListener(ConnectionListener l)
l
- the listener to add to the listpublic void removeConnectionListener(ConnectionListener l)
l
- the listener to removepublic void addQueryExecuteListener(QueryExecuteListener l)
l
- the listener to add to the listpublic void removeQueryExecuteListener(QueryExecuteListener l)
l
- the listener to removepublic void addResultChangedListener(ResultChangedListener l)
l
- the listener to add to the listpublic void removeResultChangedListener(ResultChangedListener l)
l
- the listener to removepublic void addHistoryChangedListener(HistoryChangedListener l)
l
- the listener to add to the listpublic void removeHistoryChangedListener(HistoryChangedListener l)
l
- the listener to removepublic static void main(String[] args)
args
- the commandline arguments - ignoredCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.