站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

Annotations (Editor Library) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.lib/1 1.14.0 3

org.netbeans.editor
Class Annotations

java.lang.Object
  extended by org.netbeans.editor.Annotations
All Implemented Interfaces:
EventListener, DocumentListener

public class Annotations
extends Object
implements DocumentListener

Annotations class act as data model containing all annotations attached to one document. Class uses instances of private class LineAnnotations for grouping of added annotations by line. These objects (LineAnnotations) are referenced from two collections. First one is Map where the key is Mark. It is used during the drawing in DrawLayerFactory.AnnotationLayer - when the mark appears in mark change, the LineAnnotations instance is found for it and the active annotation on the line can be queried. Second is List where the LineAnnotations are sorted by line number. This list is used for drawing the annotations in the gutter when the sequential order is important. The class also listen on document. It need to know how many lines where removed or added to refresh the LineAnnotations.line property.

Since:
07/2001

Nested Class Summary
static interface Annotations.AnnotationsListener
          Listener for listening on changes in Annotations object.
static class Annotations.LineAnnotations
          Manager of all annotations attached to one line.
static class Annotations.MenuComparator
           
 
Field Summary
static Comparator MENU_COMPARATOR
          Sorts the subMenu items
 
Constructor Summary
Annotations(BaseDocument doc)
           
 
Method Summary
 AnnotationDesc activateNextAnnotation(int line)
          Activate next annotation on the line.
 void addAnnotation(AnnotationDesc anno)
          Add annotation
 void addAnnotationsListener(Annotations.AnnotationsListener listener)
          Add AnnotationsListener listener
 void changedUpdate(DocumentEvent e)
          Gives notification that an attribute or set of attributes changed.
 JMenu createMenu(BaseKit kit, int line)
          Creates popup menu with all actions for the given line.
 JPopupMenu createPopupMenu(BaseKit kit, int line)
          Creates popup menu with all actions for the given line.
protected  void fireChangedAll()
          Fire AnnotationsListener.ChangedAll change
protected  void fireChangedLine(int line)
          Fire AnnotationsListener.ChangedLine change
 void frontAnnotation(AnnotationDesc anno)
          Move annotation in front of others.
 AnnotationDesc getActiveAnnotation(int line)
          Returns the active annotation for the given line number.
 AnnotationDesc getActiveAnnotation(Mark mark)
          Finds active annotation for the Mark.
 AnnotationDesc getAnnotation(int line, String type)
          Get next line number with some annotation
 DrawLayerFactory.AnnotationLayer getLayer()
          Finds the drawing layer for annotations
protected  Annotations.LineAnnotations getLineAnnotations(int line)
          Finds LineAnnotations for the given line number
 int getNextLineWithAnnotation(int line)
          Get next line number with some annotation
 int getNumberOfAnnotations(int line)
          Returns number of visible annotations on the line
 AnnotationDesc[] getPasiveAnnotations(int line)
          Return list of pasive annotations which should be drawn on the backgorund
 AnnotationDesc[] getPassiveAnnotations(int offset)
          Return list of passive annotations attached on the line of given offset
 void insertUpdate(DocumentEvent e)
          Checks the number of inserted lines and recalculate LineAnnotations.line property
 boolean isGlyphButtonColumn()
          Return whether this document has or had more annotations on one line.
 boolean isGlyphColumn()
          Return whether this document has or had any glyph icon attached.
protected  void refreshLine(int line)
          Notify view that it is necessary to redraw the line of the document
 void removeAnnotation(AnnotationDesc anno)
          Remove annotation
 void removeAnnotationsListener(Annotations.AnnotationsListener listener)
          Remove AnnotationsListener listener
 void removeUpdate(DocumentEvent e)
          Checks the number of removed lines and recalculate LineAnnotations.line property
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MENU_COMPARATOR

public static final Comparator MENU_COMPARATOR
Sorts the subMenu items

Constructor Detail

Annotations

public Annotations(BaseDocument doc)
Method Detail

getLayer

public DrawLayerFactory.AnnotationLayer getLayer()
Finds the drawing layer for annotations


addAnnotation

public void addAnnotation(AnnotationDesc anno)
Add annotation


removeAnnotation

public void removeAnnotation(AnnotationDesc anno)
Remove annotation


getActiveAnnotation

public AnnotationDesc getActiveAnnotation(Mark mark)
Finds active annotation for the Mark. It is called from DrawLayer when it found the DrawMark


getLineAnnotations

protected Annotations.LineAnnotations getLineAnnotations(int line)
Finds LineAnnotations for the given line number


getActiveAnnotation

public AnnotationDesc getActiveAnnotation(int line)
Returns the active annotation for the given line number. It is called from the glyph gutter


frontAnnotation

public void frontAnnotation(AnnotationDesc anno)
Move annotation in front of others. The activated annotation is moved in front of other annotations on the same line


activateNextAnnotation

public AnnotationDesc activateNextAnnotation(int line)
Activate next annotation on the line. Used for cycling through the annotations


getNextLineWithAnnotation

public int getNextLineWithAnnotation(int line)
Get next line number with some annotation


getAnnotation

public AnnotationDesc getAnnotation(int line,
                                    String type)
Get next line number with some annotation


getPasiveAnnotations

public AnnotationDesc[] getPasiveAnnotations(int line)
Return list of pasive annotations which should be drawn on the backgorund


getPassiveAnnotations

public AnnotationDesc[] getPassiveAnnotations(int offset)
Return list of passive annotations attached on the line of given offset


getNumberOfAnnotations

public int getNumberOfAnnotations(int line)
Returns number of visible annotations on the line


refreshLine

protected void refreshLine(int line)
Notify view that it is necessary to redraw the line of the document


removeUpdate

public void removeUpdate(DocumentEvent e)
Checks the number of removed lines and recalculate LineAnnotations.line property

Specified by:
removeUpdate in interface DocumentListener

insertUpdate

public void insertUpdate(DocumentEvent e)
Checks the number of inserted lines and recalculate LineAnnotations.line property

Specified by:
insertUpdate in interface DocumentListener

changedUpdate

public void changedUpdate(DocumentEvent e)
Gives notification that an attribute or set of attributes changed.

Specified by:
changedUpdate in interface DocumentListener

addAnnotationsListener

public void addAnnotationsListener(Annotations.AnnotationsListener listener)
Add AnnotationsListener listener


removeAnnotationsListener

public void removeAnnotationsListener(Annotations.AnnotationsListener listener)
Remove AnnotationsListener listener


fireChangedLine

protected void fireChangedLine(int line)
Fire AnnotationsListener.ChangedLine change


fireChangedAll

protected void fireChangedAll()
Fire AnnotationsListener.ChangedAll change


isGlyphColumn

public boolean isGlyphColumn()
Return whether this document has or had any glyph icon attached. This method is called from glyph gutter to check whether the glyph column should be drawn or not.


isGlyphButtonColumn

public boolean isGlyphButtonColumn()
Return whether this document has or had more annotations on one line. This method is called from glyph gutter to check whether the glyph cycling column should be drawn or not.


createPopupMenu

public JPopupMenu createPopupMenu(BaseKit kit,
                                  int line)
Creates popup menu with all actions for the given line.


createMenu

public JMenu createMenu(BaseKit kit,
                        int line)
Creates popup menu with all actions for the given line.


org.netbeans.modules.editor.lib/1 1.14.0 3

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.