|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.text.AbstractDocument
javax.swing.text.DefaultStyledDocument
javax.swing.text.html.HTMLDocument
A document that models HTML. The purpose of this model
is to support both browsing and editing. As a result,
the structure described by an HTML document is not
exactly replicated by default. The element structure that
is modeled by default, is built by the class
HTMLDocument.HTMLReader, which implements
the HTMLEditorKit.ParserCallback protocol
that the parser expects. To change the structure one
can subclass HTMLReader, and reimplement the method
getReader(int) to return the new reader
implementation. The documentation for HTMLReader
should be consulted for the details of
the default structure created. The intent is that
the document be non-lossy (although reproducing the
HTML format may result in a different format).
The document models only HTML, and makes no attempt to
store view attributes in it. The elements are identified
by the StyleContext.NameAttribute attribute,
which should always have a value of type HTML.Tag
that identifies the kind of element. Some of the elements
(such as comments) are synthesized. The HTMLFactory
uses this attribute to determine what kind of view to build.
This document supports incremental loading. The
TokenThreshold property controls how
much of the parse is buffered before trying to update
the element structure of the document. This property
is set by the EditorKit so that subclasses can disable
it.
The Base property determines the URL
against which relative URLs are resolved.
By default, this will be the
Document.StreamDescriptionProperty if
the value of the property is a URL. If a <BASE>
tag is encountered, the base will become the URL specified
by that tag. Because the base URL is a property, it
can of course be set directly.
The default content storage mechanism for this document
is a gap buffer (GapContent).
Alternatives can be supplied by using the constructor
that takes a Content implementation.
| Nested Class Summary | |
class |
HTMLDocument.BlockElement
An element that represents a structural block of HTML. |
private static class |
HTMLDocument.FixedLengthDocument
Document that allows you to set the maximum length of the text. |
class |
HTMLDocument.HTMLReader
An HTML reader to load an HTML document with an HTML element structure. |
static class |
HTMLDocument.Iterator
An iterator to iterate over a particular type of tag. |
(package private) static class |
HTMLDocument.LeafIterator
An iterator to iterate over a particular type of tag. |
class |
HTMLDocument.RunElement
An element that represents a chunk of text that has a set of HTML character level attributes assigned to it. |
(package private) static class |
HTMLDocument.TaggedAttributeSet
Used by StyleSheet to determine when to avoid removing HTML.Tags matching StyleConstants. |
| Nested classes inherited from class javax.swing.text.DefaultStyledDocument |
DefaultStyledDocument.AttributeUndoableEdit, DefaultStyledDocument.ElementBuffer, DefaultStyledDocument.ElementSpec, DefaultStyledDocument.SectionElement |
| Nested classes inherited from class javax.swing.text.AbstractDocument |
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement |
| Field Summary | |
static String |
AdditionalComments
Document property key value. |
(package private) URL |
base
The location to resolve relative URLs against. |
private static AttributeSet |
contentAttributeSet
Used for inserts when a null AttributeSet is supplied. |
private boolean |
frameDocument
|
(package private) boolean |
hasBaseTag
does the document have base tag |
private static String |
I18NProperty
I18N property key. |
(package private) static String |
MAP_PROPERTY
Property Maps are registered under, will be a Hashtable. |
private static char[] |
NEWLINE
|
private HTMLEditorKit.Parser |
parser
The parser that is used when inserting html into the existing document. |
private boolean |
preservesUnknownTags
|
private HashMap |
radioButtonGroupsMap
|
(package private) static String |
StyleType
Document property key value. |
(package private) static String |
TokenThreshold
Document property for the number of tokens to buffer before building an element subtree to represent them. |
| Fields inherited from class javax.swing.text.DefaultStyledDocument |
buffer, BUFFER_SIZE_DEFAULT |
| Fields inherited from class javax.swing.text.AbstractDocument |
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName |
| Fields inherited from interface javax.swing.text.Document |
StreamDescriptionProperty, TitleProperty |
| Constructor Summary | |
HTMLDocument()
Constructs an HTML document using the default buffer size and a default StyleSheet. |
|
HTMLDocument(AbstractDocument.Content c,
StyleSheet styles)
Constructs an HTML document with the given content storage implementation and the given style/attribute storage mechanism. |
|
HTMLDocument(StyleSheet styles)
Constructs an HTML document with the default content storage implementation and the specified style/attribute storage mechanism. |
|
| Method Summary | |
(package private) void |
addMap(Map map)
Adds the specified map, this will remove a Map that has been previously registered with the same name. |
protected void |
create(DefaultStyledDocument.ElementSpec[] data)
Replaces the contents of the document with the given element specifications. |
protected Element |
createBranchElement(Element parent,
AttributeSet a)
Creates a document branch element, that can contain other elements. |
protected AbstractDocument.AbstractElement |
createDefaultRoot()
Creates the root element to be used to represent the default document structure. |
protected Element |
createLeafElement(Element parent,
AttributeSet a,
int p0,
int p1)
Creates a document leaf element that directly represents text (doesn't have any children). |
private Element |
findFrame(String frameName)
Searches the element hierarchy for an FRAME element that has its name attribute equal to the frameName. |
protected void |
fireChangedUpdate(DocumentEvent e)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireUndoableEditUpdate(UndoableEditEvent e)
Notifies all listeners that have registered interest for notification on this event type. |
URL |
getBase()
Returns the location to resolve relative URLs against. |
(package private) String |
getDefaultStyleSheetType()
Returns the content type language used for style sheets. |
Element |
getElement(Element e,
Object attribute,
Object value)
Returns the child element of e that contains the
attribute, attribute with value value, or
null if one isn't found. |
private Element |
getElement(Element e,
Object attribute,
Object value,
boolean searchLeafAttributes)
Returns the child element of e that contains the
attribute, attribute with value value, or
null if one isn't found. |
Element |
getElement(String id)
Returns the element that has the given id Attribute.
|
HTMLDocument.Iterator |
getIterator(HTML.Tag t)
Fetches an iterator for the specified HTML tag. |
(package private) Map |
getMap(String name)
Returns the Map associated with the given name. |
(package private) Enumeration |
getMaps()
Returns an Enumeration of the possible Maps. |
HTMLEditorKit.Parser |
getParser()
Returns the parser that is used when inserting HTML into the existing document. |
boolean |
getPreservesUnknownTags()
Returns the behavior the parser observes when encountering unknown tags. |
HTMLEditorKit.ParserCallback |
getReader(int pos)
Fetches the reader for the parser to use when loading the document with HTML. |
HTMLEditorKit.ParserCallback |
getReader(int pos,
int popDepth,
int pushDepth,
HTML.Tag insertTag)
Returns the reader for the parser to use to load the document with HTML. |
(package private) HTMLEditorKit.ParserCallback |
getReader(int pos,
int popDepth,
int pushDepth,
HTML.Tag insertTag,
boolean insertInsertTag)
Fetches the reader for the parser to use to load the document with HTML. |
StyleSheet |
getStyleSheet()
Fetches the StyleSheet with the document-specific display
rules (CSS) that were specified in the HTML document itself. |
int |
getTokenThreshold()
Gets the number of tokens to buffer before trying to update the documents element structure. |
(package private) boolean |
hasBaseTag()
|
protected void |
insert(int offset,
DefaultStyledDocument.ElementSpec[] data)
Inserts new elements in bulk. |
void |
insertAfterEnd(Element elem,
String htmlText)
Inserts the HTML specified as a string after the the end of the given element. |
void |
insertAfterStart(Element elem,
String htmlText)
Inserts the HTML specified as a string at the start of the element. |
void |
insertBeforeEnd(Element elem,
String htmlText)
Inserts the HTML specified as a string at the end of the element. |
void |
insertBeforeStart(Element elem,
String htmlText)
Inserts the HTML specified as a string before the start of the given element. |
private void |
insertHTML(Element parent,
int offset,
String html,
boolean wantsTrailingNewline)
Inserts a string of HTML into the document at the given position. |
protected void |
insertUpdate(AbstractDocument.DefaultDocumentEvent chng,
AttributeSet attr)
Updates document structure as a result of text insertion. |
private void |
installParserIfNecessary()
Installs a default Parser if one has not been installed yet. |
private static boolean |
isComplex(char ch)
|
private static boolean |
isComplex(char[] text,
int start,
int limit)
|
(package private) boolean |
isFrameDocument()
Returns true if the document will be viewed in a frame. |
(package private) static boolean |
matchNameAttribute(AttributeSet attr,
HTML.Tag tag)
Returns true if StyleConstants.NameAttribute is
equal to the tag that is passed in as a parameter. |
(package private) void |
obtainLock()
|
void |
processHTMLFrameHyperlinkEvent(HTMLFrameHyperlinkEvent e)
Processes HyperlinkEvents that
are generated by documents in an HTML frame.
|
(package private) void |
releaseLock()
|
private void |
removeElements(Element e,
int index,
int count)
Removes child Elements of the passed in Element e. |
private void |
removeElements(Element e,
int index,
int count,
int start,
int end)
Called to remove child Elements when the end is not touched. |
private void |
removeElementsAtEnd(Element e,
int index,
int count,
int start,
int end)
Called to remove child elements of e when one of the
elements to remove is representing the end character.
|
(package private) void |
removeMap(Map map)
Removes a previously registered map. |
private void |
replace(AbstractDocument.DefaultDocumentEvent dde,
Element e,
int index,
int count,
int start,
int end,
boolean remove,
boolean create)
This is used by removeElementsAtEnd, it removes
count elements starting at start from
e. |
void |
setBase(URL u)
Sets the location to resolve relative URLs against. |
(package private) void |
setDefaultStyleSheetType(String contentType)
Sets the content type language used for style sheets that do not explicitly specify the type. |
(package private) void |
setFrameDocumentState(boolean frameDoc)
Sets a boolean state about whether the document will be viewed in a frame. |
void |
setInnerHTML(Element elem,
String htmlText)
Replaces the children of the given element with the contents specified as an HTML string. |
void |
setOuterHTML(Element elem,
String htmlText)
Replaces the given element in the parent with the contents specified as an HTML string. |
void |
setParagraphAttributes(int offset,
int length,
AttributeSet s,
boolean replace)
Sets attributes for a paragraph. |
void |
setParser(HTMLEditorKit.Parser parser)
Sets the parser that is used by the methods that insert html into the existing document, such as setInnerHTML,
and setOuterHTML.
|
void |
setPreservesUnknownTags(boolean preservesTags)
Determines how unknown tags are handled by the parser. |
void |
setTokenThreshold(int n)
Sets the number of tokens to buffer before trying to update the documents element structure. |
private void |
updateFrame(Element element,
String url)
Updates the Frame elements HTML.Attribute.SRC attribute
and fires a ChangedUpdate event. |
private void |
updateFrameSet(Element element,
String url)
Replaces a frameset branch Element with a frame leaf element. |
private void |
verifyParser()
Verifies the document has an HTMLEditorKit.Parser set.
|
| Methods inherited from class javax.swing.text.DefaultStyledDocument |
addDocumentListener, addStyle, getBackground, getCharacterElement, getDefaultRootElement, getFont, getForeground, getLogicalStyle, getParagraphElement, getStyle, getStyleNames, removeDocumentListener, removeStyle, removeUpdate, setCharacterAttributes, setLogicalStyle, styleChanged |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.swing.text.Document |
addUndoableEditListener, createPosition, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, insertString, putProperty, remove, removeUndoableEditListener, render |
| Field Detail |
private boolean frameDocument
private boolean preservesUnknownTags
private HashMap radioButtonGroupsMap
static final String TokenThreshold
public static final String AdditionalComments
static final String StyleType
URL base
boolean hasBaseTag
private HTMLEditorKit.Parser parser
private static AttributeSet contentAttributeSet
static String MAP_PROPERTY
private static char[] NEWLINE
private static final String I18NProperty
AbstractDocument.I18NProperty,
Constant Field Values| Constructor Detail |
public HTMLDocument()
StyleSheet. This is a convenience
method for the constructor
HTMLDocument(Content, StyleSheet).
public HTMLDocument(StyleSheet styles)
HTMLDocument(Content, StyleSheet).
styles - the styles
public HTMLDocument(AbstractDocument.Content c,
StyleSheet styles)
c - the container for the contentstyles - the styles| Method Detail |
public HTMLEditorKit.ParserCallback getReader(int pos)
HTMLDocument.HTMLReader.
Subclasses can reimplement this
method to change how the document gets structured if desired.
(For example, to handle custom tags, or structurally represent character
style elements.)
pos - the starting position
public HTMLEditorKit.ParserCallback getReader(int pos,
int popDepth,
int pushDepth,
HTML.Tag insertTag)
HTMLDocument.HTMLReader.
Subclasses can reimplement this
method to change how the document gets structured if desired.
(For example, to handle custom tags, or structurally represent character
style elements.)
This is a convenience method for
getReader(int, int, int, HTML.Tag, TRUE).
popDepth - the number of ElementSpec.EndTagTypes
to generate before insertingpushDepth - the number of ElementSpec.StartTagTypes
with a direction of ElementSpec.JoinNextDirection
that should be generated before inserting,
but after the end tags have been generatedinsertTag - the first tag to start inserting into document
HTMLEditorKit.ParserCallback getReader(int pos,
int popDepth,
int pushDepth,
HTML.Tag insertTag,
boolean insertInsertTag)
popDepth - the number of ElementSpec.EndTagTypes
to generate before insertingpushDepth - the number of ElementSpec.StartTagTypes
with a direction of ElementSpec.JoinNextDirection
that should be generated before inserting,
but after the end tags have been generatedinsertTag - the first tag to start inserting into documentinsertInsertTag - false if all the Elements after insertTag should
be inserted; otherwise insertTag will be inserted
public URL getBase()
public void setBase(URL u)
This also sets the base of the StyleSheet
to be u as well as the base of the document.
u - the desired base URL
protected void insert(int offset,
DefaultStyledDocument.ElementSpec[] data)
throws BadLocationException
insert in class DefaultStyledDocumentoffset - the starting offsetdata - the element data
BadLocationException - if the given position does not
represent a valid location in the associated document.
protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng,
AttributeSet attr)
insertUpdate in class DefaultStyledDocumentchng - a description of the document changeattr - the attributesprotected void create(DefaultStyledDocument.ElementSpec[] data)
create in class DefaultStyledDocumentdata - the new contents of the document
public void setParagraphAttributes(int offset,
int length,
AttributeSet s,
boolean replace)
This method is thread safe, although most Swing methods are not. Please see Threads and Swing for more information.
setParagraphAttributes in interface StyledDocumentsetParagraphAttributes in class DefaultStyledDocumentoffset - the offset into the paragraph (must be at least 0)length - the number of characters affected (must be at least 0)s - the attributesreplace - whether to replace existing attributes, or merge thempublic StyleSheet getStyleSheet()
StyleSheet with the document-specific display
rules (CSS) that were specified in the HTML document itself.
StyleSheetpublic HTMLDocument.Iterator getIterator(HTML.Tag t)
t - the requested HTML.Tag
Iterator for the given HTML tagHTML.Tag
protected Element createLeafElement(Element parent,
AttributeSet a,
int p0,
int p1)
HTMLDocument.RunElement.
createLeafElement in class AbstractDocumentparent - the parent elementa - the attributes for the elementp0 - the beginning of the range (must be at least 0)p1 - the end of the range (must be at least p0)
protected Element createBranchElement(Element parent,
AttributeSet a)
HTMLDocument.BlockElement.
createBranchElement in class AbstractDocumentparent - the parent elementa - the attributes
protected AbstractDocument.AbstractElement createDefaultRoot()
createDefaultRoot in class DefaultStyledDocumentpublic void setTokenThreshold(int n)
n - the number of tokens to bufferpublic int getTokenThreshold()
Integer.MAX_VALUE.
public void setPreservesUnknownTags(boolean preservesTags)
preservesTags - true if unknown tags should be
saved in the model, otherwise tags are droppedHTML.Tagpublic boolean getPreservesUnknownTags()
HTML.Tagpublic void processHTMLFrameHyperlinkEvent(HTMLFrameHyperlinkEvent e)
HyperlinkEvents that
are generated by documents in an HTML frame.
The HyperlinkEvent type, as the parameter suggests,
is HTMLFrameHyperlinkEvent.
In addition to the typical information contained in a
HyperlinkEvent,
this event contains the element that corresponds to the frame in
which the click happened (the source element) and the
target name. The target name has 4 possible values:
HTML.Attribute.SRC attribute and fires a
ChangedUpdate event.
If the target is _parent, then it deletes the parent element,
which is a <FRAMESET> element, and inserts a new <FRAME>
element, and sets its HTML.Attribute.SRC attribute
to have a value equal to the destination URL and fire a
RemovedUpdate and InsertUpdate.
If the target is _top, this method does nothing. In the implementation
of the view for a frame, namely the FrameView,
the processing of _top is handled. Given that _top implies
replacing the entire document, it made sense to handle this outside
of the document that it will replace.
If the target is a named frame, then the element hierarchy is searched
for an element with a name equal to the target, its
HTML.Attribute.SRC attribute is updated and a
ChangedUpdate event is fired.
e - the eventprivate Element findFrame(String frameName)
frameName.
frameName -
frameName; returns null
if not found
static boolean matchNameAttribute(AttributeSet attr,
HTML.Tag tag)
StyleConstants.NameAttribute is
equal to the tag that is passed in as a parameter.
attr - the attributes to be matchedtag - the value to be matched
HTML.Attribute
private void updateFrameSet(Element element,
String url)
element - the frameset element to removeurl - the value for the SRC attribute for the
new frame that will replace the frameset
private void updateFrame(Element element,
String url)
HTML.Attribute.SRC attribute
and fires a ChangedUpdate event.
element - a FRAME element whose SRC attribute will be updatedurl - a string specifying the new value for the SRC attributeboolean isFrameDocument()
void setFrameDocumentState(boolean frameDoc)
frameDoc - true if the document will be viewed in a frame,
otherwise falsevoid addMap(Map map)
map - the Map to be registeredvoid removeMap(Map map)
map - the Map to be removedMap getMap(String name)
Map or null if it can't
be found, or if name is nullEnumeration getMaps()
Enumeration of the possible Maps.
null
if the maps are not an instance of Hashtablevoid setDefaultStyleSheetType(String contentType)
contentType - the content type language for the style sheetsString getDefaultStyleSheetType()
public void setParser(HTMLEditorKit.Parser parser)
setInnerHTML,
and setOuterHTML.
HTMLEditorKit.createDefaultDocument will set the parser
for you. If you create an HTMLDocument by hand,
be sure and set the parser accordingly.
parser - the parser to be used for text insertionpublic HTMLEditorKit.Parser getParser()
public void setInnerHTML(Element elem,
String htmlText)
throws BadLocationException,
IOException
This will be seen as at least two events, n inserts followed by a remove.
For this to work correcty, the document must have an
HTMLEditorKit.Parser set. This will be the case
if the document was created from an HTMLEditorKit via the
createDefaultDocument method.
elem - the branch element whose children will be replacedhtmlText - the string to be parsed and assigned to elem
IllegalArgumentException - if elem is a leaf
IllegalStateException - if an HTMLEditorKit.Parser
has not been defined
BadLocationException
IOException
public void setOuterHTML(Element elem,
String htmlText)
throws BadLocationException,
IOException
This will be seen as at least two events, n inserts followed by a remove.
When replacing a leaf this will attempt to make sure there is a newline present if one is needed. This may result in an additional element being inserted. Consider, if you were to replace a character element that contained a newline with <img> this would create two elements, one for the image, ane one for the newline.
If you try to replace the element at length you will most likely end up with two elements, eg setOuterHTML(getCharacterElement (getLength()), "blah") will result in two leaf elements at the end, one representing 'blah', and the other representing the end element.
For this to work correcty, the document must have an
HTMLEditorKit.Parser set. This will be the case if the document
was created from an HTMLEditorKit via the
createDefaultDocument method.
elem - the branch element whose children will be replacedhtmlText - the string to be parsed and assigned to elem
IllegalStateException - if an HTMLEditorKit.Parser has not
been set
BadLocationException
IOException
public void insertAfterStart(Element elem,
String htmlText)
throws BadLocationException,
IOException
For this to work correcty, the document must have an
HTMLEditorKit.Parser set. This will be the case
if the document was created from an HTMLEditorKit via the
createDefaultDocument method.
elem - the branch element to be the root for the new texthtmlText - the string to be parsed and assigned to elem
IllegalStateException - if an HTMLEditorKit.Parser has not
been set on the document
BadLocationException
IOException
public void insertBeforeEnd(Element elem,
String htmlText)
throws BadLocationException,
IOException
If elem's children are leaves, and the
character at a elem.getEndOffset() - 1 is a newline,
this will insert before the newline so that there isn't text after
the newline.
For this to work correcty, the document must have an
HTMLEditorKit.Parser set. This will be the case
if the document was created from an HTMLEditorKit via the
createDefaultDocument method.
elem - the element to be the root for the new texthtmlText - the string to be parsed and assigned to elem
IllegalStateException - if an HTMLEditorKit.Parser has not
been set on the document
BadLocationException
IOException
public void insertBeforeStart(Element elem,
String htmlText)
throws BadLocationException,
IOException
For this to work correcty, the document must have an
HTMLEditorKit.Parser set. This will be the case
if the document was created from an HTMLEditorKit via the
createDefaultDocument method.
elem - the element to be the root for the new texthtmlText - the string to be parsed and assigned to elem
IllegalStateException - if an HTMLEditorKit.Parser has not
been set on the document
BadLocationException
IOException
public void insertAfterEnd(Element elem,
String htmlText)
throws BadLocationException,
IOException
For this to work correcty, the document must have an
HTMLEditorKit.Parser set. This will be the case
if the document was created from an HTMLEditorKit via the
createDefaultDocument method.
elem - the element to be the root for the new texthtmlText - the string to be parsed and assigned to elem
IllegalStateException - if an HTMLEditorKit.Parser has not
been set on the document
BadLocationException
IOExceptionpublic Element getElement(String id)
Attribute.
If the element can't be found, null is returned.
Note that this method works on an Attribute,
not a character tag. In the following HTML snippet:
<a id="HelloThere"> the attribute is
'id' and the character tag is 'a'.
This is a convenience method for
getElement(RootElement, HTML.Attribute.id, id).
This is not thread-safe.
id - the string representing the desired Attribute
Attribute
or null if it can't be found,
or null if id is nullHTML.Attribute
public Element getElement(Element e,
Object attribute,
Object value)
e that contains the
attribute, attribute with value value, or
null if one isn't found. This is not thread-safe.
e - the root element where the search beginsattribute - the desired Attributevalue - the values for the specified Attribute
Attribute
and the specified value, or null
if it can't be foundHTML.Attribute
private Element getElement(Element e,
Object attribute,
Object value,
boolean searchLeafAttributes)
e that contains the
attribute, attribute with value value, or
null if one isn't found. This is not thread-safe.
If searchLeafAttributes is true, and e is
a leaf, any attributes that are instances of HTML.Tag
with a value that is an AttributeSet will also be checked.
e - the root element where the search beginsattribute - the desired Attributevalue - the values for the specified Attribute
Attribute
and the specified value, or null
if it can't be foundHTML.Attributeprivate void verifyParser()
HTMLEditorKit.Parser set.
If getParser returns null, this will throw an
IllegalStateException.
IllegalStateException - if the document does not have a Parserprivate void installParserIfNecessary()
private void insertHTML(Element parent,
int offset,
String html,
boolean wantsTrailingNewline)
throws BadLocationException,
IOException
parent is used to identify the location to insert the
html. If parent is a leaf this can have
unexpected results.
BadLocationException
IOException
private void removeElements(Element e,
int index,
int count)
throws BadLocationException
e. This
will do the necessary cleanup to ensure the element representing the
end character is correctly created.
This is not a general purpose method, it assumes that e
will still have at least one child after the remove, and it assumes
the character at e.getStartOffset() - 1 is a newline and
is of length 1.
BadLocationException
private void removeElementsAtEnd(Element e,
int index,
int count,
int start,
int end)
throws BadLocationException
e when one of the
elements to remove is representing the end character.
Since the Content will not allow a removal to the end character
this will do a remove from start - 1 to end.
The end Element(s) will be removed, and the element representing
start - 1 to start will be recreated. This
Element has to be recreated as after the content removal its offsets
become start - 1 to start - 1.
BadLocationException
private void replace(AbstractDocument.DefaultDocumentEvent dde,
Element e,
int index,
int count,
int start,
int end,
boolean remove,
boolean create)
throws BadLocationException
removeElementsAtEnd, it removes
count elements starting at start from
e. If remove is true text of length
start - 1 to end - 1 is removed. If
create is true a new leaf is created of length 1.
BadLocationException
private void removeElements(Element e,
int index,
int count,
int start,
int end)
throws BadLocationException
BadLocationExceptionvoid obtainLock()
void releaseLock()
protected void fireChangedUpdate(DocumentEvent e)
fireChangedUpdate in class AbstractDocumente - the eventEventListenerListprotected void fireUndoableEditUpdate(UndoableEditEvent e)
fireUndoableEditUpdate in class AbstractDocumente - the eventEventListenerListboolean hasBaseTag()
private static final boolean isComplex(char ch)
private static final boolean isComplex(char[] text,
int start,
int limit)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||