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 floatthe 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.ActivationRequestProvide feedback for the user about what would happen, if the mouse were pressed at the current location.protected Tool.ActivationRequestReturn the auto-activation request for this this tool in response to the given event.protected intReturn the dispatch priority for this tool.Return the frozen state mode, which describes how instances of hover lens handles the frozen mode.floatGet the initial zoom factor when displaying the lens.protected intReturn the render priority for this tool.floatprotected voidInvoked when a multi touch gesture started.protected voidhandleKeyPressed(KeyEditEvent editEvent, boolean isActive) Invoked when a key has been pressed.protected voidhandleMouseClicked(MouseEditEvent e, boolean isActive) Invoked when the mouse button has been clicked (pressed and released) on a component.protected voidhandleMouseDragged(MouseEditEvent e, boolean isActive) Invoked when a mouse button is pressed on a component and then dragged.protected voidhandleMouseMoved(MouseEditEvent e, boolean isActive) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.protected voidhandleMousePressed(MouseEditEvent e, boolean isActive) Invoked when a mouse button has been pressed on a component.protected voidhandleMouseReleased(MouseEditEvent e, boolean isActive) Invoked when a mouse button has been released on a component.protected voidhandlePointerDown(PointerEditEvent e, boolean isActive) Invoked when a pointer event starts.protected voidhandlePointerMove(PointerEditEvent e, boolean isActive) Invoked when a pointer event move.protected voidhandleTouchEnd(TouchEditEvent e, boolean isActive) Invoked when a touch ended.protected voidhandleTouchMove(TouchEditEvent e, boolean isActive) Invoked when a touch changed.booleanbooleanisFrozen()Gets the frozen state of the lens.protected voidrecalculatePositionAfterRotation(BaseRenderSettings.Rotation oldRotation, BaseRenderSettings.Rotation newRotation) protected voidrecalculatePositionAfterZoom(float oldZoom, float newZoom) protected voidrender(RenderParameters parameters, boolean isActive) Renders the Tool's UI onto the givenGraphics2Dcontext using the givenRenderControls.voidReset the zoom factor to its initial value, e.g. after changing the size or shape of the lensprotected voidsetActive(boolean active) Receive notification from the tool manager about the tool's active state.voidsetDeactivateFrozenStateOnlyInLensArea(boolean deactivateFrozenStateOnlyInLensArea) Set if the frozen state should be changed only if the mouse position points to the lens interior.voidsetFrozen(boolean frozen) Sets / unsets the frozen state where the lens will remain in focus of the last point before being set to frozen.voidsetFrozenStateMode(FrozenStateMode frozenStateMode) Set the frozen state mode, which describes how instances of hover lens handles the frozen mode.voidsetHoverShape(HoverLensTool.HoverShape hoverShape) !!voidsetHoverSize(Dimension hoverSize) !!voidsetInitialZoomFactor(float initialZoomFactor) Set the initial zoom factor when displaying the lens.voidsetScaleStep(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.CIRCLEand 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.CIRCLEand 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:ToolReturn 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_PRIORITYminus the render priority.- Overrides:
getDispatchPriorityin classTool- Returns:
- the dispatch priority
-
getRenderPriority
protected int getRenderPriority()Description copied from class:ToolReturn 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:
getRenderPriorityin classTool- Returns:
- the dispatch priority
-
setActive
protected void setActive(boolean active) Description copied from class:ToolReceive notification from the tool manager about the tool's active state. -
render
Description copied from class:ToolRenders the Tool's UI onto the givenGraphics2Dcontext 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:ToolInvoked when a mouse button has been pressed on a component.- Overrides:
handleMousePressedin classTool- Parameters:
e- the eventisActive- whether this tool is currently active
-
handleMouseClicked
Description copied from class:ToolInvoked when the mouse button has been clicked (pressed and released) on a component.- Overrides:
handleMouseClickedin classTool- Parameters:
e- theMouseEditEventisActive- whether this tool is currently active
-
handleMouseMoved
Description copied from class:ToolInvoked when the mouse cursor has been moved onto a component but no buttons have been pushed.- Overrides:
handleMouseMovedin classTool- Parameters:
e- the eventisActive- whether this tool is currently active
-
handleMouseDragged
Description copied from class:ToolInvoked when a mouse button is pressed on a component and then dragged.MOUSE_DRAGGEDevents 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,
MouseDragEventevents may not be delivered during a native Drag&Drop operation.- Overrides:
handleMouseDraggedin classTool- Parameters:
e- the eventisActive- whether this tool is currently active
-
handleTouchMove
Description copied from class:ToolInvoked when a touch changed.- Overrides:
handleTouchMovein classTool- Parameters:
e- theTouchEditEventisActive- whether this tool is currently active
-
handleTouchEnd
Description copied from class:ToolInvoked when a touch ended.- Overrides:
handleTouchEndin classTool- Parameters:
e- theTouchEditEventisActive- whether this tool is currently active
-
handlePointerMove
Description copied from class:ToolInvoked when a pointer event move.- Overrides:
handlePointerMovein classTool- Parameters:
e- thePointerEditEventisActive- whether this tool is currently active
-
handlePointerDown
Description copied from class:ToolInvoked when a pointer event starts.- Overrides:
handlePointerDownin classTool- Parameters:
e- thePointerEditEventisActive- whether this tool is currently active
-
handleGestureStart
Description copied from class:ToolInvoked when a multi touch gesture started.- Overrides:
handleGestureStartin classTool- Parameters:
e- theGestureEditEvent
-
handleMouseReleased
Description copied from class:ToolInvoked when a mouse button has been released on a component.- Overrides:
handleMouseReleasedin classTool- Parameters:
e- the eventisActive- whether this tool is currently active
-
getActivationFeedback
Description copied from class:ToolProvide feedback for the user about what would happen, if the mouse were pressed at the current location. This method is called while handlingMouseMoveEvents. If this method returnsnullno 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:
getActivationFeedbackin classTool- Parameters:
e- theMouseEditEvent- Returns:
- the
Tool.ActivationRequest
-
getActivationRequest
Description copied from class:ToolReturn 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:MouseDownEventMouseDragEventKeyDownEvent
Tool.ActivationRequest, it becomes eligible for auto-activation. However, the final decision about which tool will actually be activated is up to theToolActivationPolicyused be the tool manager.- Overrides:
getActivationRequestin classTool- Parameters:
e- theMouseEditEvent- Returns:
- an
Tool.ActivationRequestornullif 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:
trueif the lens is in frozen state;falseotherwise
-
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:ToolInvoked when a key has been pressed. See the class description forKeyEventfor a definition of a key pressed event.- Overrides:
handleKeyPressedin classTool- Parameters:
editEvent- theMouseEditEventisActive- whether this tool is currently active
-