# Class SHTMLEditorKit

java.lang.Object
javax.swing.text.EditorKit
javax.swing.text.DefaultEditorKit
javax.swing.text.StyledEditorKit
javax.swing.text.html.HTMLEditorKit
com.lightdev.app.shtm.SHTMLEditorKit

All Implemented Interfaces:
  `Serializable, Cloneable, Accessible`

public class SHTMLEditorKit extends HTMLEditorKit
Extensions to `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 4765271).

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.

See Also:
  - Serialized Form

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`SHTMLEditorKit.SHTMLFactory`

### Nested classes/interfaces inherited from class HTMLEditorKit

`HTMLEditorKit.HTMLFactory, HTMLEditorKit.HTMLTextAction, HTMLEditorKit.InsertHTMLTextAction, HTMLEditorKit.LinkController, HTMLEditorKit.Parser, HTMLEditorKit.ParserCallback`

### Nested classes/interfaces inherited from class StyledEditorKit

`StyledEditorKit.AlignmentAction, StyledEditorKit.BoldAction, StyledEditorKit.FontFamilyAction, StyledEditorKit.FontSizeAction, StyledEditorKit.ForegroundAction, StyledEditorKit.ItalicAction, StyledEditorKit.StyledTextAction, StyledEditorKit.UnderlineAction`

### Nested classes/interfaces inherited from class DefaultEditorKit

`DefaultEditorKit.BeepAction, DefaultEditorKit.CopyAction, DefaultEditorKit.CutAction, DefaultEditorKit.DefaultKeyTypedAction, DefaultEditorKit.InsertBreakAction, DefaultEditorKit.InsertContentAction, DefaultEditorKit.InsertTabAction, DefaultEditorKit.PasteAction`

## Field Summary

### Fields inherited from class 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 DefaultEditorKit

`backwardAction, beepAction, beginAction, beginLineAction, beginLineUpAction, beginParagraphAction, beginWordAction, copyAction, cutAction, defaultKeyTypedAction, deleteNextCharAction, deleteNextWordAction, deletePrevCharAction, deletePrevWordAction, downAction, endAction, endLineAction, endLineDownAction, 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

Constructors
Constructor
Description
`SHTMLEditorKit()`

## Method Summary

Modifier and Type
Method
Description
`Document`
`createDefaultDocument()`
Create an uninitialized text storage model that is appropriate for this type of editor.
`protected HTMLEditorKit.Parser`
`getParser()`
`ViewFactory`
`getViewFactory()`
Fetch a factory that is suitable for producing views of any models that are produced by this kit.
`void`
`read(Reader in, Document doc, int pos)`
Inserts content from the given stream.
`static void`
`removeCharacterAttributes(StyledDocument doc, Object attributeName, int start, int length)`
`void`
`write(Writer out, 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.

### Methods inherited from class HTMLEditorKit

`clone, createInputAttributes, deinstall, getAccessibleContext, getActions, getContentType, getDefaultCursor, getInputAttributes, getLinkCursor, getStyleSheet, insertHTML, install, isAutoFormSubmission, setAutoFormSubmission, setDefaultCursor, setLinkCursor, setStyleSheet`

### Methods inherited from class StyledEditorKit

`getCharacterAttributeRun`

### Methods inherited from class DefaultEditorKit

`createCaret, read, write`

### Methods inherited from class Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SHTMLEditorKit

public SHTMLEditorKit()

## Method Details

### getParser

protected HTMLEditorKit.Parser getParser()

Overrides:
  `getParser` in class `HTMLEditorKit`

### createDefaultDocument

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

Overrides:
  `createDefaultDocument` in class `HTMLEditorKit`
Returns:
  the model

### read

public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException
Inserts content from the given stream. If `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.

Overrides:
  `read` in class `HTMLEditorKit`
Parameters:
  `in` - the stream to read from
  `doc` - the destination for the insertion
  `pos` - the location in the document to place the content
Throws:
  `IOException` - on any I/O error
  `BadLocationException` - if pos represents an invalid location within the document
  `RuntimeException` - (will eventually be a BadLocationException) if pos is invalid

### write

public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException
Write content from a document to the given stream in a format appropriate for this kind of content handler.

Overrides:
  `write` in class `HTMLEditorKit`
Parameters:
  `out` - the stream to write to
  `doc` - the source for the write
  `pos` - the location in the document to fetch the content
  `len` - the amount to write out
Throws:
  `IOException` - on any I/O error
  `BadLocationException` - if pos represents an invalid location within the document

### getViewFactory

public ViewFactory getViewFactory()
Fetch a factory that is suitable for producing views of any models that are produced by this kit.

Overrides:
  `getViewFactory` in class `HTMLEditorKit`
Returns:
  the factory

### removeCharacterAttributes

public static void removeCharacterAttributes(StyledDocument doc, Object attributeName, int start, int length)