javax.swing.text.html
Class HTMLEditorKit
- Accessible, Cloneable, Serializable
EndOfLineStringProperty , backwardAction , beepAction , beginAction , beginLineAction , beginParagraphAction , beginWordAction , copyAction , cutAction , defaultKeyTypedAction , deleteNextCharAction , deletePrevCharAction , downAction , endAction , endLineAction , endParagraphAction , endWordAction , forwardAction , insertBreakAction , insertContentAction , insertTabAction , nextWordAction , pageDownAction , pageUpAction , pasteAction , previousWordAction , readOnlyAction , selectAllAction , selectLineAction , selectParagraphAction , selectWordAction , selectionBackwardAction , selectionBeginAction , selectionBeginLineAction , selectionBeginParagraphAction , selectionBeginWordAction , selectionDownAction , selectionEndAction , selectionEndLineAction , selectionEndParagraphAction , selectionEndWordAction , selectionForwardAction , selectionNextWordAction , selectionPreviousWordAction , selectionUpAction , upAction , writableAction |
HTMLEditorKit() - Constructs an HTMLEditorKit, creates a StyleContext, and loads the style sheet.
|
Object | clone() - Creates a copy of the editor kit.
|
Document | createDefaultDocument() - Create a text storage model for this type of editor.
|
protected void | createInputAttributes(Element element, MutableAttributeSet set) - Copies the key/values in elements AttributeSet into set.
|
void | deinstall(JEditorPane c) - Called when the this is removed from the JEditorPane.
|
AccessibleContext | getAccessibleContext() - Gets the AccessibleContext associated with this.
|
Action[] | getActions() - Gets the action list.
|
String | getContentType() - Gets the content type that the kit supports.
|
Cursor | getDefaultCursor() - Returns the default cursor.
|
MutableAttributeSet | getInputAttributes() - Gets the input attributes used for the styled editing actions.
|
Cursor | getLinkCursor() - Returns the cursor for links.
|
protected HTMLEditorKit.Parser | getParser() - Get the parser that this editor kit uses for reading HTML streams.
|
StyleSheet | getStyleSheet() - Get the set of styles currently being used to render the HTML elements.
|
ViewFactory | getViewFactory() - Gets a factory suitable for producing views of any
models that are produced by this kit.
|
void | insertHTML(HTMLDocument doc, int offset, String html, int popDepth, int pushDepth, HTML.Tag insertTag) - Inserts HTML into an existing document.
|
void | install(JEditorPane c) - Called when this is installed into the JEditorPane.
|
boolean | isAutoFormSubmission() - Returns
true when forms should be automatically submitted
by the editor kit.
|
void | read(Reader in, Document doc, int pos) - Inserts content from the given stream.
|
void | setAutoFormSubmission(boolean auto) - Sets whether or not the editor kit should automatically submit forms.
|
void | setDefaultCursor(Cursor cursor) - Sets the default cursor.
|
void | setLinkCursor(Cursor cursor) - Sets the Cursor for links.
|
void | setStyleSheet(StyleSheet s) - Set the set of styles to be used to render the various HTML elements.
|
void | write(Writer out, Document doc, int pos, int len) - Writes content from a document to the given stream in
an appropriate format.
|
clone , createCaret , createDefaultDocument , deinstall , getActions , getContentType , getViewFactory , install , read , read , write , write |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
COLOR_ACTION
public static final String COLOR_ACTION
The color action indentifier
(passing the color as an argument).
DEFAULT_CSS
public static final String DEFAULT_CSS
Default cascading stylesheed file ("default.css").
IMG_ALIGN_BOTTOM
public static final String IMG_ALIGN_BOTTOM
Align images at the bottom.
- "html-image-align-bottom"
IMG_ALIGN_MIDDLE
public static final String IMG_ALIGN_MIDDLE
Align images at the middle.
- "html-image-align-middle"
LOGICAL_STYLE_ACTION
public static final String LOGICAL_STYLE_ACTION
The "logical style" action identifier, passing that style as parameter.
- "html-logical-style-action"
HTMLEditorKit
public HTMLEditorKit()
Constructs an HTMLEditorKit, creates a StyleContext, and loads the style sheet.
createInputAttributes
protected void createInputAttributes(Element element,
MutableAttributeSet set)
Copies the key/values in elements AttributeSet into set.
This does not copy component, icon, or element names attributes.
This is called anytime the caret moves over a different location.
- createInputAttributes in interface StyledEditorKit
element
- - the element to create the input attributes for.set
- - the set to copy the values into.
getActions
public Action[] getActions()
Gets the action list. This list is supported by the superclass
augmented by the collection of actions defined locally for style
operations.
- getActions in interface StyledEditorKit
- an array of all the actions
getParser
protected HTMLEditorKit.Parser getParser()
Get the parser that this editor kit uses for reading HTML streams. This
method can be overridden to use the alternative parser.
getStyleSheet
public StyleSheet getStyleSheet()
Get the set of styles currently being used to render the HTML elements.
By default the resource specified by DEFAULT_CSS gets loaded, and is
shared by all HTMLEditorKit instances.
insertHTML
public void insertHTML(HTMLDocument doc,
int offset,
String html,
int popDepth,
int pushDepth,
HTML.Tag insertTag)
throws BadLocationException,
IOException
Inserts HTML into an existing document.
doc
- - the Document to insert the HTML into.offset
- - where to begin inserting the HTML.html
- - the String to insertpopDepth
- - the number of ElementSpec.EndTagTypes
to generate before insertingpushDepth
- - the number of ElementSpec.StartTagTypes
with a direction of ElementSpec.JoinNextDirection that
should be generated beforeinsertTag
- - the first tag to start inserting into document
isAutoFormSubmission
public boolean isAutoFormSubmission()
Returns true
when forms should be automatically submitted
by the editor kit. Set this to false
when you want to
intercept form submission. In this case you'd want to listen for
hyperlink events on the document and handle FormSubmitEvents specially.
The default is true
.
true
when forms should be automatically submitted
by the editor kit, false
otherwise
read
public void read(Reader in,
Document doc,
int pos)
throws IOException,
BadLocationException
Inserts content from the given stream. 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 interface DefaultEditorKit
in
- - the stream to read fromdoc
- - the destination for the insertionpos
- - the location in the document to place the content
setAutoFormSubmission
public void setAutoFormSubmission(boolean auto)
Sets whether or not the editor kit should automatically submit forms.
auto
- true
when the editor kit should handle form
submission, false
otherwise
setDefaultCursor
public void setDefaultCursor(Cursor cursor)
Sets the default cursor.
cursor
- - the new default cursor.
setLinkCursor
public void setLinkCursor(Cursor cursor)
Sets the Cursor for links.
cursor
- - the new cursor for links.
setStyleSheet
public void setStyleSheet(StyleSheet s)
Set the set of styles to be used to render the various HTML elements.
These styles are specified in terms of CSS specifications. Each document
produced by the kit will have a copy of the sheet which it can add the
document specific styles to. By default, the StyleSheet specified is shared
by all HTMLEditorKit instances.
s
- - the new style sheet
write
public void write(Writer out,
Document doc,
int pos,
int len)
throws IOException,
BadLocationException
Writes content from a document to the given stream in
an appropriate format.
- write in interface DefaultEditorKit
out
- - the stream to write todoc
- - the source for the writepos
- - the location in the document to get the content.len
- - the amount to write out
HTMLEditorKit.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.