org.openide.text
Class Annotatable

java.lang.Object
  |
  +--org.openide.text.Annotatable
Direct Known Subclasses:
Line, Line.Part

public abstract class Annotatable
extends Object

Classes which are capable of holding annotations must extend this abstract class. The examples of these classes are Line or Line.Part. It allows to add/remove Annotation(s) to this class. There is also support for listening on changes of the properties like deleted or count of attached annotations.

Since:
1.20

Field Summary
static String PROP_ANNOTATION_COUNT
          Property name of the count of annotations
static String PROP_DELETED
          Property name for the deleted attribute
static String PROP_TEXT
          Property name for the content of the annotatable
 
Constructor Summary
Annotatable()
           
 
Method Summary
protected  void addAnnotation(Annotation anno)
          Add annotation to this Annotatable class
 void addPropertyChangeListener(PropertyChangeListener l)
          Add listeners on changes of annotatable properties
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          Fire property change to registered listeners.
 int getAnnotationCount()
          The count of already attached annotations.
abstract  String getText()
          Get content of the annotatable.
 boolean isDeleted()
          Whether this Annotatable object was removed or not.
protected  void removeAnnotation(Annotation anno)
          Remove annotation to this Annotatable class
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove listeners on changes of annotatable properties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_ANNOTATION_COUNT

public static final String PROP_ANNOTATION_COUNT
Property name of the count of annotations

PROP_DELETED

public static final String PROP_DELETED
Property name for the deleted attribute

PROP_TEXT

public static final String PROP_TEXT
Property name for the content of the annotatable
Since:
1.35
Constructor Detail

Annotatable

public Annotatable()
Method Detail

addAnnotation

protected void addAnnotation(Annotation anno)
Add annotation to this Annotatable class
Parameters:
anno - annotation which will be attached to this class

removeAnnotation

protected void removeAnnotation(Annotation anno)
Remove annotation to this Annotatable class
Parameters:
anno - annotation which will be detached from this class

addPropertyChangeListener

public final void addPropertyChangeListener(PropertyChangeListener l)
Add listeners on changes of annotatable properties
Parameters:
l - change listener

removePropertyChangeListener

public final void removePropertyChangeListener(PropertyChangeListener l)
Remove listeners on changes of annotatable properties
Parameters:
l - change listener

firePropertyChange

protected final void firePropertyChange(String propertyName,
                                        Object oldValue,
                                        Object newValue)
Fire property change to registered listeners.

isDeleted

public final boolean isDeleted()
Whether this Annotatable object was removed or not.
Returns:
whether the Annotatable object was removed or not

getText

public abstract String getText()
Get content of the annotatable. The listeners can listen on changes of PROP_TEXT property to learn that content of Annotatable is changing.
Returns:
text representing the content of annotatable. The return value can be null, what means that document is closed.
Since:
1.35

getAnnotationCount

public final int getAnnotationCount()
The count of already attached annotations. Modules can use this property to learn whether to this instance are already attached some annotations or not.
Returns:
count of attached annotations


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.