public class JadeConsole
extends javax.swing.JScrollPane
implements bsh.util.GUIConsoleInterface, java.lang.Runnable, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.ActionListener, java.beans.PropertyChangeListener
This is a descendant of the old AWTConsole. Improvements by: Mark Donszelmann {Mark.Donszelmann@cern.ch} including Cut and Paste
Improvements by: Daniel Leuck including Color and Image support, key press bug workaround.
Patch by: Francisco Jose Aguayo nameCompletion inside Windows OS.
Modifier and Type | Class and Description |
---|---|
static class |
JadeConsole.BlockingPipedInputStream
The overridden read method in this class will not throw "Broken pipe"
IOExceptions; It will simply wait for new writers and data.
|
javax.swing.JScrollPane.AccessibleJScrollPane, javax.swing.JScrollPane.ScrollBar
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
private boolean |
asyncMode |
int |
cmdStart |
private static java.lang.String |
COPY |
private static java.lang.String |
CUT |
private javax.swing.text.DefaultStyledDocument |
doc |
private boolean |
gotUp |
int |
histLine |
java.util.Vector<java.lang.String> |
history |
private java.io.InputStream |
in |
private java.io.InputStream |
inPipe |
private javax.swing.JPopupMenu |
menu |
(package private) bsh.util.NameCompletion |
nameCompletion |
private java.io.PrintStream |
out |
private java.io.OutputStream |
outPipe |
private static java.lang.String |
PASTE |
private static long |
serialVersionUID |
(package private) int |
SHOW_AMBIG_MAX |
java.lang.String |
startedLine |
javax.swing.JTextPane |
text |
(package private) java.lang.String |
ZEROS |
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
Constructor and Description |
---|
JadeConsole() |
JadeConsole(java.io.InputStream cin,
java.io.OutputStream cout) |
Modifier and Type | Method and Description |
---|---|
private void |
acceptLine(java.lang.String line) |
void |
actionPerformed(java.awt.event.ActionEvent event) |
private void |
append(java.lang.String string) |
void |
clearText() |
private void |
doCommandCompletion(java.lang.String part) |
private void |
enter() |
void |
error(java.lang.Object o) |
private void |
forceCaretMoveToEnd() |
private void |
forceCaretMoveToStart() |
private java.lang.String |
getCmd() |
javax.swing.text.DefaultStyledDocument |
getDoc() |
java.io.PrintStream |
getErr() |
java.io.Reader |
getIn() |
java.io.InputStream |
getInputStream() |
java.io.PrintStream |
getOut() |
private javax.swing.text.AttributeSet |
getStyle() |
private void |
historyDown() |
private void |
historyUp() |
private void |
inPipeWatcher() |
private void |
invokeAndWait(java.lang.Runnable run)
If not in the event thread run via SwingUtilities.invokeAndWait()
|
boolean |
isAsyncMode() |
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(javax.swing.Icon icon) |
void |
print(java.lang.Object o) |
void |
print(java.lang.Object s,
java.awt.Color color) |
void |
print(java.lang.Object s,
java.awt.Font font) |
void |
print(java.lang.Object o,
java.awt.Font font,
java.awt.Color color) |
void |
print(java.lang.Object s,
java.lang.String fontFamilyName,
int size,
java.awt.Color color) |
void |
print(java.lang.Object o,
java.lang.String fontFamilyName,
int size,
java.awt.Color color,
boolean bold,
boolean italic,
boolean underline) |
void |
println()
Prints "\\n" (i.e. newline)
|
void |
println(javax.swing.Icon icon) |
void |
println(java.lang.Object o) |
void |
propertyChange(java.beans.PropertyChangeEvent event) |
private java.lang.String |
replaceRange(java.lang.Object s,
int start,
int end) |
void |
requestFocus() |
private void |
resetCommandStart() |
void |
run() |
void |
setAsyncMode(boolean asyncMode) |
private javax.swing.text.DefaultStyledDocument |
setDoc(javax.swing.text.DefaultStyledDocument doc) |
void |
setFont(java.awt.Font font) |
void |
setNameCompletion(bsh.util.NameCompletion nc) |
private void |
setStyle(javax.swing.text.AttributeSet attributes) |
private void |
setStyle(javax.swing.text.AttributeSet attributes,
boolean overWrite) |
private javax.swing.text.AttributeSet |
setStyle(java.awt.Color color) |
private javax.swing.text.AttributeSet |
setStyle(java.awt.Font font) |
private javax.swing.text.AttributeSet |
setStyle(java.awt.Font font,
java.awt.Color color) |
private javax.swing.text.AttributeSet |
setStyle(java.lang.String fontFamilyName,
int size,
java.awt.Color color) |
private javax.swing.text.AttributeSet |
setStyle(java.lang.String fontFamilyName,
int size,
java.awt.Color color,
boolean bold,
boolean italic,
boolean underline) |
void |
setWaitFeedback(boolean on) |
private void |
showHistoryLine() |
private int |
textLength() |
java.lang.String |
toString() |
private void |
type(java.awt.event.KeyEvent e) |
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, 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, 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, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, 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, 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, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
private static final long serialVersionUID
private static final java.lang.String CUT
private static final java.lang.String COPY
private static final java.lang.String PASTE
private java.io.OutputStream outPipe
private java.io.InputStream inPipe
private java.io.InputStream in
private java.io.PrintStream out
public int cmdStart
public java.util.Vector<java.lang.String> history
public java.lang.String startedLine
public int histLine
private javax.swing.JPopupMenu menu
public javax.swing.JTextPane text
private javax.swing.text.DefaultStyledDocument doc
bsh.util.NameCompletion nameCompletion
final int SHOW_AMBIG_MAX
private boolean gotUp
private boolean asyncMode
java.lang.String ZEROS
public JadeConsole()
public JadeConsole(java.io.InputStream cin, java.io.OutputStream cout)
public java.io.InputStream getInputStream()
public java.io.Reader getIn()
getIn
in interface bsh.ConsoleInterface
public java.io.PrintStream getOut()
getOut
in interface bsh.ConsoleInterface
public java.io.PrintStream getErr()
getErr
in interface bsh.ConsoleInterface
public void requestFocus()
requestFocus
in class javax.swing.JComponent
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
private void type(java.awt.event.KeyEvent e)
private 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 getCmd()
private void historyUp()
private void historyDown()
private void showHistoryLine()
private void acceptLine(java.lang.String line)
public void println(java.lang.Object o)
println
in interface bsh.ConsoleInterface
public void print(java.lang.Object o)
print
in interface bsh.ConsoleInterface
public void println()
public void error(java.lang.Object o)
error
in interface bsh.ConsoleInterface
public void println(javax.swing.Icon icon)
public void print(javax.swing.Icon icon)
public void print(java.lang.Object s, java.awt.Font font)
public void print(java.lang.Object s, java.awt.Color color)
print
in interface bsh.util.GUIConsoleInterface
public void print(java.lang.Object o, java.awt.Font font, java.awt.Color color)
public void print(java.lang.Object s, java.lang.String fontFamilyName, int size, java.awt.Color color)
public void print(java.lang.Object o, java.lang.String fontFamilyName, int size, java.awt.Color color, boolean bold, boolean italic, boolean underline)
private javax.swing.text.AttributeSet setStyle(java.awt.Font font)
private javax.swing.text.AttributeSet setStyle(java.awt.Color color)
private javax.swing.text.AttributeSet setStyle(java.awt.Font font, java.awt.Color color)
private javax.swing.text.AttributeSet setStyle(java.lang.String fontFamilyName, int size, java.awt.Color color)
private javax.swing.text.AttributeSet setStyle(java.lang.String fontFamilyName, int size, java.awt.Color color, boolean bold, boolean italic, boolean underline)
private void setStyle(javax.swing.text.AttributeSet attributes)
private void setStyle(javax.swing.text.AttributeSet attributes, boolean overWrite)
private javax.swing.text.AttributeSet getStyle()
public void setFont(java.awt.Font font)
setFont
in class javax.swing.JComponent
private void inPipeWatcher() throws java.io.IOException
java.io.IOException
public void run()
run
in interface java.lang.Runnable
public java.lang.String toString()
toString
in class java.awt.Component
public void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent event)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent event)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent event)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent event)
mouseExited
in interface java.awt.event.MouseListener
public void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
private void invokeAndWait(java.lang.Runnable run)
public void setNameCompletion(bsh.util.NameCompletion nc)
setNameCompletion
in interface bsh.util.GUIConsoleInterface
public void setWaitFeedback(boolean on)
setWaitFeedback
in interface bsh.util.GUIConsoleInterface
private int textLength()
public javax.swing.text.DefaultStyledDocument getDoc()
public void clearText()
private javax.swing.text.DefaultStyledDocument setDoc(javax.swing.text.DefaultStyledDocument doc)
public boolean isAsyncMode()
public void setAsyncMode(boolean asyncMode)