edu.rice.cs.drjava.model.definitions
Class DefinitionsEditorKit

java.lang.Object
  extended by javax.swing.text.EditorKit
      extended by javax.swing.text.DefaultEditorKit
          extended by javax.swing.text.StyledEditorKit
              extended by edu.rice.cs.drjava.model.definitions.DefinitionsEditorKit
All Implemented Interfaces:
Serializable, Cloneable

public class DefinitionsEditorKit
extends StyledEditorKit

The editor kit class for editing Java source files. It functions as the controller in an MVC hierarchy. It also implements a factory for new documents and a factory for Views (the things that render the document).

Version:
$Id: DefinitionsEditorKit.java 4611 2008-07-23 15:55:02Z rcartwright $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.StyledEditorKit
StyledEditorKit.AlignmentAction, StyledEditorKit.BoldAction, StyledEditorKit.FontFamilyAction, StyledEditorKit.FontSizeAction, StyledEditorKit.ForegroundAction, StyledEditorKit.ItalicAction, StyledEditorKit.StyledTextAction, StyledEditorKit.UnderlineAction
 
Nested classes/interfaces inherited from class javax.swing.text.DefaultEditorKit
DefaultEditorKit.BeepAction, DefaultEditorKit.CopyAction, DefaultEditorKit.CutAction, DefaultEditorKit.DefaultKeyTypedAction, DefaultEditorKit.InsertBreakAction, DefaultEditorKit.InsertContentAction, DefaultEditorKit.InsertTabAction, DefaultEditorKit.PasteAction
 
Field Summary
 
Fields inherited from class javax.swing.text.DefaultEditorKit
backwardAction, beepAction, beginAction, beginLineAction, beginParagraphAction, beginWordAction, copyAction, cutAction, defaultKeyTypedAction, deleteNextCharAction, deleteNextWordAction, deletePrevCharAction, deletePrevWordAction, downAction, endAction, endLineAction, EndOfLineStringProperty, endParagraphAction, endWordAction, forwardAction, insertBreakAction, insertContentAction, insertTabAction, nextWordAction, pageDownAction, pageUpAction, pasteAction, previousWordAction, readOnlyAction, selectAllAction, selectionBackwardAction, selectionBeginAction, selectionBeginLineAction, selectionBeginParagraphAction, selectionBeginWordAction, selectionDownAction, selectionEndAction, selectionEndLineAction, selectionEndParagraphAction, selectionEndWordAction, selectionForwardAction, selectionNextWordAction, selectionPreviousWordAction, selectionUpAction, selectLineAction, selectParagraphAction, selectWordAction, upAction, writableAction
 
Constructor Summary
DefinitionsEditorKit(GlobalEventNotifier notifier)
          Creates a new editor kit with the given listeners.
 
Method Summary
 DefinitionsDocument createNewDocument()
          Creates a new DefinitionsDocument.
 String getContentType()
          Get the MIME content type of the document.
 ViewFactory getViewFactory()
          We want to use our ColoringView to render text, so here we return a factory that creates ColoringViews.
 
Methods inherited from class javax.swing.text.StyledEditorKit
clone, createDefaultDocument, createInputAttributes, deinstall, getActions, getCharacterAttributeRun, getInputAttributes, install
 
Methods inherited from class javax.swing.text.DefaultEditorKit
createCaret, read, read, write, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefinitionsEditorKit

public DefinitionsEditorKit(GlobalEventNotifier notifier)
Creates a new editor kit with the given listeners.

Parameters:
notifier - Keeps track of the listeners to the model
Method Detail

createNewDocument

public DefinitionsDocument createNewDocument()
Creates a new DefinitionsDocument. Formerly named createDefaultDocument() because the view (DefinitionsPane) would create a DefinitionsDocument by default when it was constructed. However, this default document was immediately discarded because a DefinitionsDocument for the constructed DefinitionsPane already existed. Unfortunately, JEditorPane does not have a constructor that takes a Document as input. We conceivably could design this EditorKit to return the pre-existing document when the JEditorPane requests a new one, but the EditorKit is specified by a static field of DefinitionsPane so there is no clean way to install the proper EditorKit before the JEditorPane constructor asks for the Document. As an easier alternative, we just let the DefaultEditorKit return a PlainDocument (much lighter weight), which is thrown away when the true DefinitionsDocument is assigned. Improvements to this approach are welcome... :)


getContentType

public String getContentType()
Get the MIME content type of the document.

Overrides:
getContentType in class DefaultEditorKit
Returns:
"text/java"

getViewFactory

public final ViewFactory getViewFactory()
We want to use our ColoringView to render text, so here we return a factory that creates ColoringViews.

Overrides:
getViewFactory in class StyledEditorKit