|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.drjava.ui.AbstractConsoleController
edu.rice.cs.drjava.ui.InteractionsController
public class InteractionsController
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.)
| 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. |
private static class |
InteractionsController.InputBox
A box that can be inserted into the interactions pane for separate input. |
| Field Summary | |
|---|---|
private InteractionsController.InputBox |
_box
A temporary variable used to hold a box allocated inside getConsoleInput below. |
private ArrayList<InteractionsController.ConsoleStateListener> |
_consoleStateListeners
|
private SimpleAttributeSet |
_debugStyle
Style to use for debug messages. |
private static Runnable |
_defaultInputCompletionCommand
Default implementation of the input completion command |
private static Lambda<String,String> |
_defaultInsertTextCommand
Default implementation of the insert text in input command |
private Runnable |
_disableCloseSystemInMenuItemCommand
Runnable command that disables the "Close System.in" menu command. |
private InteractionsDocument |
_doc
GUI-agnostic interactions document from the model. |
private boolean |
_endOfStream
A variable indicating whether the input stream has been closed. |
private SimpleAttributeSet |
_errStyle
Style to use for error messages. |
private Runnable |
_inputCompletionCommand
Runnable command used to force the System.in input to complete |
protected InputListener |
_inputListener
Listens for input requests from System.in, displaying an input box as needed. |
private Lambda<String,String> |
_insertTextCommand
Lambda used to input text into the embedded System.in input box. |
private OptionListener<Vector<KeyStroke>> |
_keyBindingOptionListener
OptionListener responding to changes for the undo/redo key bindings. |
private InteractionsModel |
_model
InteractionsModel to handle interpretation. |
private DelegatingAction |
_redoAction
|
private String |
_result
A temporary variable used to hold the result fetched from _box in getConsoleInput below. |
private DelegatingAction |
_undoAction
|
private ArrayList<FocusListener> |
_undoRedoInteractionFocusListeners
|
private InteractionsListener |
_viewListener
|
(package private) Action |
defaultDownAction
|
(package private) Action |
defaultUpAction
|
(package private) AbstractAction |
evalAction
Evaluates the interaction on the current line. |
(package private) AbstractAction |
historyForwardSearchAction
Forward searches in the history. |
(package private) AbstractAction |
historyNextAction
Recalls the next command from the history. |
(package private) AbstractAction |
historyPrevAction
Recalls the previous command from the history. |
(package private) AbstractAction |
historyReverseSearchAction
Reverse searches in the history. |
(package private) AbstractAction |
indentKeyActionLine
Indents in preparation for typing next line |
(package private) AbstractAction |
indentKeyActionTab
Indents the selected text. |
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. |
private static String |
INPUT_ENTERED_NAME
|
private static String |
INSERT_END_OF_STREAM
|
private static String |
INSERT_NEWLINE_NAME
|
(package private) AbstractAction |
moveDownAction
Added feature for down. |
(package private) AbstractAction |
moveLeftAction
Moves the caret left or wraps around. |
(package private) AbstractAction |
moveRightAction
Moves the caret right or wraps around. |
(package private) AbstractAction |
moveUpAction
Added feature for up. |
(package private) AbstractAction |
nextWordAction
Skips forward one word. |
(package private) AbstractAction |
prevWordAction
Skips back one word. |
private static String |
REDO_NAME
|
private static String |
UNDO_NAME
|
| Fields inherited from class edu.rice.cs.drjava.ui.AbstractConsoleController |
|---|
_defaultStyle, _interactionsDJDocument, _pane, _systemErrStyle, _systemOutStyle, clearCurrentAction, copyAction, cutAction, gotoEndAction, gotoPromptPosAction, newLineAction, selectToEndAction, selectToPromptPosAction, switchToNextPaneAction, switchToPrevPaneAction |
| Constructor Summary | |
|---|---|
InteractionsController(InteractionsModel model,
InteractionsDJDocument adapter,
InteractionsPane pane,
Runnable disableCloseSystemInMenuItemCommand)
Glue together the given model and view. |
|
InteractionsController(InteractionsModel model,
InteractionsDJDocument adapter,
Runnable disableCloseSystemInMenuItemCommand)
Glue together the given model and a new view. |
|
| Method Summary | |
|---|---|
protected void |
_addDocumentStyles()
Adds AttributeSets as named styles to the document adapter. |
private boolean |
_isCursorAfterPrompt()
|
private void |
_setConsoleInputCommands(Runnable inputCompletionCommand,
Lambda<String,String> insertTextCommand)
Sets the commands used to manipulate the console input process. |
protected void |
_setupModel()
Adds listeners to the model. |
protected void |
_setupView()
Adds actions to the view. |
private boolean |
_shouldGoIntoHistory(int start,
int end)
Tests whether or not to move into the history. |
void |
addConsoleStateListener(InteractionsController.ConsoleStateListener listener)
|
void |
addFocusListener(FocusListener listener)
Add a focus listener to the Interactions Pane and the Input Box. |
private void |
fireConsoleInputCompleted(String text)
|
private void |
fireConsoleInputStarted()
|
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. |
Action |
getRedoAction()
|
Action |
getUndoAction()
|
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)
|
void |
setEndOfStream(boolean tf)
Sets the end of stream flag. |
| Methods inherited from class edu.rice.cs.drjava.ui.AbstractConsoleController |
|---|
_busy, _init, getDocumentAdapter, getPane, moveToEnd, moveToPrompt, resetView, setNextPaneAction, setPrevPaneAction |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final String INPUT_ENTERED_NAME
private static final String INSERT_NEWLINE_NAME
private static final String INSERT_END_OF_STREAM
private static final String UNDO_NAME
private static final String REDO_NAME
public static final String INPUT_BOX_STYLE
public static final String INPUT_BOX_SYMBOL
private volatile InteractionsModel _model
private volatile InteractionsDocument _doc
private volatile SimpleAttributeSet _errStyle
private final SimpleAttributeSet _debugStyle
private volatile Lambda<String,String> _insertTextCommand
private volatile Runnable _inputCompletionCommand
NOTE: This command must be executed on swing's event handling thread.
private final Runnable _disableCloseSystemInMenuItemCommand
private static final Lambda<String,String> _defaultInsertTextCommand
private static final Runnable _defaultInputCompletionCommand
private volatile InteractionsController.InputBox _box
private volatile String _result
private volatile boolean _endOfStream
protected volatile InputListener _inputListener
private ArrayList<InteractionsController.ConsoleStateListener> _consoleStateListeners
private InteractionsListener _viewListener
AbstractAction evalAction
AbstractAction historyPrevAction
AbstractAction historyNextAction
AbstractAction moveUpAction
AbstractAction moveDownAction
Action defaultUpAction
Action defaultDownAction
AbstractAction historyReverseSearchAction
AbstractAction historyForwardSearchAction
AbstractAction moveLeftAction
AbstractAction moveRightAction
AbstractAction prevWordAction
AbstractAction nextWordAction
AbstractAction indentKeyActionTab
AbstractAction indentKeyActionLine
private final DelegatingAction _undoAction
private final DelegatingAction _redoAction
private final ArrayList<FocusListener> _undoRedoInteractionFocusListeners
private final OptionListener<Vector<KeyStroke>> _keyBindingOptionListener
| Constructor Detail |
|---|
public InteractionsController(InteractionsModel model,
InteractionsDJDocument adapter,
Runnable disableCloseSystemInMenuItemCommand)
model - An InteractionsModeladapter - InteractionsDJDocument being used by the model's doc
public InteractionsController(InteractionsModel model,
InteractionsDJDocument adapter,
InteractionsPane pane,
Runnable disableCloseSystemInMenuItemCommand)
model - An InteractionsModeladapter - InteractionsDJDocument being used by the model's docpane - An InteractionsPane| Method Detail |
|---|
public void addConsoleStateListener(InteractionsController.ConsoleStateListener listener)
public void removeConsoleStateListener(InteractionsController.ConsoleStateListener listener)
private void fireConsoleInputStarted()
private void fireConsoleInputCompleted(String text)
public void setEndOfStream(boolean tf)
public InputListener getInputListener()
public void interruptConsoleInput()
UnsupportedOperationException - If the interactions pane is not receiving console inputpublic void insertConsoleText(String input)
input - The text to insert into the console input box
UnsupportedOperationException - If the the interactions pane is not receiving console inputpublic InteractionsModel getInteractionsModel()
public ConsoleDocument getConsoleDoc()
getConsoleDoc in class AbstractConsoleControllerpublic InteractionsDocument getDocument()
protected void _addDocumentStyles()
_addDocumentStyles in class AbstractConsoleControllerprotected void _setupModel()
_setupModel in class AbstractConsoleControllerprotected void _setupView()
_setupView in class AbstractConsoleController
private void _setConsoleInputCommands(Runnable inputCompletionCommand,
Lambda<String,String> insertTextCommand)
private boolean _shouldGoIntoHistory(int start,
int end)
private boolean _isCursorAfterPrompt()
public void addFocusListener(FocusListener listener)
public Action getUndoAction()
public Action getRedoAction()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||