public class SHTMLEditorKit
extends javax.swing.text.html.HTMLEditorKit
HTMLEditorKit
for application SimplyHTML.
In stage 1 this only re-implements how style sheets are handled by default.
Stage 3 adds functionality for usage of the custom HTML document and HTML reader used with SimplyHTML from this stage on.
With stage 9 some additional views have been added to the view factory as a workaround for bug id 4765271 (see http://developer.java.sun.com/developer/bugParade/bugs/4765271.html).
OK, I give up: With release 2 of stage 9 above views are used no longer and bug fixing is not done anymore. The HTML support is almost taken as is in the hope that Sun will enhance it some day. To do compensation inside a single application is not possible with a reasonable effort.
Modifier and Type | Class and Description |
---|---|
static class |
SHTMLEditorKit.SHTMLFactory |
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
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
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
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
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
Modifier and Type | Method and Description |
---|---|
javax.swing.text.Document |
createDefaultDocument()
Create an uninitialized text storage model
that is appropriate for this type of editor.
|
javax.swing.text.ViewFactory |
getViewFactory()
Fetch a factory that is suitable for producing
views of any models that are produced by this
kit.
|
void |
read(java.io.Reader in,
javax.swing.text.Document doc,
int pos)
Inserts content from the given stream.
|
static void |
removeCharacterAttributes(javax.swing.text.StyledDocument doc,
java.lang.Object attributeName,
int start,
int length) |
void |
write(java.io.Writer out,
javax.swing.text.Document doc,
int pos,
int len)
Write content from a document to the given stream
in a format appropriate for this kind of content handler.
|
clone, createInputAttributes, deinstall, getAccessibleContext, getActions, getContentType, getDefaultCursor, getInputAttributes, getLinkCursor, getParser, getStyleSheet, insertHTML, install, isAutoFormSubmission, setAutoFormSubmission, setDefaultCursor, setLinkCursor, setStyleSheet
public javax.swing.text.Document createDefaultDocument()
createDefaultDocument
in class javax.swing.text.html.HTMLEditorKit
public void read(java.io.Reader in, javax.swing.text.Document doc, int pos) throws java.io.IOException, javax.swing.text.BadLocationException
doc
is
an instance of HTMLDocument, this will read
HTML 3.2 text. Inserting HTML into a non-empty document must be inside
the body Element, if you do not insert into the body an exception will
be thrown. When inserting into a non-empty document all tags outside
of the body (head, title) will be dropped.read
in class javax.swing.text.html.HTMLEditorKit
in
- the stream to read fromdoc
- the destination for the insertionpos
- the location in the document to place the
contentjava.io.IOException
- on any I/O errorjavax.swing.text.BadLocationException
- if pos represents an invalid
location within the documentjava.lang.RuntimeException
- (will eventually be a BadLocationException)
if pos is invalidpublic void write(java.io.Writer out, javax.swing.text.Document doc, int pos, int len) throws java.io.IOException, javax.swing.text.BadLocationException
write
in class javax.swing.text.html.HTMLEditorKit
out
- the stream to write todoc
- the source for the writepos
- the location in the document to fetch the
contentlen
- the amount to write outjava.io.IOException
- on any I/O errorjavax.swing.text.BadLocationException
- if pos represents an invalid
location within the documentpublic javax.swing.text.ViewFactory getViewFactory()
getViewFactory
in class javax.swing.text.html.HTMLEditorKit
public static void removeCharacterAttributes(javax.swing.text.StyledDocument doc, java.lang.Object attributeName, int start, int length)