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 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 4691 2008-12-02 23:33:27Z dlsmith $

Field Summary
protected  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  SimpleAttributeSet _systemErrStyle
          Style to use for System.err.
protected  SimpleAttributeSet _systemOutStyle
          Style to use for System.out.
 
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.
protected  void _updateStyles(AttributeSet newSet)
          Updates all document styles with the attributes contained in newSet.
abstract  ConsoleDocument getConsoleDoc()
          Gets the console document for this console.
 InteractionsDJDocument getDocumentAdapter()
          Accessor method for the InteractionsDJDocument.
 InteractionsPane getPane()
          Accessor method for the InteractionsPane.
 void resetView()
          Clears and resets the view (other than features derived from the model.
 void setDefaultFont(Color c)
          Sets the color for the document, updating all existing text.
 void setDefaultFont(Font f)
          Sets the font for the document, updating all existing text.
 void setDefaultFont(Font f, Color c)
          Sets the font and color for the document, updating all existing text.
 void setNextPaneAction(Action a)
           
 void setPrevPaneAction(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 SimpleAttributeSet _defaultStyle
Style to use for default text.


_systemOutStyle

protected final SimpleAttributeSet _systemOutStyle
Style to use for System.out.


_systemErrStyle

protected final SimpleAttributeSet _systemErrStyle
Style to use for System.err.

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.


setDefaultFont

public void setDefaultFont(Font f)
Sets the font for the document, updating all existing text. This behavior is only necessary in Mac OS X, since setFont() works fine on JTextPane on all other tested platforms. This glitch in the Mac JVM still exists as of 11-28-06 in beta Java 6.0 build 88.

Parameters:
f - New font to use.

setDefaultFont

public void setDefaultFont(Color c)
Sets the color for the document, updating all existing text. This behavior is only necessary in Mac OS X, since changing the main font works on all other tested platforms.

Parameters:
c - New color to use.

setDefaultFont

public void setDefaultFont(Font f,
                           Color c)
Sets the font and color for the document, updating all existing text. This behavior is only necessary in Mac OS X, since setFont() and changing the main font works on all other tested platforms.

Parameters:
f - New font to use.
c - New color to use.

_updateStyles

protected void _updateStyles(AttributeSet newSet)
Updates all document styles with the attributes contained in newSet.

Parameters:
newSet - Style containing new attributes to use.

_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

setPrevPaneAction

public void setPrevPaneAction(Action a)

setNextPaneAction

public void setNextPaneAction(Action a)