Class Wrangler<Type extends Annotation>
java.lang.Object
com.levigo.jadice.annotation.AnnotationWrangler
com.levigo.jadice.web.client.internal.annotation.Wrangler<Type>
- Type Parameters:
Type
- class extendingAnnotation
- Direct Known Subclasses:
DefaultWrangler
Base class of all wranglers.
Provides generic methods for creating, editing and managing annotations. Does not know specific annotation types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
afterCreate
(EditEvent e, Type createdAnnotation, Object... params) Invoked after the creation of an annotation is finished.abstract void
contribute
(ContributionContext cc, MenuBuilder builder, List<? extends Annotation> selected) Contributes to the annotation toolbar.abstract String
getCursor
(Annotation a, Document d, AnnotationSelection s) Returns the css-value for the cursor to be used when hovering the Annotation this wrangler is attached to.getHandles
(PageView pageView, Page page, Type annotation) Creates handles for a specific annotation.abstract boolean
handleCreateEditEvent
(EditEvent e, Type annotation) Invoked during the creation of an annotation.abstract void
handleEditEvent
(EditEvent e, Type selected, AnnotationEditor editor) Invoked when an existing annotation shall be edited.Methods inherited from class com.levigo.jadice.annotation.AnnotationWrangler
isSelectionPoint
-
Constructor Details
-
Wrangler
public Wrangler()
-
-
Method Details
-
getHandles
Creates handles for a specific annotation.- Parameters:
pageView
- PageView the annotation is shown on (for example for repaint calls)page
- The page that contains the annotationannotation
- The annotation the wrangler should create handles for- Returns:
- Handles that can be used to edit the annotation
-
handleCreateEditEvent
Invoked during the creation of an annotation.Can be invoked multiple times. For example during the creation of a polygon based annotation each mouse down event could indicate a new corner of the polygon at the current mouse position.
- Parameters:
e
- An event that controls a part of the creationannotation
- The annotation that shall be created- Returns:
- True when creation finished, false else
-
afterCreate
Invoked after the creation of an annotation is finished.Can be used to process an annotation immediately after its creation. For example after the creation of a text based annotation this method could be used to open the text editor.
- Parameters:
e
- The event of the last call tohandleCreateEditEvent(EditEvent, Annotation)
createdAnnotation
- The newly created annotationparams
- An optional array containing parameters
-
handleEditEvent
Invoked when an existing annotation shall be edited.- Parameters:
e
- The event that triggered the editingselected
- The annotation to be editededitor
- The annotation editor that provides all editing options for the annotation
-
getCursor
Returns the css-value for the cursor to be used when hovering the Annotation this wrangler is attached to. Call UIStyler.get().cursorStyle().{any function} for possible return values.- Parameters:
a
- the annotation in questiond
- the document it is part ofs
- the current selection of annotations- Returns:
- The css-value for the cursor, e.g. "pointer"
-