Class HoverLensTool
java.lang.Object
com.levigo.jadice.web.client.tool.Tool
com.levigo.jadice.web.client.tools.HoverLensTool
- All Implemented Interfaces:
MenuContributor
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.levigo.jadice.web.client.tool.Tool
Tool.ActivationRequest
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final float
the default zoom factor at startFields inherited from class com.levigo.jadice.web.client.tool.Tool
DEFAULT_PRIORITY, MAX_PRIORITY, MIN_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Tool.ActivationRequest
Provide feedback for the user about what would happen, if the mouse were pressed at the current location.protected Tool.ActivationRequest
Return the auto-activation request for this this tool in response to the given event.protected int
Return the dispatch priority for this tool.Return the frozen state mode, which describes how instances of hover lens handles the frozen mode.float
Get the initial zoom factor when displaying the lens.protected int
Return the render priority for this tool.float
protected void
Invoked when a multi touch gesture started.protected void
handleKeyPressed
(KeyEditEvent editEvent, boolean isActive) Invoked when a key has been pressed.protected void
handleMouseClicked
(MouseEditEvent e, boolean isActive) Invoked when the mouse button has been clicked (pressed and released) on a component.protected void
handleMouseDragged
(MouseEditEvent e, boolean isActive) Invoked when a mouse button is pressed on a component and then dragged.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.protected void
handlePointerDown
(PointerEditEvent e, boolean isActive) Invoked when a pointer event starts.protected void
handlePointerMove
(PointerEditEvent e, boolean isActive) Invoked when a pointer event move.protected void
handleTouchEnd
(TouchEditEvent e, boolean isActive) Invoked when a touch ended.protected void
handleTouchMove
(TouchEditEvent e, boolean isActive) Invoked when a touch changed.boolean
boolean
isFrozen()
Gets the frozen state of the lens.protected void
recalculatePositionAfterRotation
(BaseRenderSettings.Rotation oldRotation, BaseRenderSettings.Rotation newRotation) protected void
recalculatePositionAfterZoom
(float oldZoom, float newZoom) protected void
render
(RenderParameters parameters, boolean isActive) Renders the Tool's UI onto the givenGraphics2D
context using the givenRenderControls
.void
Reset the zoom factor to its initial value, e.g. after changing the size or shape of the lensprotected void
setActive
(boolean active) Receive notification from the tool manager about the tool's active state.void
setDeactivateFrozenStateOnlyInLensArea
(boolean deactivateFrozenStateOnlyInLensArea) Set if the frozen state should be changed only if the mouse position points to the lens interior.void
setFrozen
(boolean frozen) Sets / unsets the frozen state where the lens will remain in focus of the last point before being set to frozen.void
setFrozenStateMode
(FrozenStateMode frozenStateMode) Set the frozen state mode, which describes how instances of hover lens handles the frozen mode.void
setHoverShape
(HoverLensTool.HoverShape hoverShape) !!void
setHoverSize
(Dimension hoverSize) !!void
setInitialZoomFactor
(float initialZoomFactor) Set the initial zoom factor when displaying the lens.void
setScaleStep
(float defaultScaleStep) Set the default step to increase / decrease the scale valueMethods inherited from class com.levigo.jadice.web.client.tool.Tool
contribute, ensureDebugId, getActivationFeedback, getActivationRequestForKeyPressed, getActivationRequestForMouseDragged, getActivationRequestForMousePressed, getActivationRequestForTouchMove, getActivationRequestForTouchStart, getManager, handleEditEvent, handleGestureChange, handleGestureEnd, handleKeyReleased, handleKeyTyped, handleMouseEntered, handleMouseExited, handleMouseWheelMoved, handlePointerUp, handleTouchStart, propagatePropertyChange, setCursor, setCursor, setEnabled, setManager, setStatusFeedback
-
Field Details
-
DEFAULT_ZOOM
public static final float DEFAULT_ZOOMthe default zoom factor at start- See Also:
-
-
Constructor Details
-
HoverLensTool
public HoverLensTool()
-
-
Method Details
-
setHoverShape
!! At the moment we support only circles and rectangles, but no ellipse. Therefore we set both dimensions to the smaller value of width and height for the first time the lens is actually used if the shape isHoverLensTool.HoverShape.CIRCLE
and the two dimensions differ. It is planned to introduce ellipses in future versions.- Parameters:
hoverShape
- theHoverLensTool.HoverShape
. In case this isHoverLensTool.HoverShape.CIRCLE
, please take notice of above hint.
-
setHoverSize
!! At the moment we support only circles and rectangles, but no ellipse. Therefore we set both dimensions to the smaller value of width and height for the first time the lens is actually used if the shape isHoverLensTool.HoverShape.CIRCLE
and the two dimensions differ.- Parameters:
hoverSize
- width, height. In case the shape isHoverLensTool.HoverShape.CIRCLE
, please take notice of above hint.
-
getHoverSize
- Returns:
- the
Lens'
size
-
getHoverShape
- Returns:
- the
HoverLensTool.HoverShape
-
getDispatchPriority
protected int getDispatchPriority()Description copied from class:Tool
Return the dispatch priority for this tool. Tools with higher dispatch priorities receive events earlier than tools with lower priorities. The priority should be in the rangeTool.MIN_PRIORITY
...Tool.MAX_PRIORITY
. The default priority is equal toTool.MAX_PRIORITY
minus the render priority.- Overrides:
getDispatchPriority
in classTool
- Returns:
- the dispatch priority
-
getRenderPriority
protected int getRenderPriority()Description copied from class:Tool
Return the render priority for this tool. Tools with higher dispatch priorities are rendered earlier than tools with lower priorities. The priority should be in the rangeTool.MIN_PRIORITY
...Tool.MAX_PRIORITY
. The default priority is equal toTool.DEFAULT_PRIORITY
.- Overrides:
getRenderPriority
in classTool
- Returns:
- the dispatch priority
-
setActive
protected void setActive(boolean active) Description copied from class:Tool
Receive notification from the tool manager about the tool's active state. -
render
Description copied from class:Tool
Renders the Tool's UI onto the givenGraphics2D
context using the givenRenderControls
.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.
-
handleMousePressed
Description copied from class:Tool
Invoked when a mouse button has been pressed on a component.- Overrides:
handleMousePressed
in classTool
- Parameters:
e
- the eventisActive
- whether this tool is currently active
-
handleMouseClicked
Description copied from class:Tool
Invoked when the mouse button has been clicked (pressed and released) on a component.- Overrides:
handleMouseClicked
in classTool
- Parameters:
e
- theMouseEditEvent
isActive
- whether this tool is currently active
-
handleMouseMoved
Description copied from class:Tool
Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.- Overrides:
handleMouseMoved
in classTool
- Parameters:
e
- the eventisActive
- whether this tool is currently active
-
handleMouseDragged
Description copied from class:Tool
Invoked when a mouse button is pressed on a component and then dragged.MOUSE_DRAGGED
events will continue to be delivered to the component where the drag originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).Due to platform-dependent DragDrop implementations,
MouseDragEvent
events may not be delivered during a native Drag&Drop operation.- Overrides:
handleMouseDragged
in classTool
- Parameters:
e
- the eventisActive
- whether this tool is currently active
-
handleTouchMove
Description copied from class:Tool
Invoked when a touch changed.- Overrides:
handleTouchMove
in classTool
- Parameters:
e
- theTouchEditEvent
isActive
- whether this tool is currently active
-
handleTouchEnd
Description copied from class:Tool
Invoked when a touch ended.- Overrides:
handleTouchEnd
in classTool
- Parameters:
e
- theTouchEditEvent
isActive
- whether this tool is currently active
-
handlePointerMove
Description copied from class:Tool
Invoked when a pointer event move.- Overrides:
handlePointerMove
in classTool
- Parameters:
e
- thePointerEditEvent
isActive
- whether this tool is currently active
-
handlePointerDown
Description copied from class:Tool
Invoked when a pointer event starts.- Overrides:
handlePointerDown
in classTool
- Parameters:
e
- thePointerEditEvent
isActive
- whether this tool is currently active
-
handleGestureStart
Description copied from class:Tool
Invoked when a multi touch gesture started.- Overrides:
handleGestureStart
in classTool
- Parameters:
e
- theGestureEditEvent
-
handleMouseReleased
Description copied from class:Tool
Invoked when a mouse button has been released on a component.- Overrides:
handleMouseReleased
in classTool
- Parameters:
e
- the eventisActive
- whether this tool is currently active
-
getActivationFeedback
Description copied from class:Tool
Provide feedback for the user about what would happen, if the mouse were pressed at the current location. This method is called while handlingMouseMoveEvent
s. If this method returnsnull
no feedback is provided at all. The activation request returned from this method is the same object that is used duringTool.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 usingTool.getActivationRequestForMousePressed(MouseEditEvent)
orTool.getActivationRequestForMouseDragged(MouseEditEvent)
.- Overrides:
getActivationFeedback
in classTool
- Parameters:
e
- theMouseEditEvent
- Returns:
- the
Tool.ActivationRequest
-
getActivationRequest
Description copied from class:Tool
Return the auto-activation request for this this tool in response to the given event. This method is only called for events of the following type:MouseDownEvent
MouseDragEvent
KeyDownEvent
Tool.ActivationRequest
, it becomes eligible for auto-activation. However, the final decision about which tool will actually be activated is up to theToolActivationPolicy
used be the tool manager.- Overrides:
getActivationRequest
in classTool
- Parameters:
e
- theMouseEditEvent
- Returns:
- an
Tool.ActivationRequest
ornull
if the tool does not seek to be auto-activated at this time.
-
getScaleStep
public float getScaleStep()- Returns:
- the default step to increase / decrease the scale value
-
setScaleStep
public void setScaleStep(float defaultScaleStep) Set the default step to increase / decrease the scale value- Parameters:
defaultScaleStep
- scale value
-
setInitialZoomFactor
public void setInitialZoomFactor(float initialZoomFactor) Set the initial zoom factor when displaying the lens.- Parameters:
initialZoomFactor
- The initial zoom factor.
-
getInitialZoomFactor
public float getInitialZoomFactor()Get the initial zoom factor when displaying the lens.- Returns:
- The current initial zoom factor.
-
resetZoom
public void resetZoom()Reset the zoom factor to its initial value, e.g. after changing the size or shape of the lens -
getFrozenStateMode
Return the frozen state mode, which describes how instances of hover lens handles the frozen mode.- Returns:
- the frozen state mode used by instances of hover lens
- See Also:
-
setFrozenStateMode
Set the frozen state mode, which describes how instances of hover lens handles the frozen mode.- Parameters:
frozenStateMode
- the frozen state mode used by instances of hover lens- Throws:
IllegalArgumentException
- the given frozen mode to change to must not benull
.- See Also:
-
setFrozen
public void setFrozen(boolean frozen) Sets / unsets the frozen state where the lens will remain in focus of the last point before being set to frozen.- Parameters:
frozen
- the frozen flag to be set
-
isFrozen
public boolean isFrozen()Gets the frozen state of the lens.- Returns:
true
if the lens is in frozen state;false
otherwise
-
isDeactivateFrozenStateOnlyInLensArea
public boolean isDeactivateFrozenStateOnlyInLensArea()- Returns:
- if the frozen state should be changed only if the mouse position points to the lens interior.
-
setDeactivateFrozenStateOnlyInLensArea
public void setDeactivateFrozenStateOnlyInLensArea(boolean deactivateFrozenStateOnlyInLensArea) Set if the frozen state should be changed only if the mouse position points to the lens interior. (default value: false)- Parameters:
deactivateFrozenStateOnlyInLensArea
- if set totrue
, frozen state changes only if the mouse is inside the lens area.
Otherwise the mouse position does not influence the frozen state change.
-
recalculatePositionAfterZoom
protected void recalculatePositionAfterZoom(float oldZoom, float newZoom) -
handleKeyPressed
Description copied from class:Tool
Invoked when a key has been pressed. See the class description forKeyEvent
for a definition of a key pressed event.- Overrides:
handleKeyPressed
in classTool
- Parameters:
editEvent
- theMouseEditEvent
isActive
- whether this tool is currently active
-