Java Code Examples for javax.swing.text.View#getDocument()

The following examples show how to use javax.swing.text.View#getDocument() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JHtmlLabel.java    From zxpoly with GNU General Public License v3.0 6 votes vote down vote up
private void cacheLinkElements() {
  this.linkCache = new ArrayList<>();
  final View view = (View) this.getClientProperty("html"); //NOI18N
  if (view != null) {
    final HTMLDocument doc = (HTMLDocument) view.getDocument();
    final HTMLDocument.Iterator it = doc.getIterator(HTML.Tag.A);
    while (it.isValid()) {
      final SimpleAttributeSet s = (SimpleAttributeSet) it.getAttributes();
      final String link = (String) s.getAttribute(HTML.Attribute.HREF);
      if (link != null) {
        this.linkCache.add(new HtmlLinkAddress(link, it.getStartOffset(), it.getEndOffset()));
      }
      it.next();
    }
  }
}
 
Example 2
Source File: JHtmlLabel.java    From netbeans-mmd-plugin with Apache License 2.0 6 votes vote down vote up
private void cacheLinkElements() {
  this.linkCache = new ArrayList<>();
  final View view = (View) this.getClientProperty("html"); //NOI18N
  if (view != null) {
    final HTMLDocument doc = (HTMLDocument) view.getDocument();
    final HTMLDocument.Iterator it = doc.getIterator(HTML.Tag.A);
    while (it.isValid()) {
      final SimpleAttributeSet s = (SimpleAttributeSet) it.getAttributes();
      final String link = (String) s.getAttribute(HTML.Attribute.HREF);
      if (link != null) {
        this.linkCache.add(new HtmlLinkAddress(link, it.getStartOffset(), it.getEndOffset()));
      }
      it.next();
    }
  }
}
 
Example 3
Source File: JHtmlLabel.java    From netbeans-mmd-plugin with Apache License 2.0 6 votes vote down vote up
private void cacheLinkElements() {
  this.linkCache = new ArrayList<HtmlLinkAddress>();
  final View view = (View) this.getClientProperty("html");
  if (view != null) {
    final HTMLDocument doc = (HTMLDocument) view.getDocument();
    final HTMLDocument.Iterator it = doc.getIterator(HTML.Tag.A);
    while (it.isValid()) {
      final SimpleAttributeSet s = (SimpleAttributeSet) it.getAttributes();
      final String link = (String) s.getAttribute(HTML.Attribute.HREF);
      if (link != null) {
        this.linkCache.add(new HtmlLinkAddress(link, it.getStartOffset(), it.getEndOffset()));
      }
      it.next();
    }
  }
}
 
Example 4
Source File: JHtmlLabel.java    From netbeans-mmd-plugin with Apache License 2.0 6 votes vote down vote up
private void cacheLinkElements() {
  this.linkCache = new ArrayList<HtmlLinkAddress>();
  final View view = (View) this.getClientProperty("html");
  if (view != null) {
    final HTMLDocument doc = (HTMLDocument) view.getDocument();
    final HTMLDocument.Iterator it = doc.getIterator(HTML.Tag.A);
    while (it.isValid()) {
      final SimpleAttributeSet s = (SimpleAttributeSet) it.getAttributes();
      final String link = (String) s.getAttribute(HTML.Attribute.HREF);
      if (link != null) {
        this.linkCache.add(new HtmlLinkAddress(link, it.getStartOffset(), it.getEndOffset()));
      }
      it.next();
    }
  }
}
 
Example 5
Source File: EditorView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Document getDocument() {
    View parent = getParent();
    // By default do not assume non-null element for view construction => return null
    // Possibly use getElement().getDocument() in descendants
    return (parent != null) ? parent.getDocument() : null;
}
 
Example 6
Source File: FoldView.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Document getDocument() {
    View parent = getParent();
    return (parent != null) ? parent.getDocument() : null;
}
 
Example 7
Source File: CollapsedView.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public @Override Document getDocument() {
    View parent = getParent();
    return (parent == null) ?  null : parent.getDocument();
}
 
Example 8
Source File: HighlightsView.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Document getDocument() {
    View parent = getParent();
    return (parent != null) ? parent.getDocument() : null;
}
 
Example 9
Source File: TestHighlightsView.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Document getDocument() {
    View parent = getParent();
    return (parent != null) ? parent.getDocument() : null;
}