adams.gui.tools
Class RConsolePanel

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 adams.gui.core.BasePanel
                      extended by adams.gui.tools.RConsolePanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, org.rosuda.JRI.RMainLoopCallbacks

public class RConsolePanel
extends BasePanel
implements org.rosuda.JRI.RMainLoopCallbacks

Acts as an interface with the R shell.

Version:
$Revision$
Author:
rsmith
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  RConsoleFilter m_Filter
           
protected  RConsoleKeyListener m_Listener
           
protected  BaseTextArea m_TextArea
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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
RConsolePanel()
           
 
Method Summary
protected  void initGUI()
          Initializes the GUI.
 void moveCursor(int location)
          Moves the caret to the specified location.
 void rBusy(org.rosuda.JRI.Rengine re, int which)
          Called by the REngine to let the user know when R is busy.
 String rChooseFile(org.rosuda.JRI.Rengine re, int newFile)
          Called by the REngine when R wants the user to choose a file.
 void rFlushConsole(org.rosuda.JRI.Rengine re)
          Called by the REngine when R requests the console to flush any buffered output.
 void rLoadHistory(org.rosuda.JRI.Rengine re, String filename)
          Called by the REngine to load the contents of the history.
 String rReadConsole(org.rosuda.JRI.Rengine re, String prompt, int addToHistory)
          Called by REngine to read a line of input from the user.
 void rSaveHistory(org.rosuda.JRI.Rengine re, String filename)
          Called by the REngine to save the contents of the history.
 void rShowMessage(org.rosuda.JRI.Rengine re, String message)
          Called by the REngine when R wants to show a warning/error message to the user.
 void rWriteConsole(org.rosuda.JRI.Rengine re, String text, int oType)
          Called by REngine to write some text to the console.
 
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, finishInit, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initialize, main, setParentTitle, setVisible
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
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, 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, 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, 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, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_TextArea

protected BaseTextArea m_TextArea

m_Filter

protected RConsoleFilter m_Filter

m_Listener

protected RConsoleKeyListener m_Listener
Constructor Detail

RConsolePanel

public RConsolePanel()
Method Detail

initGUI

protected void initGUI()
Initializes the GUI.

Overrides:
initGUI in class BasePanel

moveCursor

public void moveCursor(int location)
Moves the caret to the specified location.

Parameters:
location - a position in the sequence of characters

rWriteConsole

public void rWriteConsole(org.rosuda.JRI.Rengine re,
                          String text,
                          int oType)
Called by REngine to write some text to the console.

Specified by:
rWriteConsole in interface org.rosuda.JRI.RMainLoopCallbacks
Parameters:
re - the calling engine
text - string to be output to the console
oType - output type (0=regular, 1=error/warning)

rReadConsole

public String rReadConsole(org.rosuda.JRI.Rengine re,
                           String prompt,
                           int addToHistory)
Called by REngine to read a line of input from the user.

Specified by:
rReadConsole in interface org.rosuda.JRI.RMainLoopCallbacks
Parameters:
re - the calling engine
prompt - the prompt to be shown to the user before taking input
addToHistory - flag telling the handler whether the input should be considered for adding to history
Returns:
users input to be passed to R

rBusy

public void rBusy(org.rosuda.JRI.Rengine re,
                  int which)
Called by the REngine to let the user know when R is busy.

Specified by:
rBusy in interface org.rosuda.JRI.RMainLoopCallbacks
Parameters:
re - the calling engine
which - identifies whether R enters (1) or exits (0) the busy state

rShowMessage

public void rShowMessage(org.rosuda.JRI.Rengine re,
                         String message)
Called by the REngine when R wants to show a warning/error message to the user.

Specified by:
rShowMessage in interface org.rosuda.JRI.RMainLoopCallbacks
Parameters:
re - the calling engine
message - the message

rChooseFile

public String rChooseFile(org.rosuda.JRI.Rengine re,
                          int newFile)
Called by the REngine when R wants the user to choose a file.

Specified by:
rChooseFile in interface org.rosuda.JRI.RMainLoopCallbacks
Parameters:
re - the calling engine
newFile - flag determining whether a new or existing file is to be selected
Returns:
path/name of the selected file

rFlushConsole

public void rFlushConsole(org.rosuda.JRI.Rengine re)
Called by the REngine when R requests the console to flush any buffered output.

Specified by:
rFlushConsole in interface org.rosuda.JRI.RMainLoopCallbacks
Parameters:
re - the calling engine

rSaveHistory

public void rSaveHistory(org.rosuda.JRI.Rengine re,
                         String filename)
Called by the REngine to save the contents of the history.

Specified by:
rSaveHistory in interface org.rosuda.JRI.RMainLoopCallbacks
Parameters:
re - the calling engine
filename - name of the history file

rLoadHistory

public void rLoadHistory(org.rosuda.JRI.Rengine re,
                         String filename)
Called by the REngine to load the contents of the history.

Specified by:
rLoadHistory in interface org.rosuda.JRI.RMainLoopCallbacks
Parameters:
re - the calling engine
filename - name of the history file


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.