Class CrossHairTool
java.lang.Object
com.levigo.jadice.web.client.tool.Tool
com.levigo.jadice.web.client.tools.CrossHairTool
- All Implemented Interfaces:
MenuContributor
-
Nested Class Summary
Nested classes/interfaces inherited from class com.levigo.jadice.web.client.tool.Tool
Tool.ActivationRequest
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Code for disabled frozen statestatic final int
Code for enabled frozen statestatic final int
Code for enabled frozen state, reset on document changestatic final int
Code for enabled frozen state, reset on page changeFields 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
Return the auto-activation request for this this tool in response to a touch move.getColor()
Returns the line colorint
Returns the frozen state mode.int
Returns the line width.protected int
Return the render priority for this tool.int
int
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
isFrozen()
Gets the frozen state.protected void
render
(RenderParameters parameters, boolean isActive) Renders the Tool's UI onto the givenGraphics2D
context using the givenRenderControls
.void
Changes the line color.protected void
setEnabled
(boolean enabled) Receive notification from the tool manager about the tool's enabled state.void
setFrozen
(boolean frozen) Sets / unsets the frozen state where the pane will remain in focus of the last point before being set to frozen.void
setFrozenStateMode
(int frozenStateMode) void
setLineWidth
(int lineWidth) Changes the line width.void
setToggleFrozenModifier
(int toggleFrozenModifier) void
setToggleFrozenMouseButton
(int toggleFrozenMouseButton) Methods inherited from class com.levigo.jadice.web.client.tool.Tool
contribute, ensureDebugId, getActivationFeedback, getActivationFeedback, getActivationRequest, getActivationRequestForKeyPressed, getActivationRequestForMouseDragged, getActivationRequestForMousePressed, getActivationRequestForTouchStart, getDispatchPriority, getManager, handleEditEvent, handleGestureChange, handleGestureEnd, handleKeyReleased, handleKeyTyped, handleMouseEntered, handleMouseExited, handleMouseWheelMoved, handlePointerUp, handleTouchStart, propagatePropertyChange, setActive, setCursor, setCursor, setManager, setStatusFeedback
-
Field Details
-
FROZEN_STATE_DISABLED
public static final int FROZEN_STATE_DISABLEDCode for disabled frozen state- See Also:
-
FROZEN_STATE_ENABLED
public static final int FROZEN_STATE_ENABLEDCode for enabled frozen state- See Also:
-
FROZEN_STATE_RESET_ON_DOCCHANGE
public static final int FROZEN_STATE_RESET_ON_DOCCHANGECode for enabled frozen state, reset on document change- See Also:
-
FROZEN_STATE_RESET_ON_PAGECHANGE
public static final int FROZEN_STATE_RESET_ON_PAGECHANGECode for enabled frozen state, reset on page change- See Also:
-
-
Constructor Details
-
CrossHairTool
public CrossHairTool()Constructor
-
-
Method Details
-
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
-
setEnabled
protected void setEnabled(boolean enabled) Description copied from class:Tool
Receive notification from the tool manager about the tool's enabled state. In general, tools need not and should not try to implement different behaviour depending on the enabled state, as this is already covered by the ToolManager calling theTool.handleEditEvent(boolean, EditEvent)
andTool.render(RenderParameters, boolean)
in the appropriate state only. However, some tools may need to perform extended actions (for example, for resource management purposes) upon a change of the enabled state.- Overrides:
setEnabled
in classTool
- Parameters:
enabled
- controls whether to enable or disable thisTool
-
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.
-
getColor
Returns the line color- Returns:
- Color
-
setColor
Changes the line color.- Parameters:
color
- The color to use.
-
getLineWidth
public int getLineWidth()Returns the line width.- Returns:
- The line width.
-
setLineWidth
public void setLineWidth(int lineWidth) Changes the line width.- Parameters:
lineWidth
- The line width to use.
-
getFrozenStateMode
public int getFrozenStateMode()Returns the frozen state mode.The frozen state mode describes how instances of the CrossHairPane class handle the frozen mode. See also
FROZEN_STATE_DISABLED
,FROZEN_STATE_ENABLED
,FROZEN_STATE_RESET_ON_DOCCHANGE
,FROZEN_STATE_RESET_ON_PAGECHANGE
.- Returns:
- The frozen state mode used by instances of this class.
-
isFrozen
public boolean isFrozen()Gets the frozen state.- Returns:
true
if the pane is in frozen state;false
otherwise
-
setFrozen
public void setFrozen(boolean frozen) Sets / unsets the frozen state where the pane will remain in focus of the last point before being set to frozen. If the frozen state mode is disabled, this method will do nothing.- Parameters:
frozen
- the frozen flag to be set- See Also:
-
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
-
getActivationRequestForTouchMove
Description copied from class:Tool
Return the auto-activation request for this this tool in response to a touch move. If the tool returns anTool.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:
getActivationRequestForTouchMove
in classTool
- Parameters:
e
- theKeyEditEvent
- Returns:
- an
Tool.ActivationRequest
ornull
if the tool does not seek to be auto-activated at this time.
-
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
-
handleGestureStart
Description copied from class:Tool
Invoked when a multi touch gesture started.- Overrides:
handleGestureStart
in classTool
- Parameters:
e
- theGestureEditEvent
-
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
-
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
-
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
-
setFrozenStateMode
public void setFrozenStateMode(int frozenStateMode) -
setToggleFrozenMouseButton
public void setToggleFrozenMouseButton(int toggleFrozenMouseButton) -
getToggleFrozenMouseButton
public int getToggleFrozenMouseButton() -
setToggleFrozenModifier
public void setToggleFrozenModifier(int toggleFrozenModifier) -
getToggleFrozenModifier
public int getToggleFrozenModifier() -
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
-