|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.EditorKit javax.swing.text.DefaultEditorKit javax.swing.text.StyledEditorKit javax.swing.text.html.HTMLEditorKit jwo.utils.gui.html.ImprovedHTMLEditorKit
public class ImprovedHTMLEditorKit
HTML editor kit to replace the default one used by JEditorPane.
This kit can attempt to parse XHTML as well as HTML 3.2. It can
report XHTML parsing errors to a log which can be retrieved
using the getErrorLog()
method. It also adopts a
more sophisticated mechanism for looking for relative image
links. Image searching based on the JavaWorld Tip 109.
Nested Class Summary | |
---|---|
static class |
ImprovedHTMLEditorKit.HTMLFactoryX
A customised view factory that contains an image viewer that can cope with relative links. |
Nested classes/interfaces inherited from class javax.swing.text.html.HTMLEditorKit |
---|
HTMLEditorKit.HTMLFactory, HTMLEditorKit.HTMLTextAction, HTMLEditorKit.InsertHTMLTextAction, HTMLEditorKit.LinkController, HTMLEditorKit.Parser, HTMLEditorKit.ParserCallback |
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.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 |
Constructor Summary | |
---|---|
ImprovedHTMLEditorKit()
Creates an editor kit that will process HTML, but will not validate XHTML. |
|
ImprovedHTMLEditorKit(boolean validateXHTML)
Creates an editor kit that will process (X)HTML. |
Method Summary | |
---|---|
String |
getErrorLog()
Reports the error log that can contain any errors or warnings generated when attempting to parse some (X)HTML. |
protected HTMLEditorKit.Parser |
getParser()
Returns the a parser used to process the (X)HTML. |
ViewFactory |
getViewFactory()
Overrides the default view factory by returning a customised HTML view factory that looks for relative links. |
boolean |
isLastParseSuccessful()
Reports whether the last parse of code was successful. |
boolean |
isValidation()
Reports whether or not XHTML validation is set. |
boolean |
setNewStyleSheet(String css)
Sets the style sheet of the editor kit to the given css file. |
void |
setValidation(boolean validateXHTML)
Determines whether or not XHTML validation is to be applied. |
boolean |
validateXHTML(String xhtml)
Validates the given XHTML content. |
Methods inherited from class javax.swing.text.html.HTMLEditorKit |
---|
clone, createDefaultDocument, createInputAttributes, deinstall, getAccessibleContext, getActions, getContentType, getDefaultCursor, getInputAttributes, getLinkCursor, getStyleSheet, insertHTML, install, isAutoFormSubmission, read, 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 |
Constructor Detail |
---|
public ImprovedHTMLEditorKit()
public ImprovedHTMLEditorKit(boolean validateXHTML)
validateXHTML
- Will validate for XHTML wellformedness if true.Method Detail |
---|
public ViewFactory getViewFactory()
getViewFactory
in class HTMLEditorKit
public String getErrorLog()
public boolean isValidation()
public void setValidation(boolean validateXHTML)
validateXHTML
- If true kit set to validate for well-formed XHTML.public boolean isLastParseSuccessful()
getErrorLog()
method.public boolean setNewStyleSheet(String css)
css
- CSS file to use for formatting output.
public boolean validateXHTML(String xhtml)
setValidation()
), this method will always
return true. If validation is set and the given XHTML is not well-formed,
the form of the error can be found from getErrorLog
.
xhtml
- Text to validate.
protected HTMLEditorKit.Parser getParser()
getParser
in class HTMLEditorKit
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |