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:
MenuContributor

public class CrossHairTool
extends Tool

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.

Author:
Carolin Koehler

Nested Class Summary
 
Nested classes/interfaces inherited from class com.levigo.jadice.swing.tool.Tool
Tool.ActivationRequest
 
Field Summary
static int FROZEN_STATE_DISABLED
          Deprecated. since 5.1.0.7. It is strongly recommended to use the FrozenMode.DISABLED instead. This constant will be removed with one of the next major releases.
static int FROZEN_STATE_ENABLED
          Deprecated. since 5.1.0.7. This state will lead to undefined frozen states. Therefore it is strongly recommended not to use anymore. This constant will be removed with with one of the next major releases.
static int FROZEN_STATE_RESET_ON_DOCCHANGE
          Deprecated. since 5.1.0.7. It is strongly recommended to use the FrozenMode.ENABLED_DOCCHANGE_RESET instead. This constant will be removed with with one of the next major releases.
static int FROZEN_STATE_RESET_ON_PAGECHANGE
          Deprecated. since 5.1.0.7. It is strongly recommended to use the FrozenMode.ENABLED_PAGECHANGE_RESET instead. This constant will be removed with with one of the next major releases.
 
Fields inherited from class com.levigo.jadice.swing.tool.Tool
DEFAULT_PRIORITY, MAX_PRIORITY, MIN_PRIORITY
 
Constructor Summary
CrossHairTool()
          Constructor
 
Method Summary
 Color getColor()
          Returns the line color
 FrozenMode getFrozenMode()
          Returns the current frozen mode behaviour.
 int getFrozenStateMode()
          Deprecated. since 5.1.0.7. It is strongly recommended to use getFrozenMode() instead. Do not use this method any longer, it will be removed with one of the next major releases.
 int getLineWidth()
          Returns the line width
protected  int getRenderPriority()
          Return the render priority for this tool.
 int getToggleFrozenModifier()
           
 int getToggleFrozenMouseButton()
           
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 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 setFrozenStateMode(int frozenStateMode)
          Deprecated. since 5.1.0.7. It is strongly recommended to use setFrozenMode(FrozenMode) instead. Do not use this method any longer, it will be removed with one of the next major releases.
 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.
 void setToggleFrozenModifier(int toggleFrozenModifier)
           
 void setToggleFrozenMouseButton(int toggleFrozenMouseButton)
           
 
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
 

Field Detail

FROZEN_STATE_DISABLED

@Deprecated
public static final int FROZEN_STATE_DISABLED
Deprecated. since 5.1.0.7. It is strongly recommended to use the FrozenMode.DISABLED instead. This constant will be removed with one of the next major releases.
Indicates, that the frozen state function is switched off.

See Also:
Constant Field Values

FROZEN_STATE_ENABLED

@Deprecated
public static final int FROZEN_STATE_ENABLED
Deprecated. since 5.1.0.7. This state will lead to undefined frozen states. Therefore it is strongly recommended not to use anymore. This constant will be removed with with one of the next major releases.
Indicates, that the frozen state function is switched on. Due to historical reasons this state is part of the API, but this state is no longer relevant. It indicates the availability of the frozen state function, but without any commitment about the frozen state after a document change. This can lead to an undefined behaviour. Nevertheless, if this mode is applied it this tool behaves like FrozenMode.ENABLED_DOCCHANGE_RESET.

See Also:
Constant Field Values

FROZEN_STATE_RESET_ON_DOCCHANGE

@Deprecated
public static final int FROZEN_STATE_RESET_ON_DOCCHANGE
Deprecated. since 5.1.0.7. It is strongly recommended to use the FrozenMode.ENABLED_DOCCHANGE_RESET instead. This constant will be removed with with one of the next major releases.
Indicates, that the frozen state function is switched on. To ensure a consistent behaviour an activated frozen state will be released on a document change.

See Also:
Constant Field Values

FROZEN_STATE_RESET_ON_PAGECHANGE

@Deprecated
public static final int FROZEN_STATE_RESET_ON_PAGECHANGE
Deprecated. since 5.1.0.7. It is strongly recommended to use the FrozenMode.ENABLED_PAGECHANGE_RESET instead. This constant will be removed with with one of the next major releases.
Indicates, that the frozen state function is switched on. To ensure a consistent behaviour an activated frozen state will be released on a change of current page.

See Also:
Constant Field Values
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.

getFrozenStateMode

@Deprecated
public int getFrozenStateMode()
Deprecated. since 5.1.0.7. It is strongly recommended to use getFrozenMode() instead. Do not use this method any longer, it will be removed with one of the next major releases.


setFrozenStateMode

@Deprecated
public void setFrozenStateMode(int frozenStateMode)
Deprecated. since 5.1.0.7. It is strongly recommended to use setFrozenMode(FrozenMode) instead. Do not use this method any longer, it will be removed with one of the next major releases.

Throws:
IllegalArgumentException - if the given parameter is not one of the frozen state constants
See Also:
FROZEN_STATE_DISABLED, FROZEN_STATE_ENABLED, FROZEN_STATE_RESET_ON_DOCCHANGE, FROZEN_STATE_RESET_ON_PAGECHANGE

setToggleFrozenMouseButton

public void setToggleFrozenMouseButton(int toggleFrozenMouseButton)

getToggleFrozenMouseButton

public int getToggleFrozenMouseButton()

setToggleFrozenModifier

public void setToggleFrozenModifier(int toggleFrozenModifier)

getToggleFrozenModifier

public int getToggleFrozenModifier()


Copyright © 2017 levigo holding gmbh. All rights reserved.