com.levigo.jadice.annotation
Class Annotation

java.lang.Object
  extended by com.levigo.jadice.annotation.Annotation
All Implemented Interfaces:
PermissionsProvider<Annotation>, PropertiesProvider, MementoOriginator, Cloneable
Direct Known Subclasses:
ShapeBasedAnnotation

public abstract class Annotation
extends Object
implements PropertiesProvider, Cloneable, PermissionsProvider<Annotation>, MementoOriginator

An abstract base class for all annotations.


Field Summary
protected  Date createdAt
           
protected  String createdBy
           
protected  boolean doFireAnnotationEvents
          Flag whether annotation events should be fired.
protected  String id
          anno id
protected  AnnotationInitializer initializer
           
protected  boolean isModified
           
protected  Date lastModifiedAt
           
protected  String lastModifiedBy
           
 
Constructor Summary
Annotation()
           
 
Method Summary
 void clearModified()
          Clears the modified-flag.
abstract  Annotation clone()
           
protected  void copyAttributesTo(Annotation annotation)
          Copy annotation type related attributes to new annotation.
 Memento createMemento()
           
protected  void fireAnnotationChange(Annotation previousState, AnnotationPageSegmentEvent.EventType eventType, Object oldValue, Object newValue)
          Handle an annotation change
abstract  Rectangle2D getBounds()
          Returns a Rectangle2D that completely encloses the annotation.
 com.levigo.jadice.annotation.internal.AnnotationChangeHandler getChangeHandler()
          Returns the annotation change handler
 Date getCreatedAt()
           
 String getCreatedBy()
           
 String getID()
          Returns annotations id.
 AnnotationInitializer getInitializer()
           
 Date getLastModifiedAt()
           
 String getLastModifiedBy()
           
 int getModCount()
           
 Permissions<Annotation> getPermissions()
          Provides an instance of Permissions.
 Map<String,Object> getProperties()
          Return a map of user properties.
 AnnotationType getType()
          Get the type profile.
 void initialize(Page page)
           
 boolean isDoFireAnnotationEvents()
          Return whether this annotation instance propagates annotation events
 boolean isInitialized()
           
 boolean isModified()
          Returns modify status of the annotation.
 void restoreFrom(AnnotationMemento memento)
          This method is called back from AnnotationMemento upon Memento.restore()
 void setChangeHandler(com.levigo.jadice.annotation.internal.AnnotationChangeHandler changeHandler)
          Changes the annotation change handler.
 void setCreatedBy(String originatorName)
           
 void setCreationTimestamp(Date creationTimestamp)
           
 void setDoFireAnnotationEvents(boolean doFireAnnotationEvents)
          Changes the annotation event propagation mode.
 void setID(String id)
          Set annotation id.
 void setInitializer(AnnotationInitializer initializer)
           
 void setLastModifiedBy(String userName)
           
abstract  void setLocation(double x, double y)
          Set the location (upper-left corner) of the annotation to the given point.
 void setModified()
          Sets modified-flag.
 void setModifyTimestamp(Date modifyTimestamp)
           
abstract  void setSize(double width, double height)
          Set the size of the annotation to the given size.
 void setType(AnnotationType typeProfile)
          Set the type profile.
abstract  void translate(double dx, double dy)
          Translates this Annotation the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

createdBy

protected String createdBy

lastModifiedBy

protected String lastModifiedBy

createdAt

protected Date createdAt

lastModifiedAt

protected Date lastModifiedAt

initializer

protected AnnotationInitializer initializer

isModified

protected boolean isModified

id

protected String id
anno id


doFireAnnotationEvents

protected boolean doFireAnnotationEvents
Flag whether annotation events should be fired. As default this flag is set to false until this annotation instance is initialized and the creation process is finished.

Constructor Detail

Annotation

public Annotation()
Method Detail

translate

public abstract void translate(double dx,
                               double dy)
Translates this Annotation the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis.

Parameters:
dx - the distance to move this Rectangle along the x axis
dy - the distance to move this Rectangle along the y axis

setSize

public abstract void setSize(double width,
                             double height)
Set the size of the annotation to the given size. Depending on the type of annotation, this may not be possible. E.g. stamp annotations handle the sizing on their own, so they will refuse to resize themselves. An IllegalArgumentExceptionis thrown in this case. Caveat: it is currently necessary, to force a repaint on the viewer in order to make the results of the modification visible. Moreover there are no modification events fired on the page and document. This will change in the future.

