Package com.inet.html
Class InetHtmlEditorKit
java.lang.Object
javax.swing.text.EditorKit
javax.swing.text.DefaultEditorKit
javax.swing.text.StyledEditorKit
com.inet.html.InetHtmlEditorKit
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
BaseEditor.SetPageEditorKit
The JWebEngine implementation of the
This editor kit defines a custom set of actions which are not compatible with the default styled document. If you change the type of document in a
EditorKit.This editor kit defines a custom set of actions which are not compatible with the default styled document. If you change the type of document in a
JEditorPane please make sure to set the correct editor
kit as well.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn extended hyperlink event to support link targetsstatic classClass to watch the associated component and fire hyperlink events on it when appropriate.static enumThe rendering mode defines the type ofRenderingHints.KEY_TEXT_ANTIALIASINGto be used and additional optimizations depending of the anti alias type.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.UnderlineActionNested 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
FieldsModifier and TypeFieldDescriptionstatic final StringAction key for the insert/toggle bullet list actionstatic final StringAction key for the copy actionstatic final StringAction key for the insert/toggle numbered list actionstatic final StringAction key for the change paragraph indent actionstatic final StringAction key for the change paragraph indent actionstatic final StringAction key for the switch HTML/plain actionstatic final StringAction key for the clear search actionstatic final StringAction key for the initialize search actionstatic final StringAction key for the highlight next search hit actionstatic final StringAction key for the highlight previous search hit actionstatic final intstatic final StringAction key for the insert tabulator actionstatic final StringAction key for the remove tabulator actionFields inherited from class javax.swing.text.DefaultEditorKit
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 -
Constructor Summary
ConstructorsConstructorDescriptionCreates the editor kit with defaults: no font scaling, anti-alias activatedInetHtmlEditorKit(boolean useTextAntiAlias) Creates an editor kit with optional text anti alias -
Method Summary
Modifier and TypeMethodDescriptionclone()protected voidcreateInputAttributes(Element dotElement, Element markElement, MutableAttributeSet set) Creates the input attributes for a range of element.protected voidcreateInputAttributes(Element element, MutableAttributeSet set) voidvoidForces the editor kit to update it's input attributes.Action[]Returns a list of actions for the elements at the current mouse positionReturns the default cursor of the view areaGets the input attributes for the pane.Returns the cursor which should be displayed when hovering linksReturns the currently selected rendering modevoidvoidvoidsetDefaultConfig(InetHtmlConfiguration defaultConfig) Sets the default configuration of the documents created by this editor kitvoidsetDefaultCursor(Cursor defaultCursor) Sets the default cursor for the view areavoidsetFontScale(float scale) Sets the scale factor.voidsetLinkCursor(Cursor linkCursor) Sets the link hover cursor, must not be nullvoidsetParserTimeout(long timeout) Sets the parser timeout in ms.static voidSets the rendering mode to be used for newly createdInetHtmlFactorys andHtmlRootView.
The rendering mode defines the type ofRenderingHints.KEY_TEXT_ANTIALIASINGto be used and additional optimizations depending of the anti alias type.voidMethods inherited from class javax.swing.text.StyledEditorKit
getCharacterAttributeRunMethods inherited from class javax.swing.text.DefaultEditorKit
createCaret, read, write
-
Field Details
-
PARAGRAPH_INDENT_LEFT
Action key for the change paragraph indent action- See Also:
-
PARAGRAPH_INDENT_RIGHT
Action key for the change paragraph indent action- See Also:
-
TAB_KEY_ACTION
Action key for the insert tabulator action- See Also:
-
TAB_KEY_SHIFT_ACTION
Action key for the remove tabulator action- See Also:
-
BULLET_LIST_ACTION
Action key for the insert/toggle bullet list action- See Also:
-
NUMBERED_LIST_ACTION
Action key for the insert/toggle numbered list action- See Also:
-
PASTE_PLAIN_ACTION
Action key for the switch HTML/plain action- See Also:
-
COPY_PLAIN_ACTION
Action key for the copy action- See Also:
-
SEARCH_INIT_ACTION
Action key for the initialize search action- See Also:
-
SEARCH_NEXT_ACTION
Action key for the highlight next search hit action- See Also:
-
SEARCH_PREVIOUS_ACTION
Action key for the highlight previous search hit action- See Also:
-
SEARCH_CLEAR_ACTION
Action key for the clear search action- See Also:
-
SHORTCUT_KEY_MASK
public static final int SHORTCUT_KEY_MASK
-
-
Constructor Details
-
InetHtmlEditorKit
public InetHtmlEditorKit()Creates the editor kit with defaults: no font scaling, anti-alias activated- Since:
- 1.0
-
InetHtmlEditorKit
public InetHtmlEditorKit(boolean useTextAntiAlias) Creates an editor kit with optional text anti alias- Parameters:
useTextAntiAlias- true, to use anti alias, false to disable the feature- Since:
- 1.05
-
-
Method Details
-
setFontScale
public void setFontScale(float scale) Sets the scale factor. This factor will be applied to all calculated font sizes when displaying the content.- Parameters:
scale- a value between 0.1 and 10- Since:
- 1.05
-
setParserTimeout
public void setParserTimeout(long timeout) Sets the parser timeout in ms. Any parser created or invoked by this factory will interrupt after approximatly this timeout and return with the document parsed up until this moment. If the timeout is too short or the connection is slow, the parser may have not reached the body part after the timeout. Furthermore, this timeout does not stop the layout and rendering.- Parameters:
timeout- the timeout for the parser in millisecondsany value equal or below zero disables the timeout- Since:
- 1.05
-
createDefaultDocument
- Overrides:
createDefaultDocumentin classStyledEditorKit
-
getViewFactory
- Overrides:
getViewFactoryin classStyledEditorKit
-
setDefaultConfig
Sets the default configuration of the documents created by this editor kit- Parameters:
defaultConfig- the new config, null will be ignored- Since:
- 1.05
-
read
- Overrides:
readin classDefaultEditorKit- Throws:
IOExceptionBadLocationException
-
write
public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException - Overrides:
writein classDefaultEditorKit- Throws:
IOExceptionBadLocationException
-
getActions
- Overrides:
getActionsin classStyledEditorKit
-
getContentType
- Overrides:
getContentTypein classDefaultEditorKit
-
install
- Overrides:
installin classStyledEditorKit
-
deinstall
- Overrides:
deinstallin classStyledEditorKit
-
getCurrentCustomActions
Returns a list of actions for the elements at the current mouse position- Returns:
- a list of actions for the elements at the current mouse position, never
null - Since:
- 2.0
-
createInputAttributes
- Overrides:
createInputAttributesin classStyledEditorKit
-
createInputAttributes
protected void createInputAttributes(Element dotElement, Element markElement, MutableAttributeSet set) Creates the input attributes for a range of element. The resulting set will be a unification of the attribute sets of all elements found. Some attributes like font or font size will be cleared if there is more than one- Parameters:
dotElement- the top element at the dot positionmarkElement- the top element at the mark positionset- the attribute set to fill- Since:
- 1.05
-
getInputAttributes
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:
getInputAttributesin classStyledEditorKit- Returns:
- the attribute set
- Since:
- 1.05
-
forceUpdateInputAttributes
Forces the editor kit to update it's input attributes. This method work's even if neither the caret position nor the underlying element changed.- Parameters:
editor- The editor to read the attributes from.- Since:
- 1.05
-
getDefaultCursor
Returns the default cursor of the view area- Returns:
- the default cursor
- Since:
- 1.05
-
setDefaultCursor
Sets the default cursor for the view area- Parameters:
defaultCursor- the cursor, must not be null- Since:
- 1.05
-
getLinkCursor
Returns the cursor which should be displayed when hovering links- Returns:
- the cursor which should be displayed when hovering links
- Since:
- 1.05
-
setLinkCursor
Sets the link hover cursor, must not be null- Parameters:
linkCursor- the link hover cursor, must not be null- Since:
- 1.05
-
clone
- Overrides:
clonein classStyledEditorKit
-
setRenderingMode
Sets the rendering mode to be used for newly createdInetHtmlFactorys andHtmlRootView.
The rendering mode defines the type ofRenderingHints.KEY_TEXT_ANTIALIASINGto be used and additional optimizations depending of the anti alias type. Please see theInetHtmlEditorKit.RENDER_MODEenum values for details.
Note: This value will directly affect current views and thus may invalidate there rendering. It's highly recommend to set this value ahead of any rendering process.- Parameters:
mode- the rendering mode to be set,nullwill default toInetHtmlEditorKit.RENDER_MODE.java_custom- Since:
- 1.11
-
getRenderingMode
Returns the currently selected rendering mode- Returns:
- the currently selected rendering mode
- Since:
- 1.11
-