edu.rice.cs.drjava.ui
Class AbstractConsoleController

java.lang.Object
  extended by edu.rice.cs.drjava.ui.AbstractConsoleController
Direct Known Subclasses:
ConsoleController, InteractionsController

public abstract class AbstractConsoleController
extends java.lang.Object

Abstract class that hooks a Swing console/interactions document with its Swing pane. TODO: move interactions specific functionality to InteractionsController by creating ConsoleDJDocument class

Version:
$Id: AbstractConsoleController.java 5360 2010-08-13 22:36:42Z mgricken $

Field Summary
protected  javax.swing.text.SimpleAttributeSet _defaultStyle
          Style to use for default text.
protected  InteractionsDJDocument _interactionsDJDocument
          Adapter for the Swing document used by the model.
protected  InteractionsPane _pane
          Pane from the view.
protected  javax.swing.text.SimpleAttributeSet _systemErrStyle
          Style to use for System.err.
protected  javax.swing.text.SimpleAttributeSet _systemOutStyle
          Style to use for System.out.
(package private)  javax.swing.AbstractAction clearCurrentAction
          Removes all text after the prompt.
(package private)  javax.swing.Action copyAction
          Default copy action.
(package private)  javax.swing.Action cutAction
          Default cut action.
(package private)  javax.swing.AbstractAction gotoEndAction
          Goes to the end of the current input line.
(package private)  javax.swing.AbstractAction gotoPromptPosAction
          Moves the caret to the prompt.
(package private)  javax.swing.AbstractAction newLineAction
          Inserts a new line at the caret position.
(package private)  javax.swing.AbstractAction selectToEndAction
          Selects to the end of the current input line.
(package private)  javax.swing.AbstractAction selectToPromptPosAction
          Selects to the current prompt.
(package private)  javax.swing.Action switchToNextPaneAction
          Action to change focus to next pane.
(package private)  javax.swing.Action switchToPrevPaneAction
          Action to change focus to previous pane.
 
Constructor Summary
protected AbstractConsoleController(InteractionsDJDocument doc, InteractionsPane pane)
          Initializes the Swing console document and Swing interactions pane.
 
Method Summary
protected  void _addDocumentStyles()
          Adds AttributeSets as named styles to the Swing console document.
protected  boolean _busy()
          Determines if the associated console pane is currently computing.
protected  void _init()
          Initialization method.
protected abstract  void _setupModel()
          Sets up the model.
protected  void _setupView()
          Sets up the view.
abstract  ConsoleDocument getConsoleDoc()
          Gets the console document for this console.
 InteractionsDJDocument getDocumentAdapter()
          Accessor method for the InteractionsDJDocument.
 InteractionsPane getPane()
          Accessor method for the InteractionsPane.
(package private)  void moveToEnd()
          Moves the pane's caret to the end of the document.
(package private)  void moveToPrompt()
          Moves the pane's caret to the document's prompt.
 void resetView()
          Clears and resets the view (other than features derived from the model.
 void setNextPaneAction(javax.swing.Action a)
           
 void setPrevPaneAction(javax.swing.Action a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_interactionsDJDocument

protected final InteractionsDJDocument _interactionsDJDocument
Adapter for the Swing document used by the model.


_pane

protected final InteractionsPane _pane
Pane from the view.


_defaultStyle

protected final javax.swing.text.SimpleAttributeSet _defaultStyle
Style to use for default text.


_systemOutStyle

protected final javax.swing.text.SimpleAttributeSet _systemOutStyle
Style to use for System.out.


_systemErrStyle

protected final javax.swing.text.SimpleAttributeSet _systemErrStyle
Style to use for System.err.


switchToPrevPaneAction

volatile javax.swing.Action switchToPrevPaneAction
Action to change focus to previous pane. Package private for testing purposes.


switchToNextPaneAction

volatile javax.swing.Action switchToNextPaneAction
Action to change focus to next pane.


cutAction

javax.swing.Action cutAction
Default cut action.


copyAction

javax.swing.Action copyAction
Default copy action.


newLineAction

javax.swing.AbstractAction newLineAction
Inserts a new line at the caret position.


clearCurrentAction

javax.swing.AbstractAction clearCurrentAction
Removes all text after the prompt.


gotoEndAction

javax.swing.AbstractAction gotoEndAction
Goes to the end of the current input line.


selectToEndAction

javax.swing.AbstractAction selectToEndAction
Selects to the end of the current input line.


gotoPromptPosAction

javax.swing.AbstractAction gotoPromptPosAction
Moves the caret to the prompt.


selectToPromptPosAction

javax.swing.AbstractAction selectToPromptPosAction
Selects to the current prompt.

Constructor Detail

AbstractConsoleController

protected AbstractConsoleController(InteractionsDJDocument doc,
                                    InteractionsPane pane)
Initializes the Swing console document and Swing interactions pane. Subclasses *must* call _init() at the end of their constructors.

Method Detail

getConsoleDoc

public abstract ConsoleDocument getConsoleDoc()
Gets the console document for this console.


_init

protected void _init()
Initialization method. *Must* be called in constructor by all subclasses.


_addDocumentStyles

protected void _addDocumentStyles()
Adds AttributeSets as named styles to the Swing console document.


_setupModel

protected abstract void _setupModel()
Sets up the model.


_setupView

protected void _setupView()
Sets up the view.


resetView

public void resetView()
Clears and resets the view (other than features derived from the model.


getDocumentAdapter

public InteractionsDJDocument getDocumentAdapter()
Accessor method for the InteractionsDJDocument.


getPane

public InteractionsPane getPane()
Accessor method for the InteractionsPane.


_busy

protected boolean _busy()
Determines if the associated console pane is currently computing.

Returns:
true iff the console is busy

moveToEnd

void moveToEnd()
Moves the pane's caret to the end of the document. Only affects reduced_model not the document model.


moveToPrompt

void moveToPrompt()
Moves the pane's caret to the document's prompt. Only affects reduced_model not the document model.


setPrevPaneAction

public void setPrevPaneAction(javax.swing.Action a)

setNextPaneAction

public void setNextPaneAction(javax.swing.Action a)