edu.rice.cs.drjava.ui
Class InteractionsController

java.lang.Object
  extended by edu.rice.cs.drjava.ui.AbstractConsoleController
      extended by edu.rice.cs.drjava.ui.InteractionsController

public class InteractionsController
extends AbstractConsoleController

This class installs listeners and actions between an InteractionsDocument (the model) and an InteractionsPane (the view). We may want to refactor this class into a different package.

(The PopupConsole was introduced in version 1.29 of this file and subsequently removed.)

Version:
$Id: InteractionsController.java 4691 2008-12-02 23:33:27Z dlsmith $

Nested Class Summary
static interface InteractionsController.ConsoleStateListener
          A listener interface that allows for others outside the interactions controller to be notified when the input console is enabled in the interactions pane.
 
Field Summary
protected  InputListener _inputListener
          Listens for input requests from System.in, displaying an input box as needed.
static String INPUT_BOX_STYLE
          Style for System.in box
static String INPUT_BOX_SYMBOL
          The symbol used in the document for the input box.
 
Fields inherited from class edu.rice.cs.drjava.ui.AbstractConsoleController
_defaultStyle, _interactionsDJDocument, _pane, _systemErrStyle, _systemOutStyle
 
Constructor Summary
InteractionsController(InteractionsModel model, InteractionsDJDocument adapter)
          Glue together the given model and a new view.
InteractionsController(InteractionsModel model, InteractionsDJDocument adapter, InteractionsPane pane)
          Glue together the given model and view.
 
Method Summary
protected  void _addDocumentStyles()
          Adds AttributeSets as named styles to the document adapter.
protected  void _setupModel()
          Adds listeners to the model.
protected  void _setupView()
          Adds actions to the view.
protected  void _updateStyles(AttributeSet newSet)
          Updates all document styles with the attributes contained in newSet.
 void addConsoleStateListener(InteractionsController.ConsoleStateListener listener)
           
 ConsoleDocument getConsoleDoc()
          Allows the abstract superclass to use the document.
 InteractionsDocument getDocument()
          Accessor method for the InteractionsDocument.
 InputListener getInputListener()
          Gets the input listener for console input requests.
 InteractionsModel getInteractionsModel()
          Accessor method for the InteractionsModel.
 void insertConsoleText(String input)
          Inserts text into the console.
 void interruptConsoleInput()
          Forces console input to complete without the user hitting .
 void removeConsoleStateListener(InteractionsController.ConsoleStateListener listener)
           
 
Methods inherited from class edu.rice.cs.drjava.ui.AbstractConsoleController
_busy, _init, getDocumentAdapter, getPane, resetView, setDefaultFont, setDefaultFont, setDefaultFont, setNextPaneAction, setPrevPaneAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INPUT_BOX_STYLE

public static final String INPUT_BOX_STYLE
Style for System.in box

See Also:
Constant Field Values

INPUT_BOX_SYMBOL

public static final String INPUT_BOX_SYMBOL
The symbol used in the document for the input box.

See Also:
Constant Field Values

_inputListener

protected volatile InputListener _inputListener
Listens for input requests from System.in, displaying an input box as needed.

Constructor Detail

InteractionsController

public InteractionsController(InteractionsModel model,
                              InteractionsDJDocument adapter)
Glue together the given model and a new view.

Parameters:
model - An InteractionsModel
adapter - InteractionsDJDocument being used by the model's doc

InteractionsController

public InteractionsController(InteractionsModel model,
                              InteractionsDJDocument adapter,
                              InteractionsPane pane)
Glue together the given model and view.

Parameters:
model - An InteractionsModel
adapter - InteractionsDJDocument being used by the model's doc
pane - An InteractionsPane
Method Detail

addConsoleStateListener

public void addConsoleStateListener(InteractionsController.ConsoleStateListener listener)

removeConsoleStateListener

public void removeConsoleStateListener(InteractionsController.ConsoleStateListener listener)

getInputListener

public InputListener getInputListener()
Gets the input listener for console input requests. ONLY used in unit tests.

Returns:
the input listener for console input requests.

interruptConsoleInput

public void interruptConsoleInput()
Forces console input to complete without the user hitting . Called by MainFrame when reset is called so that this lock is released. This method is thread safe.

Throws:
UnsupportedOperationException - If the interactions pane is not receiving console input

insertConsoleText

public void insertConsoleText(String input)
Inserts text into the console. Can only be called from the event thread. ONLY used in unit tests.

Parameters:
input - The text to insert into the console input box
Throws:
UnsupportedOperationException - If the the interactions pane is not receiving console input

getInteractionsModel

public InteractionsModel getInteractionsModel()
Accessor method for the InteractionsModel.

Returns:
the interactions model

getConsoleDoc

public ConsoleDocument getConsoleDoc()
Allows the abstract superclass to use the document.

Specified by:
getConsoleDoc in class AbstractConsoleController
Returns:
the InteractionsDocument

getDocument

public InteractionsDocument getDocument()
Accessor method for the InteractionsDocument.


_addDocumentStyles

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

Overrides:
_addDocumentStyles in class AbstractConsoleController

_updateStyles

protected void _updateStyles(AttributeSet newSet)
Updates all document styles with the attributes contained in newSet. This behavior is only used in Mac OS X, JDK 1.4.1, since setFont() works fine on JTextPane on all other tested platforms.

Overrides:
_updateStyles in class AbstractConsoleController
Parameters:
newSet - Style containing new attributes to use.

_setupModel

protected void _setupModel()
Adds listeners to the model.

Specified by:
_setupModel in class AbstractConsoleController

_setupView

protected void _setupView()
Adds actions to the view.

Overrides:
_setupView in class AbstractConsoleController