Parameters:
width -
height -

setLocation

public abstract void setLocation(double x,
                                 double y)
Set the location (upper-left corner) of the annotation to the given point. Caveat: it is currently necessary, to force a repaint on the viewer in order to make the results of the modification visible. Moreover there are no modification events fired on the page and document. This will change in the future.

Parameters:
x - X-position
y - Y-position

getBounds

public abstract Rectangle2D getBounds()
Returns a Rectangle2D that completely encloses the annotation.

Returns:
Rectangle2D annotation bounding box

fireAnnotationChange

protected void fireAnnotationChange(Annotation previousState,
                                    AnnotationPageSegmentEvent.EventType eventType,
                                    Object oldValue,
                                    Object newValue)
Handle an annotation change


setID

public void setID(String id)
Set annotation id.

Parameters:
id - Id to set.

getID

public String getID()
Returns annotations id.

Returns:
Annotation id

setModified

public void setModified()
Sets modified-flag.


clearModified

public void clearModified()
Clears the modified-flag.


isModified

public boolean isModified()
Returns modify status of the annotation.

Returns:
Modify status.

clone

public abstract Annotation clone()
Overrides:
clone in class Object
See Also:
Object.clone()

copyAttributesTo

protected void copyAttributesTo(Annotation annotation)
Copy annotation type related attributes to new annotation.

Parameters:
annotation - Annotation to set attributes

isDoFireAnnotationEvents

public boolean isDoFireAnnotationEvents()
Return whether this annotation instance propagates annotation events

Returns:
true if this annotation propagates its internal changes as annotation event, otherwise false will be returned

setDoFireAnnotationEvents

public void setDoFireAnnotationEvents(boolean doFireAnnotationEvents)
Changes the annotation event propagation mode.

Parameters:
doFireAnnotationEvents - true if this annotation should propagate its internal changes as annotation event, otherwise false should be set.

getProperties

public Map<String,Object> getProperties()
Description copied from interface: PropertiesProvider
Return a map of user properties. What to store and which keys to use is largely up to the user of classes implementing this interface, since those classes will generally be oblivious to the map's contents. There are no guarantees regarding the thread-safety of the returned map, unless otherwise specified by implementors.

Specified by:
getProperties in interface PropertiesProvider
Returns:
the map of user properties

setInitializer

public void setInitializer(AnnotationInitializer initializer)

getInitializer

public AnnotationInitializer getInitializer()

isInitialized

public boolean isInitialized()

initialize

public void initialize(Page page)

getCreatedBy

public String getCreatedBy()

setCreatedBy

public void setCreatedBy(String originatorName)

getLastModifiedBy

public String getLastModifiedBy()

setLastModifiedBy

public void setLastModifiedBy(String userName)

getCreatedAt

public Date getCreatedAt()

setCreationTimestamp

public void setCreationTimestamp(Date creationTimestamp)

getLastModifiedAt

public Date getLastModifiedAt()

setModifyTimestamp

public void setModifyTimestamp(Date modifyTimestamp)

getModCount

public int getModCount()

setType

public void setType(AnnotationType typeProfile)
Set the type profile.

Parameters:
typeProfile - the typeProfile to set

getType

public AnnotationType getType()
Get the type profile.

Returns:
the typeProfile

setChangeHandler

public void setChangeHandler(com.levigo.jadice.annotation.internal.AnnotationChangeHandler changeHandler)
Changes the annotation change handler.

Parameters:
changeHandler -

getChangeHandler

public com.levigo.jadice.annotation.internal.AnnotationChangeHandler getChangeHandler()
Returns the annotation change handler

Returns:
AnnotationChangeHandler

getPermissions

public Permissions<Annotation> getPermissions()
Description copied from interface: PermissionsProvider
Provides an instance of Permissions. Must never return null.

Specified by:
getPermissions in interface PermissionsProvider<Annotation>
Returns:
a Permissions object.

createMemento

public Memento createMemento()
Specified by:
createMemento in interface MementoOriginator

restoreFrom

public void restoreFrom(AnnotationMemento memento)
This method is called back from AnnotationMemento upon Memento.restore()

Parameters:
memento -


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.