< prev index next >
src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java
Print this page
*** 60,70 ****
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Timothy Prinzing
* @see Document
* @see AbstractDocument
--- 60,70 ----
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Timothy Prinzing
* @see Document
* @see AbstractDocument
*** 118,128 ****
}
/**
* Initialize the document to reflect the given element
* structure (i.e. the structure reported by the
! * <code>getDefaultRootElement</code> method. If the
* document contained any data it will first be removed.
* @param data the element data
*/
protected void create(ElementSpec[] data) {
try {
--- 118,128 ----
}
/**
* Initialize the document to reflect the given element
* structure (i.e. the structure reported by the
! * {@code getDefaultRootElement} method. If the
* document contained any data it will first be removed.
* @param data the element data
*/
protected void create(ElementSpec[] data) {
try {
*** 247,257 ****
* "\n"} character in document), this character is not removed;
* instead, preceding leaf element is extended to cover the
* character. If the last leaf already ends with {@code "\n",} it is
* included in content removal.</p>
*
! * <p>If the element is {@code null,} {@code NullPointerException} is
* thrown. If the element structure would become invalid after the removal,
* for example if the element is the document root element, {@code
* IllegalArgumentException} is thrown. If the current element structure is
* invalid, {@code IllegalStateException} is thrown.</p>
*
--- 247,257 ----
* "\n"} character in document), this character is not removed;
* instead, preceding leaf element is extended to cover the
* character. If the last leaf already ends with {@code "\n",} it is
* included in content removal.</p>
*
! * <p>If the element is {@code null, NullPointerException} is
* thrown. If the element structure would become invalid after the removal,
* for example if the element is the document root element, {@code
* IllegalArgumentException} is thrown. If the current element structure is
* invalid, {@code IllegalStateException} is thrown.</p>
*
*** 585,595 ****
writeUnlock();
}
}
/**
! * Gets the paragraph element at the offset <code>pos</code>.
* A paragraph consists of at least one child Element, which is usually
* a leaf.
*
* @param pos the starting offset >= 0
* @return the element
--- 585,595 ----
writeUnlock();
}
}
/**
! * Gets the paragraph element at the offset {@code pos}.
* A paragraph consists of at least one child Element, which is usually
* a leaf.
*
* @param pos the starting offset >= 0
* @return the element
*** 803,814 ****
super.insertUpdate( chng, attr );
}
/**
* This is called by insertUpdate when inserting after a new line.
! * It generates, in <code>parseBuffer</code>, ElementSpecs that will
! * position the stack in <code>paragraph</code>.<p>
* It returns the direction the last StartSpec should have (this don't
* necessarily create the last start spec).
*/
short createSpecsForInsertAfterNewline(Element paragraph,
Element pParagraph, AttributeSet pattr, Vector<ElementSpec> parseBuffer,
--- 803,814 ----
super.insertUpdate( chng, attr );
}
/**
* This is called by insertUpdate when inserting after a new line.
! * It generates, in {@code parseBuffer}, ElementSpecs that will
! * position the stack in {@code paragraph}.<p>
* It returns the direction the last StartSpec should have (this don't
* necessarily create the last start spec).
*/
short createSpecsForInsertAfterNewline(Element paragraph,
Element pParagraph, AttributeSet pattr, Vector<ElementSpec> parseBuffer,
*** 1130,1140 ****
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
protected class SectionElement extends BranchElement {
--- 1130,1140 ----
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
protected class SectionElement extends BranchElement {
*** 1162,1172 ****
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
public static class ElementSpec {
--- 1162,1172 ----
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
public static class ElementSpec {
*** 1398,1408 ****
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
public class ElementBuffer implements Serializable {
--- 1398,1408 ----
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
public class ElementBuffer implements Serializable {
*** 1927,1939 ****
break;
}
}
/**
! * Remove the elements from <code>elem</code> in range
! * <code>rmOffs0</code>, <code>rmOffs1</code>. This uses
! * <code>canJoin</code> and <code>join</code> to handle joining
* the endpoints of the insertion.
*
* @return true if elem will no longer have any elements.
*/
boolean removeElements(Element elem, int rmOffs0, int rmOffs1) {
--- 1927,1939 ----
break;
}
}
/**
! * Remove the elements from {@code elem} in range
! * {@code rmOffs0}, {@code rmOffs1}. This uses
! * {@code canJoin} and {@code join} to handle joining
* the endpoints of the insertion.
*
* @return true if elem will no longer have any elements.
*/
boolean removeElements(Element elem, int rmOffs0, int rmOffs1) {
*** 2169,2183 ****
/**
* Determines if a fracture needs to be performed. A fracture
* can be thought of as moving the right part of a tree to a
* new location, where the right part is determined by what has
! * been inserted. <code>depth</code> is used to indicate a
* JoinToFracture is needed to an element at a depth
! * of <code>depth</code>. Where the root is 0, 1 is the children
* of the root...
! * <p>This will invoke <code>fractureFrom</code> if it is determined
* a fracture needs to happen.
*/
void fracture(int depth) {
int cLength = insertPath.length;
int lastIndex = -1;
--- 2169,2183 ----
/**
* Determines if a fracture needs to be performed. A fracture
* can be thought of as moving the right part of a tree to a
* new location, where the right part is determined by what has
! * been inserted. {@code depth} is used to indicate a
* JoinToFracture is needed to an element at a depth
! * of {@code depth}. Where the root is 0, 1 is the children
* of the root...
! * <p>This will invoke {@code fractureFrom} if it is determined
* a fracture needs to happen.
*/
void fracture(int depth) {
int cLength = insertPath.length;
int lastIndex = -1;
*** 2219,2232 ****
}
}
/**
* Recreates the elements to the right of the insertion point.
! * This starts at <code>startIndex</code> in <code>changed</code>,
* and calls duplicate to duplicate existing elements.
* This will also duplicate the elements along the insertion
! * point, until a depth of <code>endFractureIndex</code> is
* reached, at which point only the elements to the right of
* the insertion point are duplicated.
*/
void fractureFrom(ElemChanges[] changed, int startIndex,
int endFractureIndex) {
--- 2219,2232 ----
}
}
/**
* Recreates the elements to the right of the insertion point.
! * This starts at {@code startIndex} in {@code changed},
* and calls duplicate to duplicate existing elements.
* This will also duplicate the elements along the insertion
! * point, until a depth of {@code endFractureIndex} is
* reached, at which point only the elements to the right of
* the insertion point are duplicated.
*/
void fractureFrom(ElemChanges[] changed, int startIndex,
int endFractureIndex) {
*** 2334,2347 ****
parent = newChild;
}
}
/**
! * Recreates <code>toDuplicate</code>. This is called when an
* element needs to be created as the result of an insertion. This
* will recurse and create all the children. This is similar to
! * <code>clone</code>, but deteremines the offsets differently.
*/
Element recreateFracturedElement(Element parent, Element toDuplicate) {
if(toDuplicate.isLeaf()) {
return createLeafElement(parent, toDuplicate.getAttributes(),
Math.max(toDuplicate.getStartOffset(),
--- 2334,2347 ----
parent = newChild;
}
}
/**
! * Recreates {@code toDuplicate}. This is called when an
* element needs to be created as the result of an insertion. This
* will recurse and create all the children. This is similar to
! * {@code clone}, but deteremines the offsets differently.
*/
Element recreateFracturedElement(Element parent, Element toDuplicate) {
if(toDuplicate.isLeaf()) {
return createLeafElement(parent, toDuplicate.getAttributes(),
Math.max(toDuplicate.getStartOffset(),
*** 2360,2370 ****
((BranchElement)newParent).replace(0, 0, newKids);
return newParent;
}
/**
! * Splits the bottommost leaf in <code>path</code>.
* This is called from insert when the first element is NOT content.
*/
void fractureDeepestLeaf(ElementSpec[] specs) {
// Split the bottommost leaf. It will be recreated elsewhere.
ElemChanges ec = path.peek();
--- 2360,2370 ----
((BranchElement)newParent).replace(0, 0, newKids);
return newParent;
}
/**
! * Splits the bottommost leaf in {@code path}.
* This is called from insert when the first element is NOT content.
*/
void fractureDeepestLeaf(ElementSpec[] specs) {
// Split the bottommost leaf. It will be recreated elsewhere.
ElemChanges ec = path.peek();
*** 2725,2735 ****
}
/**
* Added to the StyleContext. When the StyleContext changes, this invokes
! * <code>updateStylesListeningTo</code>.
*/
static class StyleContextChangeHandler extends AbstractChangeHandler {
StyleContextChangeHandler(DefaultStyledDocument d) {
super(d);
--- 2725,2735 ----
}
/**
* Added to the StyleContext. When the StyleContext changes, this invokes
! * {@code updateStylesListeningTo}.
*/
static class StyleContextChangeHandler extends AbstractChangeHandler {
StyleContextChangeHandler(DefaultStyledDocument d) {
super(d);
< prev index next >