public class AnnotationTool
extends com.levigo.jadice.swing.internal.tool.AbstractBaseTool
Annotation
s.Modifier and Type | Class and Description |
---|---|
static class |
AnnotationTool.Mode |
Tool.ActivationRequest
Modifier and Type | Field and Description |
---|---|
static ExtResourceBundle |
BUNDLE |
activeGesture, currentPage, enableContextToolbar, isActive, lastRenderControls, lastRenderedPageBounds
DEFAULT_PRIORITY, MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
AnnotationTool() |
Modifier and Type | Method and Description |
---|---|
protected void |
activateToolbar() |
protected void |
afterHandleEditEvent(boolean isActive,
EditEvent e,
Object gadget)
Override this method in order to perform some tasks after the main edit event handling has been
completed.
|
protected Object |
beforeHandleEditEvent(boolean isActive,
EditEvent e)
Override this method in order to perform some tasks before the main edit event handling
commences.
|
protected void |
checkForRenderGeometryChange(RenderControls pageRenderControls,
Rectangle renderedPageBounds) |
void |
clearSelection()
Deselect all annotations.
|
void |
contribute(ContributionContext context,
MenuBuilder contextMenu)
This method is called in order to give the menu contributor a chance to contribute context menu
entries via the supplied
MenuBuilder . |
void |
deleteSelected()
Delete all selected annotations.
|
void |
deselect(Annotation a)
Deselect given annotation object.
|
Tool.ActivationRequest |
getActivationFeedback(MouseEditEvent e)
Provide feedback for the user about what would happen, if the mouse were pressed at the current
location.
|
protected com.levigo.jadice.swing.internal.annotation.editors.AnnotationHoverEditor |
getContextToolbar() |
AnnotationFactory |
getCreateMode()
Returns the annotation factory used to create the annotation(s) while in create mode.
|
Rectangle |
getCurrentPageRenderBounds() |
RenderControls |
getCurrentPageRenderControls() |
protected int |
getDispatchPriority()
Return the dispatch priority for this tool.
|
Set<DocumentLayer> |
getEditableAnnotationLayers()
Return all
DocumentLayer that are considered for annotation editing purposes. |
com.levigo.jadice.swing.internal.annotation.editors.SwingAnnotationEditor |
getEditor() |
AnnotationTool.Mode |
getMode()
Returns the annotation mode.
|
DocumentLayer |
getNewAnnotationLayer()
Return the layer onto which newly created annotations are to be placed.
|
protected Point |
getPreferredToolbarLocation() |
List<Annotation> |
getSelection()
Returns an unmodifiable view of the currently selected annotations.
|
protected void |
handleEditEventPreDispatch(EditEvent e)
Override this method in order to get a shot at handling the edit event before it is dispatched
to the detail handeXXX-methods.
|
protected void |
handleKeyPressed(KeyEditEvent e,
boolean isActive)
Invoked when a key has been pressed.
|
protected void |
handleMouseMoved(MouseEditEvent e,
boolean isActive)
Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.
|
protected void |
handleMousePressed(MouseEditEvent e,
boolean isActive)
Invoked when a mouse button has been pressed on a component.
|
protected void |
handleMouseReleased(MouseEditEvent e,
boolean isActive)
Invoked when a mouse button has been released on a component.
|
boolean |
isAdjustAnnotationToPageBoundsOnCreation()
Returns a boolean which decides if
Annotation s get adjusted to the page bounds after
creation. |
static boolean |
isOverSelectionPoint(MouseEditEvent e,
List<Annotation> selection) |
boolean |
isResetAnnotationModeAfterCreation()
Returns the resetAnnotationModeAfterCreation.
|
static void |
paintHandles(com.levigo.jadice.swing.internal.tool.Handle[] handles,
RenderParameters parameters,
Annotation annotation) |
protected void |
render(RenderParameters parameters,
boolean isActive)
Renders the Tool's UI onto the given
Graphics2D context using the given
RenderControls . |
void |
select(Annotation annotation,
Page onPage)
Selects the given annotation
|
void |
select(Collection<Annotation> annotations,
Page page)
Selects all the annotations within the given collection
|
protected void |
setActive(boolean active)
Receive notification from the tool manager about the tool's active state.
|
void |
setAdjustAnnotationToPageBoundsOnCreation(boolean adjustAnnotationToPageBoundsOnCreation)
Sets a boolean to decide if
Annotation s get adjusted to page bounds after creation. |
void |
setCreateMode(AnnotationFactory annotationFactory)
Set the tool's mode to create annotations of the given type (
AnnotationTool.Mode.CREATE ). |
void |
setEditMode()
(Re-)Set the tool's mode to edit existing annotations (
AnnotationTool.Mode.EDIT ). |
protected void |
setManager(ToolManager manager)
Receives the
ToolManager instance, which the Tool implementation has been
registered for. |
void |
setNewAnnotationLayer(DocumentLayer newAnnotationLayer)
Set the layer onto which newly created annotations are to be placed.
|
void |
setResetAnnotationModeAfterCreation(boolean resetAnnotationModeAfterCreation)
Sets the resetAnnotationModeAfterCreation.
|
protected boolean |
shallHandleEditEvent(boolean isActive,
EditEvent e)
Override this method in order to determine whether the given even shall be handled at all.
|
protected boolean |
toolbarShallBeActive() |
autoscroll, deactivateToolbar, endGesture, getActiveGesture, getCurrentPage, getUndoManager, handleEditEvent, isEnableContextToolbar, serviceGesture, setEnableContextToolbar, startGesture, switchFocus, updateToolbarLocation, updateToolbarVisibility
getActivationRequest, getActivationRequestForKeyPressed, getActivationRequestForMouseDragged, getActivationRequestForMousePressed, getCursor, getManager, getRenderPriority, handleKeyReleased, handleKeyTyped, handleMouseClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseWheelMoved, propagatePropertyChange, setCursor, setEnabled, setStatusFeedback
public static final ExtResourceBundle BUNDLE
@CallOnEDT public AnnotationTool()
protected void handleKeyPressed(KeyEditEvent e, boolean isActive)
Tool
KeyEvent
for a
definition of a key pressed event.handleKeyPressed
in class Tool
isActive
- whether this tool is currently activeprotected void handleMousePressed(MouseEditEvent e, boolean isActive)
Tool
handleMousePressed
in class Tool
isActive
- whether this tool is currently active@CallOnEDT public Tool.ActivationRequest getActivationFeedback(MouseEditEvent e)
Tool
MouseEvent.MOUSE_MOVED
events. If this
method returns null
no feedback is provided at all.
The activation request returned from this method is the same object that is used during
Tool.getActivationRequestForKeyPressed(KeyEditEvent)
to signal the auto-activation
candidacy.
This method should only return an activation request if it will actually candidate for
auto-activation later on using Tool.getActivationRequestForMousePressed(MouseEditEvent)
or
Tool.getActivationRequestForMouseDragged(MouseEditEvent)
.getActivationFeedback
in class Tool
@CallOnEDT public void clearSelection()
IllegalStateException
- if the calling thread is not the Event Dispatch
Thread
@CallOnEDT public void deselect(Annotation a)
a
- Annotation to deselectIllegalStateException
- if the calling thread is not the Event Dispatch
Thread
@CallOnEDT public void select(Annotation annotation, Page onPage)
onPage
- the page on which the annotation residesIllegalStateException
- if the calling thread is not the Event Dispatch
Thread
@CallOnEDT public void select(Collection<Annotation> annotations, Page page)
page
- the page on which the annotations resideIllegalStateException
- if the calling thread is not the Event Dispatch
Thread
protected boolean shallHandleEditEvent(boolean isActive, EditEvent e)
com.levigo.jadice.swing.internal.tool.AbstractBaseTool
shallHandleEditEvent
in class com.levigo.jadice.swing.internal.tool.AbstractBaseTool
true
if the event shall be handled, false
otherwiseprotected Object beforeHandleEditEvent(boolean isActive, EditEvent e)
com.levigo.jadice.swing.internal.tool.AbstractBaseTool
AbstractBaseTool.afterHandleEditEvent(boolean, EditEvent, Object)
.beforeHandleEditEvent
in class com.levigo.jadice.swing.internal.tool.AbstractBaseTool
isActive
- TODOe
- TODOprotected void afterHandleEditEvent(boolean isActive, EditEvent e, Object gadget)
com.levigo.jadice.swing.internal.tool.AbstractBaseTool
AbstractBaseTool.beforeHandleEditEvent(boolean, EditEvent)
.afterHandleEditEvent
in class com.levigo.jadice.swing.internal.tool.AbstractBaseTool
isActive
- TODOe
- TODOprotected void handleEditEventPreDispatch(EditEvent e)
com.levigo.jadice.swing.internal.tool.AbstractBaseTool
handleEditEventPreDispatch
in class com.levigo.jadice.swing.internal.tool.AbstractBaseTool
protected void activateToolbar()
activateToolbar
in class com.levigo.jadice.swing.internal.tool.AbstractBaseTool
protected boolean toolbarShallBeActive()
toolbarShallBeActive
in class com.levigo.jadice.swing.internal.tool.AbstractBaseTool
@CallOnEDT public com.levigo.jadice.swing.internal.annotation.editors.SwingAnnotationEditor getEditor()
protected com.levigo.jadice.swing.internal.annotation.editors.AnnotationHoverEditor getContextToolbar()
getContextToolbar
in class com.levigo.jadice.swing.internal.tool.AbstractBaseTool
protected void handleMouseMoved(MouseEditEvent e, boolean isActive)
Tool
handleMouseMoved
in class Tool
isActive
- whether this tool is currently active@CallOnEDT public static boolean isOverSelectionPoint(MouseEditEvent e, List<Annotation> selection)
protected void handleMouseReleased(MouseEditEvent e, boolean isActive)
Tool
handleMouseReleased
in class Tool
isActive
- whether this tool is currently active@CallOnEDT public AnnotationFactory getCreateMode()
@CallOnEDT public AnnotationTool.Mode getMode()
@CallOnEDT public void setEditMode()
AnnotationTool.Mode.EDIT
).protected void setActive(boolean active)
Tool
setActive
in class com.levigo.jadice.swing.internal.tool.AbstractBaseTool
@CallOnEDT public void setCreateMode(AnnotationFactory annotationFactory)
AnnotationTool.Mode.CREATE
).IllegalStateException
- if the calling thread is not the Event Dispatch
Thread
public boolean isAdjustAnnotationToPageBoundsOnCreation()
Annotation
s get adjusted to the page bounds after
creation.true
if annotations get adjusted otherwise false
.@CallOnEDT public void setAdjustAnnotationToPageBoundsOnCreation(boolean adjustAnnotationToPageBoundsOnCreation)
Annotation
s get adjusted to page bounds after creation.adjustAnnotationToPageBoundsOnCreation
- The resetAnnotationModeAfterCreation to setIllegalStateException
- if the calling thread is not the Event Dispatch
Thread
@CallOnEDT public boolean isResetAnnotationModeAfterCreation()
IllegalStateException
- if the calling thread is not the Event Dispatch
Thread
@CallOnEDT public void setResetAnnotationModeAfterCreation(boolean resetAnnotationModeAfterCreation)
resetAnnotationModeAfterCreation
- The resetAnnotationModeAfterCreation to setIllegalStateException
- if the calling thread is not the Event Dispatch
Thread
protected int getDispatchPriority()
Tool
Tool.MIN_PRIORITY
...Tool.MAX_PRIORITY
.
The default priority is equal to Tool.MAX_PRIORITY
minus the render priority.getDispatchPriority
in class Tool
protected void render(RenderParameters parameters, boolean isActive)
Tool
Graphics2D
context using the given
RenderControls
.
This render method is called within the context and during the rendering of a single page. The page being rendered is passed to implementors of this method in order to be able to control and influence the page rendering.
render
in class com.levigo.jadice.swing.internal.tool.AbstractBaseTool
parameters
- the view component which is currently being renderedisActive
- whether the called tool is currently activeprotected void checkForRenderGeometryChange(RenderControls pageRenderControls, Rectangle renderedPageBounds)
checkForRenderGeometryChange
in class com.levigo.jadice.swing.internal.tool.AbstractBaseTool
@CallOnEDT public static void paintHandles(com.levigo.jadice.swing.internal.tool.Handle[] handles, RenderParameters parameters, Annotation annotation)
protected void setManager(ToolManager manager)
Tool
ToolManager
instance, which the Tool
implementation has been
registered for. If the Tool
is deregistered
this
method will be called with null.setManager
in class Tool
@CallOnEDT public List<Annotation> getSelection()
@CallOnEDT public void deleteSelected()
IllegalStateException
- if the calling thread is not the Event Dispatch
Thread
@CallOnEDT public void contribute(ContributionContext context, MenuBuilder contextMenu)
MenuContributor
MenuBuilder
.contribute
in interface MenuContributor
contribute
in class Tool
context
- the ContributionContext
which provides contribution context informationscontextMenu
- the MenuBuilder
to which the tool may contribute entries.protected Point getPreferredToolbarLocation()
getPreferredToolbarLocation
in class com.levigo.jadice.swing.internal.tool.AbstractBaseTool
@CallOnEDT public Rectangle getCurrentPageRenderBounds()
@CallOnEDT public RenderControls getCurrentPageRenderControls()
@CallOnEDT public Set<DocumentLayer> getEditableAnnotationLayers()
DocumentLayer
that are considered for annotation editing purposes. By
default only the DocumentLayer.ANNOTATIONS
is considered.
The list is live and can be edited to add or remove layers to be considered.
@CallOnEDT public DocumentLayer getNewAnnotationLayer()
DocumentLayer.ANNOTATIONS
.@CallOnEDT public void setNewAnnotationLayer(DocumentLayer newAnnotationLayer)
DocumentLayer.ANNOTATIONS
.newAnnotationLayer
- the document layer for new annotationsCopyright © 2024 levigo holding gmbh. All rights reserved.