Class CustomHTMLAction
java.lang.Object
javax.swing.AbstractAction
javax.swing.text.TextAction
javax.swing.text.StyledEditorKit.StyledTextAction
javax.swing.text.html.HTMLEditorKit.HTMLTextAction
net.thevpc.echo.swing.util.CustomHTMLAction
- All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action
- Author:
- thevpc
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HTML.TagTag in HTML to start adding tags from.protected HTML.TagAlternate tag in HTML to start adding tags from if parentTag is not found and alternateParentTag is found.protected HTML.TagAlternate Tag to check for in the document if parentTag is not found.protected StringHTML to insert.protected HTML.TagTag to check for in the document.Fields inherited from class AbstractAction
changeSupport, enabledFields inherited from interface Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInserts the HTML into the document.protected ElementcommonParent(JEditorPane editor, HTMLDocument doc, int offset) protected voidinsertAtBoundary(JEditorPane editor, HTMLDocument doc, int offset, Element insertElement, String html, HTML.Tag parentTag, HTML.Tag addTag) This is invoked when inserting at a boundary.protected voidinsertHTML(JEditorPane editor, HTMLDocument doc, int offset, String html, int popDepth, int pushDepth, HTML.Tag addTag) A cover for HTMLEditorKit.insertHTML.If an exception it thrown it is wrapped in a RuntimeException and thrown.Methods inherited from class HTMLEditorKit.HTMLTextAction
elementCountToTag, findElementMatchingTag, getElementsAt, getHTMLDocument, getHTMLEditorKitMethods inherited from class StyledEditorKit.StyledTextAction
getEditor, getStyledDocument, getStyledEditorKit, setCharacterAttributes, setParagraphAttributesMethods inherited from class TextAction
augmentList, getFocusedComponent, getTextComponentMethods inherited from class AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Field Details
-
html
HTML to insert. -
parentTag
Tag to check for in the document. -
addTag
Tag in HTML to start adding tags from. -
alternateParentTag
Alternate Tag to check for in the document if parentTag is not found. -
alternateAddTag
Alternate tag in HTML to start adding tags from if parentTag is not found and alternateParentTag is found.
-
-
Constructor Details
-
CustomHTMLAction
-
CustomHTMLAction
-
-
Method Details
-
insertHTML
protected void insertHTML(JEditorPane editor, HTMLDocument doc, int offset, String html, int popDepth, int pushDepth, HTML.Tag addTag) A cover for HTMLEditorKit.insertHTML.If an exception it thrown it is wrapped in a RuntimeException and thrown.- Parameters:
editor- editordoc- docoffset- offsethtml- htmlpopDepth- popDepthpushDepth- pushDepthaddTag- addTag
-
commonParent
-
insertAtBoundary
protected void insertAtBoundary(JEditorPane editor, HTMLDocument doc, int offset, Element insertElement, String html, HTML.Tag parentTag, HTML.Tag addTag) This is invoked when inserting at a boundary. It determines the number of pops, and then the number of pushes that need to be performed, and then invokes insertHTML.- Parameters:
editor- editordoc- docoffset- offsetinsertElement- insertElementhtml- htmlparentTag- parentTagaddTag- addTag- Since:
- 1.3
-
actionPerformed
Inserts the HTML into the document.- Parameters:
ae- the event
-