com.levigo.jadice.swing.crosshair
Class CrossHairTool

java.lang.Object
  extended by com.levigo.jadice.swing.tool.Tool
      extended by com.levigo.jadice.swing.crosshair.CrossHairTool
All Implemented Interfaces:
ModifierActivated, MenuContributor

public class CrossHairTool
extends Tool
implements ModifierActivated

An instance of this class may be added as a Tool to a PageView. It provides a crosshair mode, which means mouse motions will be followed by a crosshair rendered above the documents display.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.levigo.jadice.swing.tool.Tool
Tool.ActivationRequest
 
Field Summary
 
Fields inherited from class com.levigo.jadice.swing.tool.Tool
DEFAULT_PRIORITY, MAX_PRIORITY, MIN_PRIORITY
 
Constructor Summary
CrossHairTool()
          Constructor
 
Method Summary
 int getActivationModifiers()
          Returns the mask of modifier keys (Shift, Control, Alt etc.) and mouse buttons (left, right etc.) to be used to change the frozen state.
 Color getColor()
          Returns the line color
 FrozenMode getFrozenMode()
          Returns the current frozen mode behaviour.
 int getLineWidth()
          Returns the line width
protected  int getRenderPriority()
          Return the render priority for this tool.
protected  void handleMouseClicked(MouseEditEvent e, boolean isActive)
          Invoked when the mouse button has been clicked (pressed and released) on a component.
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 isFrozen()
          Gets the frozen state.
protected  void render(RenderParameters parameters, boolean isActive)
          Renders the Tool's UI onto the given Graphics2D context using the given RenderControls.
 void setActivationModifiers(int activationModifiers)
          Set the mask of modifier keys (Shift, Control, Alt etc.) and mouse buttons (left, right etc.) to be used to change the frozen state.
 void setColor(Color color)
          Changes the line color
 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 setFrozenMode(FrozenMode frozenMode)
          Changes the frozen mode behaviour.
 void setLineWidth(int lineWidth)
          Changes the line width
protected  void setManager(ToolManager manager)
          Receives the ToolManager instance, which the Tool implementation has been registered for.
 
Methods inherited from class com.levigo.jadice.swing.tool.Tool
contribute, getActivationFeedback, getActivationRequest, getActivationRequestForKeyPressed, getActivationRequestForMouseDragged, getActivationRequestForMousePressed, getCursor, getDispatchPriority, getManager, handleEditEvent, handleKeyPressed, handleKeyReleased, handleKeyTyped, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseWheelMoved, propagatePropertyChange, setActive, setCursor, setEnabled, setStatusFeedback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrossHairTool

public CrossHairTool()
Constructor

Method Detail

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 range Tool.MIN_PRIORITY...Tool.MAX_PRIORITY. The default priority is equal to Tool.DEFAULT_PRIORITY.

Overrides:
getRenderPriority in class Tool
Returns:
the dispatch priority

render

protected void render(RenderParameters parameters,
                      boolean isActive)
Description copied from class: Tool
Renders the Tool's UI onto the given 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.

Overrides:
render in class Tool
Parameters:
parameters - the view component which is currently being rendered
isActive - whether the called tool is currently active

getColor

public Color getColor()
Returns the line color

Returns:
Color

setColor

public void setColor(Color color)
Changes the line color

Parameters:
color -

getLineWidth

public int getLineWidth()
Returns the line width

Returns:
line width

setLineWidth

public void setLineWidth(int lineWidth)
Changes the line width

Parameters:
lineWidth -

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:
#getFrozenStateMode()

handleMouseClicked

protected void handleMouseClicked(MouseEditEvent e,
                                  boolean isActive)
Description copied from class: Tool
Invoked when the mouse button has been clicked (pressed and released) on a component.

Overrides:
handleMouseClicked in class Tool
isActive - whether this tool is currently active

handleMouseMoved

protected void handleMouseMoved(MouseEditEvent e,
                                boolean isActive)
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 class Tool
isActive - whether this tool is currently active

handleMousePressed

protected void handleMousePressed(MouseEditEvent e,
                                  boolean isActive)
Description copied from class: Tool
Invoked when a mouse button has been pressed on a component.

Overrides:
handleMousePressed in class Tool
isActive - whether this tool is currently active

handleMouseReleased

protected void handleMouseReleased(MouseEditEvent e,
                                   boolean isActive)
Description copied from class: Tool
Invoked when a mouse button has been released on a component.

Overrides:
handleMouseReleased in class Tool
isActive - whether this tool is currently active

setManager

protected void setManager(ToolManager manager)
Description copied from class: Tool
Receives the ToolManager instance, which the Tool implementation has been registered for. If the Tool is deregistered this method will be called with null.

Overrides:
setManager in class Tool

getFrozenMode

public FrozenMode getFrozenMode()
Returns the current frozen mode behaviour.

Returns:
FrozenMode

setFrozenMode

public void setFrozenMode(FrozenMode frozenMode)
Changes the frozen mode behaviour.

Parameters:
frozenMode - the new mode to change to
Throws:
IllegalArgumentException - the given frozen mode to change to must not be null.

getActivationModifiers

public int getActivationModifiers()
Returns the mask of modifier keys (Shift, Control, Alt etc.) and mouse buttons (left, right etc.) to be used to change the frozen state.

Specified by:
getActivationModifiers in interface ModifierActivated
Returns:
the modifier and button mask
See Also:
setActivationModifiers(int), setFrozen(boolean), isFrozen()

setActivationModifiers

public void setActivationModifiers(int activationModifiers)
Set the mask of modifier keys (Shift, Control, Alt etc.) and mouse buttons (left, right etc.) to be used to change the frozen state. The modifier mask must be compatible with InputEvent.getModifiersEx(), i.e. it must use the InputEvent constants containing _DOWN_ in their name.

Specified by:
setActivationModifiers in interface ModifierActivated
Parameters:
activationModifiers -
See Also:
InputEvent.ALT_DOWN_MASK, InputEvent.ALT_GRAPH_DOWN_MASK, InputEvent.CTRL_DOWN_MASK, InputEvent.SHIFT_DOWN_MASK, InputEvent.BUTTON1_DOWN_MASK, InputEvent.BUTTON2_DOWN_MASK, InputEvent.BUTTON3_DOWN_MASK, setFrozen(boolean), isFrozen()


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.