|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
org.objectweb.cjdbc.controller.console.GUIConsoleHelper
Graphical C-JDBC console that allows remote administration and monitoring of any C-JDBC controller.
This code has been inspired by the BeanShell Java Scripting project (http://www.beanshell.org/) by Patrick Niemeyer (pat@pat.net).
Nested Class Summary |
Nested classes inherited from class javax.swing.JFrame |
javax.swing.JFrame.AccessibleJFrame |
Nested classes inherited from class java.awt.Frame |
java.awt.Frame.AccessibleAWTFrame |
Nested classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
private static java.lang.String |
ADMIN_DISABLEALL
|
private static java.lang.String |
ADMIN_ENABLEALL
|
private static java.lang.String |
ADMIN_STATUS
|
private int |
cmdStart
Index for the command first character. |
private CommandCompletorInterface |
commandCompletor
Command completor to use. |
private static java.awt.Color |
COMPLETION_COLOR
Completion possibilities Color . |
private static java.lang.String |
CONTROLLER_ADD_DRIVER
|
private static java.lang.String |
CONTROLLER_CONNECT
|
private static java.lang.String |
CONTROLLER_GETDUMP
|
private static java.lang.String |
CONTROLLER_GETINFO
|
private static java.lang.String |
CONTROLLER_LOAD_CONFIG
|
private static java.lang.String |
COPY
|
private static java.lang.String |
CUT
Popup menu command. |
private boolean |
echo
true if the input must be displayed in the console. |
private static java.awt.Color |
ERROR_COLOR
Error message Color . |
private static java.awt.Font |
FONT
Console Font . |
private boolean |
gotUp
Hack to prevent key repeat for some reason? |
private static java.lang.String |
HELP
|
private int |
histLine
|
private java.util.ArrayList |
history
Contains the historic of commands. |
private java.lang.String |
lastAcceptedLine
Contains the last line entered in the console. |
private javax.swing.JPopupMenu |
menu
Popu menu. |
private java.lang.StringBuffer |
password
Contains the password entered in the console. |
private static java.lang.String |
PASTE
|
private static java.awt.Color |
PROMPT_COLOR
Console prompt Color . |
private static java.lang.String |
QUIT
|
private static int |
SHOW_AMBIG_MAX
Maximum number of the completion possibilities to display. |
private static java.lang.String |
SQL_LOAD_FILE
Popup menu command. |
private static java.lang.String |
SQL_SHOW_TABLE
|
private java.lang.String |
startedLine
|
private javax.swing.JTextPane |
text
Console panel. |
Fields inherited from class javax.swing.JFrame |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Frame |
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
Fields inherited from class java.awt.Window |
|
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
GUIConsoleHelper()
Creates a new GUIConsoleHelper instance. |
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent event)
|
private void |
append(java.lang.String string)
|
(package private) void |
doCommandCompletion(java.lang.String part)
|
private void |
enter()
|
private void |
forceCaretMoveToEnd()
|
private void |
forceCaretMoveToStart()
|
private java.lang.String |
getFilename(java.lang.String title)
|
private java.lang.String |
getLine()
|
javax.swing.text.AttributeSet |
getStyle()
Gets the current style. |
private void |
historyDown()
|
private void |
historyUp()
|
void |
keyPressed(java.awt.event.KeyEvent e)
|
void |
keyReleased(java.awt.event.KeyEvent e)
|
void |
keyTyped(java.awt.event.KeyEvent e)
|
void |
mouseClicked(java.awt.event.MouseEvent event)
|
void |
mouseEntered(java.awt.event.MouseEvent event)
|
void |
mouseExited(java.awt.event.MouseEvent event)
|
void |
mousePressed(java.awt.event.MouseEvent event)
|
void |
mouseReleased(java.awt.event.MouseEvent event)
|
void |
print(java.lang.String string)
Prints a String . |
void |
print(java.lang.String s,
java.awt.Color color)
Prints a given String in the console with the given color. |
void |
printError(java.lang.String message)
Prints an error message followed by a new line. |
void |
println()
Prints a new line. |
void |
println(java.lang.String string)
Prints a String followed by a new line. |
java.lang.String |
readLine(java.lang.String prompt)
Gets a command. |
java.lang.String |
readPassword(java.lang.String prompt)
Gets a password. |
private java.lang.String |
replaceRange(java.lang.Object s,
int start,
int end)
|
private void |
resetCommandStart()
|
void |
setCommandCompletor(CommandCompletorInterface completor)
Sets the command completor to use. |
void |
setFont(java.awt.Font font)
|
void |
setStyle(javax.swing.text.AttributeSet attributes)
Sets the new style attributes. |
void |
setStyle(javax.swing.text.AttributeSet attributes,
boolean overWrite)
Sets the new style attributes. |
javax.swing.text.AttributeSet |
setStyle(java.awt.Color color)
Sets the text color. |
private void |
showHistoryLine()
|
private int |
textLength()
|
private void |
type(java.awt.event.KeyEvent e)
|
Methods inherited from class javax.swing.JFrame |
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.awt.Frame |
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
Methods inherited from class java.awt.Window |
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, transferFocusBackward, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
getFont, postEvent |
Field Detail |
private static final java.lang.String CUT
private static final java.lang.String COPY
private static final java.lang.String PASTE
private static final java.lang.String HELP
private static final java.lang.String QUIT
private static final java.lang.String SQL_LOAD_FILE
private static final java.lang.String SQL_SHOW_TABLE
private static final java.lang.String ADMIN_STATUS
private static final java.lang.String ADMIN_ENABLEALL
private static final java.lang.String ADMIN_DISABLEALL
private static final java.lang.String CONTROLLER_CONNECT
private static final java.lang.String CONTROLLER_LOAD_CONFIG
private static final java.lang.String CONTROLLER_ADD_DRIVER
private static final java.lang.String CONTROLLER_GETINFO
private static final java.lang.String CONTROLLER_GETDUMP
private static final java.awt.Font FONT
Font
.
private static final java.awt.Color PROMPT_COLOR
Color
.
private static final java.awt.Color ERROR_COLOR
Color
.
private static final java.awt.Color COMPLETION_COLOR
Color
.
private static final int SHOW_AMBIG_MAX
private CommandCompletorInterface commandCompletor
private java.lang.String lastAcceptedLine
private java.lang.StringBuffer password
private java.lang.String startedLine
private int cmdStart
private java.util.ArrayList history
private int histLine
private javax.swing.JPopupMenu menu
private javax.swing.JTextPane text
private boolean gotUp
private boolean echo
true
if the input must be displayed in the console.
Constructor Detail |
public GUIConsoleHelper()
GUIConsoleHelper
instance.
Method Detail |
public java.lang.String readLine(java.lang.String prompt) throws ConsoleHelperException
ConsoleHelperInterface
readLine
in interface ConsoleHelperInterface
prompt
- the prompt to display
String
instance
ConsoleHelperException
- if an error occurs.ConsoleHelperInterface.readLine(java.lang.String)
public java.lang.String readPassword(java.lang.String prompt) throws ConsoleHelperException
ConsoleHelperInterface
readPassword
in interface ConsoleHelperInterface
prompt
- the prompt to display
String
instance
ConsoleHelperException
- if an error occurs.ConsoleHelperInterface.readPassword(java.lang.String)
public void println(java.lang.String string)
ConsoleHelperInterface
String
followed by a new line.
println
in interface ConsoleHelperInterface
string
- the String
to print.ConsoleHelperInterface.println(java.lang.String)
public void println()
ConsoleHelperInterface
println
in interface ConsoleHelperInterface
ConsoleHelperInterface.println()
public void print(java.lang.String string)
ConsoleHelperInterface
String
.
print
in interface ConsoleHelperInterface
string
- the String
to print.ConsoleHelperInterface.print(java.lang.String)
public void printError(java.lang.String message)
ConsoleHelperInterface
printError
in interface ConsoleHelperInterface
message
- the error message to print.ConsoleHelperInterface.printError(java.lang.String)
public void print(java.lang.String s, java.awt.Color color)
String
in the console with the given color.
s
- the String
to print.color
- the Color
to use.public void setCommandCompletor(CommandCompletorInterface completor)
ConsoleHelperInterface
setCommandCompletor
in interface ConsoleHelperInterface
completor
- a CommandCompletor
instance.ConsoleHelperInterface.setCommandCompletor(org.objectweb.cjdbc.controller.console.CommandCompletorInterface)
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
KeyListener.keyPressed(java.awt.event.KeyEvent)
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
KeyListener.keyTyped(java.awt.event.KeyEvent)
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
KeyListener.keyReleased(java.awt.event.KeyEvent)
private void type(java.awt.event.KeyEvent e)
public void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked
in interface java.awt.event.MouseListener
MouseListener.mouseClicked(java.awt.event.MouseEvent)
public void mousePressed(java.awt.event.MouseEvent event)
mousePressed
in interface java.awt.event.MouseListener
MouseListener.mousePressed(java.awt.event.MouseEvent)
public void mouseReleased(java.awt.event.MouseEvent event)
mouseReleased
in interface java.awt.event.MouseListener
MouseListener.mouseReleased(java.awt.event.MouseEvent)
public void mouseEntered(java.awt.event.MouseEvent event)
mouseEntered
in interface java.awt.event.MouseListener
MouseListener.mouseEntered(java.awt.event.MouseEvent)
public void mouseExited(java.awt.event.MouseEvent event)
mouseExited
in interface java.awt.event.MouseListener
MouseListener.mouseExited(java.awt.event.MouseEvent)
public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
ActionListener.actionPerformed(java.awt.event.ActionEvent)
void doCommandCompletion(java.lang.String part)
private void resetCommandStart()
private void append(java.lang.String string)
private java.lang.String replaceRange(java.lang.Object s, int start, int end)
private void forceCaretMoveToEnd()
private void forceCaretMoveToStart()
private void enter()
private java.lang.String getLine()
private void historyUp()
private void historyDown()
private void showHistoryLine()
private int textLength()
public javax.swing.text.AttributeSet setStyle(java.awt.Color color)
color
- the color to set.
public void setStyle(javax.swing.text.AttributeSet attributes)
attributes
- the attributes to set.public void setStyle(javax.swing.text.AttributeSet attributes, boolean overWrite)
attributes
- the attributes to set.overWrite
- if the attributes must be overwritten.public javax.swing.text.AttributeSet getStyle()
public void setFont(java.awt.Font font)
Component.setFont(Font)
private java.lang.String getFilename(java.lang.String title)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |