javax.swing.text
Class StyledEditorKit

java.lang.Object
  |
  +--javax.swing.text.EditorKit
        |
        +--javax.swing.text.DefaultEditorKit
              |
              +--javax.swing.text.StyledEditorKit
All Implemented Interfaces:
Cloneable, Serializable

public class StyledEditorKit
extends DefaultEditorKit

Safe:

See Also:
Serialized Form

Field Summary
(package private)  Element currentParagraph
           
(package private)  Element currentRun
           
private static Action[] defaultActions
           
private static ViewFactory defaultFactory
           
(package private)  MutableAttributeSet inputAttributes
          This is the set of attributes used to store the input attributes.
private  javax.swing.text.StyledEditorKit.AttributeTracker inputAttributeUpdater
          This listener will be attached to the caret of the text component that the EditorKit gets installed into.
 
Fields inherited from class javax.swing.text.DefaultEditorKit
backwardAction, beepAction, beginAction, beginLineAction, beginParagraphAction, beginWordAction, copyAction, cutAction, defaultKeyTypedAction, deleteNextCharAction, deletePrevCharAction, 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, selectionPageDownAction, selectionPageLeftAction, selectionPageRightAction, selectionPageUpAction, selectionPreviousWordAction, selectionUpAction, selectLineAction, selectParagraphAction, selectWordAction, toggleComponentOrientationAction, unselectAction, upAction, writableAction
 
Constructor Summary
StyledEditorKit()
          Enabled: Creates a new EditorKit used for styled documents.
 
Method Summary
 Object clone()
          Suppressed: Creates a copy of the editor kit.
 Document createDefaultDocument()
          Enabled: Creates an uninitialized text storage model that is appropriate for this type of editor.
private  void createInputAttributes()
          Creates the AttributeSet used for the selection.
protected  void createInputAttributes(Element element, MutableAttributeSet set)
          Copies the key/values in elements AttributeSet into set.
private  void createInputAttributeUpdated()
          Creates a new AttributeTracker.
 void deinstall(JEditorPane c)
          Suppressed: Called when the kit is being removed from the JEditorPane.
 Action[] getActions()
          Suppressed: Fetches the command list for the editor.
 Element getCharacterAttributeRun()
          Enabled: Fetches the element representing the current run of character attributes for the caret.
 MutableAttributeSet getInputAttributes()
          Enabled: Gets the input attributes for the pane.
 ViewFactory getViewFactory()
          Enabled: Fetches a factory that is suitable for producing views of any models that are produced by this kit.
 void install(JEditorPane c)
          Suppressed: Called when the kit is being installed into a JEditorPane.
 
Methods inherited from class javax.swing.text.DefaultEditorKit
createCaret, getContentType, read, read, write, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultFactory

private static final ViewFactory defaultFactory

currentRun

Element currentRun

currentParagraph

Element currentParagraph

inputAttributes

MutableAttributeSet inputAttributes
This is the set of attributes used to store the input attributes.


inputAttributeUpdater

private javax.swing.text.StyledEditorKit.AttributeTracker inputAttributeUpdater
This listener will be attached to the caret of the text component that the EditorKit gets installed into. This should keep the input attributes updated for use by the styled actions.


defaultActions

private static final Action[] defaultActions
Constructor Detail

StyledEditorKit

public StyledEditorKit()
Enabled: Creates a new EditorKit used for styled documents.

Method Detail

getInputAttributes

public MutableAttributeSet getInputAttributes()
Enabled: Gets the input attributes for the pane. When the caret moves and there is no selection, the input attributes are automatically mutated to reflect the character attributes of the current caret location. The styled editing actions use the input attributes to carry out their actions.

Overrides:
getInputAttributes in class DefaultEditorKit
Returns:
the attribute set

getCharacterAttributeRun

public Element getCharacterAttributeRun()
Enabled: Fetches the element representing the current run of character attributes for the caret.

Returns:
the element

getActions

public Action[] getActions()
Suppressed: Fetches the command list for the editor. This is the list of commands supported by the superclass augmented by the collection of commands defined locally for style operations.

Overrides:
getActions in class DefaultEditorKit
Returns:
the command list

createDefaultDocument

public Document createDefaultDocument()
Enabled: Creates an uninitialized text storage model that is appropriate for this type of editor.

Overrides:
createDefaultDocument in class DefaultEditorKit
Returns:
the model

install

public void install(JEditorPane c)
Suppressed: Called when the kit is being installed into a JEditorPane.

Overrides:
install in class EditorKit
Parameters:
c - the JEditorPane

deinstall

public void deinstall(JEditorPane c)
Suppressed: Called when the kit is being removed from the JEditorPane. This is used to unregister any listeners that were attached.

Overrides:
deinstall in class EditorKit
Parameters:
c - the JEditorPane

getViewFactory

public ViewFactory getViewFactory()
Enabled: Fetches a factory that is suitable for producing views of any models that are produced by this kit. This is implemented to return View implementations for the following kinds of elements:

Overrides:
getViewFactory in class DefaultEditorKit
Returns:
the factory

clone

public Object clone()
Suppressed: Creates a copy of the editor kit.

Overrides:
clone in class EditorKit
Returns:
the copy

createInputAttributes

private void createInputAttributes()
Creates the AttributeSet used for the selection.


createInputAttributeUpdated

private void createInputAttributeUpdated()
Creates a new AttributeTracker.


createInputAttributes

protected void createInputAttributes(Element element,
                                     MutableAttributeSet set)
Copies the key/values in elements AttributeSet into set. This does not copy component, icon, or element names attributes. Subclasses may wish to refine what is and what isn't copied here. But be sure to first remove all the attributes that are in set.

This is called anytime the caret moves over a different location.



comments?