edu.rice.cs.drjava.model.repl
Class InteractionsDocument

java.lang.Object
  |
  +--javax.swing.text.AbstractDocument
        |
        +--javax.swing.text.DefaultStyledDocument
              |
              +--edu.rice.cs.drjava.model.repl.InteractionsDocument
All Implemented Interfaces:
Document, Serializable, StyledDocument

public class InteractionsDocument
extends DefaultStyledDocument

The document that handles input to the repl and the interpretation of said input.

Version:
$Id: InteractionsDocument.java,v 1.28 2002/08/21 23:06:46 csreis Exp $
See Also:
Serialized Form

Inner Class Summary
private  class InteractionsDocument.ExceptionButtonListener
           
 
Inner classes inherited from class javax.swing.text.DefaultStyledDocument
DefaultStyledDocument.AttributeUndoableEdit, DefaultStyledDocument.ChangeUpdateRunnable, DefaultStyledDocument.ElementBuffer, DefaultStyledDocument.ElementSpec, DefaultStyledDocument.SectionElement, DefaultStyledDocument.StyleChangeHandler, DefaultStyledDocument.StyleChangeUndoableEdit, DefaultStyledDocument.StyleContextChangeHandler
 
Inner classes inherited from class javax.swing.text.AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BidiElement, AbstractDocument.BidiRootElement, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
 
Field Summary
private  int _frozenPos
          Index in the document of the first place that is editable.
private  History _history
          Command-line history.
private  boolean _inProgress
           
static String BANNER
           
static String PROMPT
           
 
Fields inherited from class javax.swing.text.DefaultStyledDocument
buffer, BUFFER_SIZE_DEFAULT, listeningStyles, styleChangeListener, styleContextChangeListener
 
Fields inherited from class javax.swing.text.AbstractDocument
AsyncLoadPriority, BAD_LOCATION, BAD_LOCK_STATE, BidiElementName, bidiRoot, ContentElementName, context, currWriter, data, defaultI18NProperty, documentProperties, ElementNameAttribute, I18NProperty, listenerList, numReaders, ParagraphElementName, SectionElementName
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
InteractionsDocument()
          put your documentation comment here
 
Method Summary
private  void _clearCurrentInteractionText()
           
private  void _replaceCurrentLineFromHistory()
          Replaces any text entered past the prompt with the current item in the history.
 void addToHistory(String text)
           
 void appendExceptionResult(String exceptionClass, String message, String stackTrace, AttributeSet set)
           
 void clearCurrentInteraction()
          Clears the current interaction text and then moves to the end of the command history.
 void clearHistory()
          Clears the history
 String getCurrentInteraction()
           
 int getFrozenPos()
          Returns the first location in the document where editing is allowed.
 String getHistoryAsString()
           
 boolean hasHistoryNext()
          put your documentation comment here
 boolean hasHistoryPrevious()
          put your documentation comment here
 boolean inProgress()
           
 void insertBeforeLastPrompt(String s, AttributeSet a)
           
 void insertString(int offs, String str, AttributeSet a)
          Override superclass insertion to prevent insertion past frozen point.
 void moveHistoryNext()
          put your documentation comment here
 void moveHistoryPrevious()
          put your documentation comment here
 void prompt()
           
 void remove(int offs, int len)
          Override superclass deletion to prevent deletion past frozen point.
 void reset()
          Clear the UI.
 void saveHistory(FileSaveSelector selector)
           
 void setInProgress(boolean b)
           
 
Methods inherited from class javax.swing.text.DefaultStyledDocument
addDocumentListener, addStyle, create, createDefaultRoot, createSpecsForInsertAfterNewline, createStyleChangeListener, createStyleContextChangeListener, getBackground, getCharacterElement, getDefaultRootElement, getFont, getForeground, getLogicalStyle, getParagraphElement, getStyle, getStyleNames, insert, insertUpdate, readObject, removeDocumentListener, removeStyle, removeUpdate, setCharacterAttributes, setLogicalStyle, setParagraphAttributes, styleChanged, updateStylesListeningTo
 
Methods inherited from class javax.swing.text.AbstractDocument
addUndoableEditListener, calculateBidiLevels, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, isComplex, isLeftToRight, postRemoveUpdate, putProperty, readLock, readUnlock, removeUndoableEditListener, render, setAsynchronousLoadPriority, setDocumentProperties, updateBidi, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.text.Document
addUndoableEditListener, createPosition, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, putProperty, removeUndoableEditListener, render
 

Field Detail

BANNER

public static final String BANNER

PROMPT

public static final String PROMPT

_inProgress

private boolean _inProgress

_frozenPos

private int _frozenPos
Index in the document of the first place that is editable.

_history

private History _history
Command-line history. It's not reset when the interpreter is reset.
Constructor Detail

InteractionsDocument

public InteractionsDocument()
put your documentation comment here
Method Detail

getFrozenPos

public int getFrozenPos()
Returns the first location in the document where editing is allowed.

insertString

public void insertString(int offs,
                         String str,
                         AttributeSet a)
                  throws BadLocationException
Override superclass insertion to prevent insertion past frozen point.
Overrides:
insertString in class AbstractDocument
Throws:
BadLocationException -  

setInProgress

public void setInProgress(boolean b)

inProgress

public boolean inProgress()

insertBeforeLastPrompt

public void insertBeforeLastPrompt(String s,
                                   AttributeSet a)

remove

public void remove(int offs,
                   int len)
            throws BadLocationException
Override superclass deletion to prevent deletion past frozen point.
Overrides:
remove in class AbstractDocument
Throws:
BadLocationException -  

reset

public void reset()
Clear the UI.

prompt

public void prompt()

clearHistory

public void clearHistory()
Clears the history

moveHistoryPrevious

public void moveHistoryPrevious()
put your documentation comment here

moveHistoryNext

public void moveHistoryNext()
put your documentation comment here

getCurrentInteraction

public String getCurrentInteraction()

clearCurrentInteraction

public void clearCurrentInteraction()
Clears the current interaction text and then moves to the end of the command history.

_clearCurrentInteractionText

private void _clearCurrentInteractionText()

_replaceCurrentLineFromHistory

private void _replaceCurrentLineFromHistory()
Replaces any text entered past the prompt with the current item in the history.

hasHistoryPrevious

public boolean hasHistoryPrevious()
put your documentation comment here
Returns:
 

hasHistoryNext

public boolean hasHistoryNext()
put your documentation comment here
Returns:
 

addToHistory

public void addToHistory(String text)

appendExceptionResult

public void appendExceptionResult(String exceptionClass,
                                  String message,
                                  String stackTrace,
                                  AttributeSet set)

saveHistory

public void saveHistory(FileSaveSelector selector)
                 throws IOException

getHistoryAsString

public String getHistoryAsString()