eTextReader.applet
Class AppletHTMLEditorKit

java.lang.Object
  extended by javax.swing.text.EditorKit
      extended by javax.swing.text.DefaultEditorKit
          extended by javax.swing.text.StyledEditorKit
              extended by javax.swing.text.html.HTMLEditorKit
                  extended by eTextReader.applet.AppletHTMLEditorKit
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.accessibility.Accessible

public class AppletHTMLEditorKit
extends javax.swing.text.html.HTMLEditorKit

Provides support for annotations to be loaded into the document when it is read into the JEditorPane, and for including applets.

The view factory created by this EditorKit extends the standard HTMLFactory so that it recognizes the applet tag and creates an AppletComponentView instance to render the applet referenced by the tag. There may be issues with the security aspect of the applet running in the component; this has not been investigated.

In addition to adding applet support, the view factory also allows customization of whether images are loaded asynchronously; it queries the ContentPane as to whether or not this should occur based on whether the content pane was asked to scroll to a specific reference when its current page was loaded

Author:
mcfall
See Also:
AppletComponentView, CustomImageView, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.html.HTMLEditorKit
javax.swing.text.html.HTMLEditorKit.HTMLFactory, javax.swing.text.html.HTMLEditorKit.HTMLTextAction, javax.swing.text.html.HTMLEditorKit.InsertHTMLTextAction, javax.swing.text.html.HTMLEditorKit.LinkController, javax.swing.text.html.HTMLEditorKit.Parser, javax.swing.text.html.HTMLEditorKit.ParserCallback
 
Nested classes/interfaces inherited from class javax.swing.text.StyledEditorKit
javax.swing.text.StyledEditorKit.AlignmentAction, javax.swing.text.StyledEditorKit.BoldAction, javax.swing.text.StyledEditorKit.FontFamilyAction, javax.swing.text.StyledEditorKit.FontSizeAction, javax.swing.text.StyledEditorKit.ForegroundAction, javax.swing.text.StyledEditorKit.ItalicAction, javax.swing.text.StyledEditorKit.StyledTextAction, javax.swing.text.StyledEditorKit.UnderlineAction
 
Nested classes/interfaces inherited from class javax.swing.text.DefaultEditorKit
javax.swing.text.DefaultEditorKit.BeepAction, javax.swing.text.DefaultEditorKit.CopyAction, javax.swing.text.DefaultEditorKit.CutAction, javax.swing.text.DefaultEditorKit.DefaultKeyTypedAction, javax.swing.text.DefaultEditorKit.InsertBreakAction, javax.swing.text.DefaultEditorKit.InsertContentAction, javax.swing.text.DefaultEditorKit.InsertTabAction, javax.swing.text.DefaultEditorKit.PasteAction
 
Field Summary
(package private)  ContentPane contentPane
           
private static boolean loadAnnotations
           
private static boolean loadDocumentsAsynchronously
           
 
Fields inherited from class javax.swing.text.html.HTMLEditorKit
BOLD_ACTION, COLOR_ACTION, DEFAULT_CSS, FONT_CHANGE_BIGGER, FONT_CHANGE_SMALLER, IMG_ALIGN_BOTTOM, IMG_ALIGN_MIDDLE, IMG_ALIGN_TOP, IMG_BORDER, ITALIC_ACTION, LOGICAL_STYLE_ACTION, PARA_INDENT_LEFT, PARA_INDENT_RIGHT
 
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, selectionPreviousWordAction, selectionUpAction, selectLineAction, selectParagraphAction, selectWordAction, upAction, writableAction
 
Constructor Summary
AppletHTMLEditorKit()
           
 
Method Summary
 javax.swing.text.Document createDefaultDocument()
           Creates the default document used by this editor kit; the document created is the same as that which would be created by the HTMLEditorKit.
 javax.swing.text.ViewFactory getViewFactory()
          Creates the ViewFactory associated with this editor kit, which is an instance of AppletViewFactory.
 void install(javax.swing.JEditorPane paneEditor)
          Installs this editor kit into the JEditorPane paneEditor.
static boolean isLoadDocumentsAsynchronously()
           
 void read(java.io.Reader in, javax.swing.text.Document doc, int pos)
           
static void setLoadAnnotations(boolean load)
          Specifies whether or not the editor kit should load annotations when the read method is called.
static void setLoadDocumentsAsynchronously(boolean loadDocumentsAsynchronously)
           
 
Methods inherited from class javax.swing.text.html.HTMLEditorKit
clone, createInputAttributes, deinstall, getAccessibleContext, getActions, getContentType, getDefaultCursor, getInputAttributes, getLinkCursor, getParser, getStyleSheet, insertHTML, isAutoFormSubmission, setAutoFormSubmission, setDefaultCursor, setLinkCursor, setStyleSheet, write
 
Methods inherited from class javax.swing.text.StyledEditorKit
getCharacterAttributeRun
 
Methods inherited from class javax.swing.text.DefaultEditorKit
createCaret, read, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentPane

ContentPane contentPane

loadAnnotations

private static boolean loadAnnotations

loadDocumentsAsynchronously

private static boolean loadDocumentsAsynchronously
Constructor Detail

AppletHTMLEditorKit

public AppletHTMLEditorKit()
Method Detail

createDefaultDocument

public javax.swing.text.Document createDefaultDocument()

Creates the default document used by this editor kit; the document created is the same as that which would be created by the HTMLEditorKit. However, it's asynchronous load priority is set to -1 to ensure that it is loaded in the event dispatch thread

Overrides:
createDefaultDocument in class javax.swing.text.html.HTMLEditorKit
See Also:
HTMLEditorKit.createDefaultDocument()

read

public void read(java.io.Reader in,
                 javax.swing.text.Document doc,
                 int pos)
          throws java.io.IOException,
                 javax.swing.text.BadLocationException
Overrides:
read in class javax.swing.text.html.HTMLEditorKit
Throws:
java.io.IOException
javax.swing.text.BadLocationException

install

public void install(javax.swing.JEditorPane paneEditor)
Installs this editor kit into the JEditorPane paneEditor. Overrides the HTMLEditorKit's implementation in order to retain a local reference to the paneEditor if it is an instance of ContentPane

Overrides:
install in class javax.swing.text.html.HTMLEditorKit

getViewFactory

public javax.swing.text.ViewFactory getViewFactory()
Creates the ViewFactory associated with this editor kit, which is an instance of AppletViewFactory.

Overrides:
getViewFactory in class javax.swing.text.html.HTMLEditorKit

setLoadAnnotations

public static void setLoadAnnotations(boolean load)
Specifies whether or not the editor kit should load annotations when the read method is called.

Parameters:
load - true if annotations should be loaded, false if not

isLoadDocumentsAsynchronously

public static boolean isLoadDocumentsAsynchronously()

setLoadDocumentsAsynchronously

public static void setLoadDocumentsAsynchronously(boolean loadDocumentsAsynchronously)