public class ConsolePanel
extends javax.swing.JPanel
implements java.awt.event.KeyListener, javax.swing.event.DocumentListener, java.awt.event.ActionListener
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONSOLE_FONT_NAME |
static java.awt.Font |
CONSOLE_INPUT_FONT |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
ConsolePanel(MainControl mainControl,
ArgumentComponentManager argumentComponentManager)
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent ev) |
void |
addToHistory(java.lang.String input,
boolean forceInsertion)
Adds the given input to the input history.
|
void |
appendOutput(java.lang.String message)
Appends the given string to the GUI console output.
|
void |
changedUpdate(javax.swing.event.DocumentEvent ev) |
void |
enterInput(java.lang.String input,
boolean print,
boolean execute)
Treads the given input as if it was created by the user.
|
void |
enterTextFieldInput()
Executes the statement of the text field.
|
ExecutionReturn |
executeAndPrint(java.lang.String input)
Executes the given statement and prints the statement as well as, if existing, the execution result to the GUI
console output.
|
ConsoleInputField |
getConsoleInputField()
Returns the inner console input text field.
|
ConsoleUserInput |
getEnteredInput()
Returns the instance holding the last user input.
|
InputHistory |
getInputHistory()
Returns the input history.
|
java.lang.Object |
getQuitNotification()
Returns the object that is notified when a Quit is the result of an execution.
|
void |
insertUpdate(javax.swing.event.DocumentEvent ev) |
void |
keyPressed(java.awt.event.KeyEvent ev) |
void |
keyReleased(java.awt.event.KeyEvent ev) |
void |
keyTyped(java.awt.event.KeyEvent ev) |
void |
removeUpdate(javax.swing.event.DocumentEvent ev) |
void |
saveHistory()
Saves the input history to the file which was previously set using setInputHistoryFile.
|
void |
setFocus()
Sets the focus to the input text field.
|
void |
setInputHistoryFile(java.io.File file)
Sets the given file to load and save the input history.
|
void |
setInputText(java.lang.String line)
Sets the text of the console input field.
|
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
public static final java.lang.String CONSOLE_FONT_NAME
public static final java.awt.Font CONSOLE_INPUT_FONT
public ConsolePanel(MainControl mainControl, ArgumentComponentManager argumentComponentManager)
mainControl
- the main control of GraphanaargumentComponentManager
- the argument component manager to create argument componentspublic ExecutionReturn executeAndPrint(java.lang.String input)
input
- the input to executepublic void addToHistory(java.lang.String input, boolean forceInsertion)
input
- the input to insertforceInsertion
- if true, then the input will always be inserted. If false, then its only inserted if it
is not present in the history yet.public void enterInput(java.lang.String input, boolean print, boolean execute)
input
- the input to simulateprint
- if true, the input will be printed in the GUI console output and added to the input history.execute
- if true, the input will be executed.public void enterTextFieldInput()
public void appendOutput(java.lang.String message)
public void setInputHistoryFile(java.io.File file)
public void saveHistory() throws java.io.IOException
java.io.IOException
public InputHistory getInputHistory()
public void setFocus()
public java.lang.Object getQuitNotification()
public ConsoleUserInput getEnteredInput()
public void setInputText(java.lang.String line)
public ConsoleInputField getConsoleInputField()
public void keyPressed(java.awt.event.KeyEvent ev)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent ev)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent ev)
keyTyped
in interface java.awt.event.KeyListener
public void changedUpdate(javax.swing.event.DocumentEvent ev)
changedUpdate
in interface javax.swing.event.DocumentListener
public void insertUpdate(javax.swing.event.DocumentEvent ev)
insertUpdate
in interface javax.swing.event.DocumentListener
public void removeUpdate(javax.swing.event.DocumentEvent ev)
removeUpdate
in interface javax.swing.event.DocumentListener
public void actionPerformed(java.awt.event.ActionEvent ev)
actionPerformed
in interface java.awt.event.ActionListener