< prev index next >
src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java
Print this page
*** 122,132 ****
private ElementInfo getRootInfo() {
return rootElementInfo;
}
/**
! * Returns the root <code>View</code> associated with the current text
* component.
*/
private View getRootView() {
return getTextComponent().getUI().getRootView(getTextComponent());
}
--- 122,132 ----
private ElementInfo getRootInfo() {
return rootElementInfo;
}
/**
! * Returns the root {@code View} associated with the current text
* component.
*/
private View getRootView() {
return getTextComponent().getUI().getRootView(getTextComponent());
}
*** 149,159 ****
}
/**
* If possible acquires a lock on the Document. If a lock has been
* obtained a key will be retured that should be passed to
! * <code>unlock</code>.
*/
private Object lock() {
Document document = getDocument();
if (document instanceof AbstractDocument) {
--- 149,159 ----
}
/**
* If possible acquires a lock on the Document. If a lock has been
* obtained a key will be retured that should be passed to
! * {@code unlock}.
*/
private Object lock() {
Document document = getDocument();
if (document instanceof AbstractDocument) {
*** 162,172 ****
}
return null;
}
/**
! * Releases a lock previously obtained via <code>lock</code>.
*/
private void unlock(Object key) {
if (key != null) {
((AbstractDocument)key).readUnlock();
}
--- 162,172 ----
}
return null;
}
/**
! * Releases a lock previously obtained via {@code lock}.
*/
private void unlock(Object key) {
if (key != null) {
((AbstractDocument)key).readUnlock();
}
*** 255,267 ****
}
/**
* Gets the accessibleDescription property of this object. If this
* property isn't set, returns the content type of this
! * <code>JEditorPane</code> instead (e.g. "plain/text", "html/text").
*
! * @return the localized description of the object; <code>null</code>
* if this object does not have a description
*
* @see #setAccessibleName
*/
public String getAccessibleDescription() {
--- 255,267 ----
}
/**
* Gets the accessibleDescription property of this object. If this
* property isn't set, returns the content type of this
! * {@code JEditorPane} instead (e.g. "plain/text", "html/text").
*
! * @return the localized description of the object; {@code null}
* if this object does not have a description
*
* @see #setAccessibleName
*/
public String getAccessibleDescription() {
*** 872,884 ****
}
/**
* Gets the accessibleDescription property of this object. If this
* property isn't set, returns the content type of this
! * <code>JEditorPane</code> instead (e.g. "plain/text", "html/text").
*
! * @return the localized description of the object; <code>null</code>
* if this object does not have a description
*
* @see #setAccessibleName
*/
public String getAccessibleDescription() {
--- 872,884 ----
}
/**
* Gets the accessibleDescription property of this object. If this
* property isn't set, returns the content type of this
! * {@code JEditorPane} instead (e.g. "plain/text", "html/text").
*
! * @return the localized description of the object; {@code null}
* if this object does not have a description
*
* @see #setAccessibleName
*/
public String getAccessibleDescription() {
*** 980,990 ****
}
}
/**
* IndexedSegment extends Segment adding the offset into the
! * the model the <code>Segment</code> was asked for.
*/
private class IndexedSegment extends Segment {
/**
* Offset into the model that the position represents.
*/
--- 980,990 ----
}
}
/**
* IndexedSegment extends Segment adding the offset into the
! * the model the {@code Segment} was asked for.
*/
private class IndexedSegment extends Segment {
/**
* Offset into the model that the position represents.
*/
*** 1003,1014 ****
public String getBeforeIndex(int part, int index) {
return getAtIndex(part, index, -1);
}
/**
! * Gets the word, sentence, or character at <code>index</code>.
! * If <code>direction</code> is non-null this will find the
* next/previous word/sentence/character.
*/
private String getAtIndex(int part, int index, int direction) {
if (model instanceof AbstractDocument) {
((AbstractDocument)model).readLock();
--- 1003,1014 ----
public String getBeforeIndex(int part, int index) {
return getAtIndex(part, index, -1);
}
/**
! * Gets the word, sentence, or character at {@code index}.
! * If {@code direction} is non-null this will find the
* next/previous word/sentence/character.
*/
private String getAtIndex(int part, int index, int direction) {
if (model instanceof AbstractDocument) {
((AbstractDocument)model).readLock();
*** 1088,1099 ****
return para.getParentElement();
}
}
/*
! * Returns a <code>Segment</code> containing the paragraph text
! * at <code>index</code>, or null if <code>index</code> isn't
* valid.
*/
private IndexedSegment getParagraphElementText(int index)
throws BadLocationException {
Element para = getParagraphElement(index);
--- 1088,1099 ----
return para.getParentElement();
}
}
/*
! * Returns a {@code Segment} containing the paragraph text
! * at {@code index}, or null if {@code index} isn't
* valid.
*/
private IndexedSegment getParagraphElementText(int index)
throws BadLocationException {
Element para = getParagraphElement(index);
*** 1113,1124 ****
return null;
}
/**
! * Returns the Segment at <code>index</code> representing either
! * the paragraph or sentence as identified by <code>part</code>, or
* null if a valid paragraph/sentence can't be found. The offset
* will point to the start of the word/sentence in the array, and
* the modelOffset will point to the location of the word/sentence
* in the model.
*/
--- 1113,1124 ----
return null;
}
/**
! * Returns the Segment at {@code index} representing either
! * the paragraph or sentence as identified by {@code part}, or
* null if a valid paragraph/sentence can't be found. The offset
* will point to the start of the word/sentence in the array, and
* the modelOffset will point to the location of the word/sentence
* in the model.
*/
*** 1307,1319 ****
}
/**
* Gets the accessibleDescription property of this object. If this
* property isn't set, returns the content type of this
! * <code>JEditorPane</code> instead (e.g. "plain/text", "html/text").
*
! * @return the localized description of the object; <code>null</code>
* if this object does not have a description
*
* @see #setAccessibleName
*/
public String getAccessibleDescription() {
--- 1307,1319 ----
}
/**
* Gets the accessibleDescription property of this object. If this
* property isn't set, returns the content type of this
! * {@code JEditorPane} instead (e.g. "plain/text", "html/text").
*
! * @return the localized description of the object; {@code null}
* if this object does not have a description
*
* @see #setAccessibleName
*/
public String getAccessibleDescription() {
*** 1608,1620 ****
}
/**
* Gets the accessibleDescription property of this object. If this
* property isn't set, returns the content type of this
! * <code>JEditorPane</code> instead (e.g. "plain/text", "html/text").
*
! * @return the localized description of the object; <code>null</code>
* if this object does not have a description
*
* @see #setAccessibleName
*/
public String getAccessibleDescription() {
--- 1608,1620 ----
}
/**
* Gets the accessibleDescription property of this object. If this
* property isn't set, returns the content type of this
! * {@code JEditorPane} instead (e.g. "plain/text", "html/text").
*
! * @return the localized description of the object; {@code null}
* if this object does not have a description
*
* @see #setAccessibleName
*/
public String getAccessibleDescription() {
*** 2632,2642 ****
* ElementInfo provides a slim down view of an Element. Each ElementInfo
* can have any number of child ElementInfos that are not necessarily
* direct children of the Element. As the Document changes various
* ElementInfos become invalidated. Before accessing a particular portion
* of an ElementInfo you should make sure it is valid by invoking
! * <code>validateIfNecessary</code>, this will return true if
* successful, on the other hand a false return value indicates the
* ElementInfo is not valid and can never become valid again (usually
* the result of the Element the ElementInfo encapsulates being removed).
*/
private class ElementInfo {
--- 2632,2642 ----
* ElementInfo provides a slim down view of an Element. Each ElementInfo
* can have any number of child ElementInfos that are not necessarily
* direct children of the Element. As the Document changes various
* ElementInfos become invalidated. Before accessing a particular portion
* of an ElementInfo you should make sure it is valid by invoking
! * {@code validateIfNecessary}, this will return true if
* successful, on the other hand a false return value indicates the
* ElementInfo is not valid and can never become valid again (usually
* the result of the Element the ElementInfo encapsulates being removed).
*/
private class ElementInfo {
*** 2669,2679 ****
ElementInfo(Element element) {
this(element, null);
}
/**
! * Creates an ElementInfo representing <code>element</code> with
* the specified parent.
*/
ElementInfo(Element element, ElementInfo parent) {
this.element = element;
this.parent = parent;
--- 2669,2679 ----
ElementInfo(Element element) {
this(element, null);
}
/**
! * Creates an ElementInfo representing {@code element} with
* the specified parent.
*/
ElementInfo(Element element, ElementInfo parent) {
this.element = element;
this.parent = parent;
*** 2681,2700 ****
canBeValid = true;
}
/**
* Validates the receiver. This recreates the children as well. This
! * will be invoked within a <code>readLock</code>. If this is overriden
* it MUST invoke supers implementation first!
*/
protected void validate() {
isValid = true;
loadChildren(getElement());
}
/**
! * Recreates the direct children of <code>info</code>.
*/
protected void loadChildren(Element parent) {
if (!parent.isLeaf()) {
for (int counter = 0, maxCounter = parent.getElementCount();
counter < maxCounter; counter++) {
--- 2681,2700 ----
canBeValid = true;
}
/**
* Validates the receiver. This recreates the children as well. This
! * will be invoked within a {@code readLock}. If this is overriden
* it MUST invoke supers implementation first!
*/
protected void validate() {
isValid = true;
loadChildren(getElement());
}
/**
! * Recreates the direct children of {@code info}.
*/
protected void loadChildren(Element parent) {
if (!parent.isLeaf()) {
for (int counter = 0, maxCounter = parent.getElementCount();
counter < maxCounter; counter++) {
*** 2721,2731 ****
}
return parent.indexOf(this);
}
/**
! * Returns the Element this <code>ElementInfo</code> represents.
*/
public Element getElement() {
return element;
}
--- 2721,2731 ----
}
return parent.indexOf(this);
}
/**
! * Returns the Element this {@code ElementInfo} represents.
*/
public Element getElement() {
return element;
}
*** 2736,2746 ****
return parent;
}
/**
* Returns the index of the specified child, or -1 if
! * <code>child</code> isn't a valid child.
*/
public int indexOf(ElementInfo child) {
ArrayList<ElementInfo> children = this.children;
if (children != null) {
--- 2736,2746 ----
return parent;
}
/**
* Returns the index of the specified child, or -1 if
! * {@code child} isn't a valid child.
*/
public int indexOf(ElementInfo child) {
ArrayList<ElementInfo> children = this.children;
if (children != null) {
*** 2748,2759 ****
}
return -1;
}
/**
! * Returns the child ElementInfo at <code>index</code>, or null
! * if <code>index</code> isn't a valid index.
*/
public ElementInfo getChild(int index) {
if (validateIfNecessary()) {
ArrayList<ElementInfo> children = this.children;
--- 2748,2759 ----
}
return -1;
}
/**
! * Returns the child ElementInfo at {@code index}, or null
! * if {@code index} isn't a valid index.
*/
public ElementInfo getChild(int index) {
if (validateIfNecessary()) {
ArrayList<ElementInfo> children = this.children;
*** 2893,2905 ****
return deflt;
}
/**
* Validates the ElementInfo if necessary. Some ElementInfos may
! * never be valid again. You should check <code>isValid</code> before
* using one. This will reload the children and invoke
! * <code>validate</code> if the ElementInfo is invalid and can become
* valid again. This will return true if the receiver is valid.
*/
protected boolean validateIfNecessary() {
if (!isValid() && canBeValid) {
children = null;
--- 2893,2905 ----
return deflt;
}
/**
* Validates the ElementInfo if necessary. Some ElementInfos may
! * never be valid again. You should check {@code isValid} before
* using one. This will reload the children and invoke
! * {@code validate} if the ElementInfo is invalid and can become
* valid again. This will return true if the receiver is valid.
*/
protected boolean validateIfNecessary() {
if (!isValid() && canBeValid) {
children = null;
*** 3028,3038 ****
}
}
/**
* DocumentListener installed on the current Document. Will invoke
! * <code>update</code> on the <code>RootInfo</code> in response to
* any event.
*/
private class DocumentHandler implements DocumentListener {
public void insertUpdate(DocumentEvent e) {
getRootInfo().update(e);
--- 3028,3038 ----
}
}
/**
* DocumentListener installed on the current Document. Will invoke
! * {@code update} on the {@code RootInfo} in response to
* any event.
*/
private class DocumentHandler implements DocumentListener {
public void insertUpdate(DocumentEvent e) {
getRootInfo().update(e);
< prev index next >