com.levigo.jadice.swing.pageview
Class MouseWheelZoomTool

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

public class MouseWheelZoomTool
extends Tool
implements ModifierActivated

A Tool used to enable zooming using the mouse wheel. Zooming is performed upon all mouse wheel events during which the modifier state matches the one set with setActivationModifiers(int) (this defaults to the CONTROL key). The zoom increments can be controlled using setScrollDivisor(int) and bounded using setMinZoomFactor(float)/setMaxZoomFactor(float).


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
MouseWheelZoomTool()
           
 
Method Summary
 int getActivationModifiers()
          Get the mask of modifier keys (Shift, Control, Alt etc.) and mouse buttons (left, right etc.) to be used to activate this tool.
protected  int getDispatchPriority()
          Return the dispatch priority for this tool.
 float getMaxZoomFactor()
           
 float getMinZoomFactor()
           
 int getScrollDivisor()
          Get the scroll divisor.
protected  void handleMouseWheelMoved(MouseWheelEditEvent e, boolean isActive)
          Invoked when the mouse wheel is rotated.
 void setActivationModifiers(int activationModifiers)
          Set the mask of modifier keys (Shift, Control, Alt etc.) and mouse buttons (left, right etc.) to be used to activate this tool.
 void setMaxZoomFactor(float maxZoomFactor)
           
 void setMinZoomFactor(float minZoomFactor)
           
 void setScrollDivisor(int scrollDivisor)
          Set the scroll divisor.
 
Methods inherited from class com.levigo.jadice.swing.tool.Tool
contribute, getActivationFeedback, getActivationRequest, getActivationRequestForKeyPressed, getActivationRequestForMouseDragged, getActivationRequestForMousePressed, getCursor, getManager, getRenderPriority, handleEditEvent, handleKeyPressed, handleKeyReleased, handleKeyTyped, handleMouseClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseMoved, handleMousePressed, handleMouseReleased, propagatePropertyChange, render, setActive, setCursor, setEnabled, setManager, setStatusFeedback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MouseWheelZoomTool

public MouseWheelZoomTool()
Method Detail

handleMouseWheelMoved

protected void handleMouseWheelMoved(MouseWheelEditEvent e,
                                     boolean isActive)
Description copied from class: Tool
Invoked when the mouse wheel is rotated.

Overrides:
handleMouseWheelMoved in class Tool
isActive - whether this tool is currently active
See Also:
MouseWheelEvent

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

Overrides:
getDispatchPriority in class Tool
Returns:
the dispatch priority

getScrollDivisor

public int getScrollDivisor()
Get the scroll divisor. The scroll divisor is used to scale the mouse scroll amount into a factor by which the zoom factor is calculated.

Returns:
the scrollDivisor

setScrollDivisor

public void setScrollDivisor(int scrollDivisor)
Set the scroll divisor. The scroll divisor is used to scale the mouse scroll amount into a factor by which the zoom factor is calculated.

Parameters:
scrollDivisor - the scrollDivisor to set

getMinZoomFactor

public float getMinZoomFactor()

setMinZoomFactor

public void setMinZoomFactor(float minZoomFactor)

getMaxZoomFactor

public float getMaxZoomFactor()

setMaxZoomFactor

public void setMaxZoomFactor(float maxZoomFactor)

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 activate this tool. The modifier mask must be compatible with InputEvent.getModifiersEx(), i.e. it must use the InputEvent constants containing _DOWN_ in their name.

Default: use CONTROL key

Specified by:
setActivationModifiers in interface ModifierActivated
See Also:
ModifierActivated.setActivationModifiers(int)

getActivationModifiers

public int getActivationModifiers()
Get the mask of modifier keys (Shift, Control, Alt etc.) and mouse buttons (left, right etc.) to be used to activate this tool.

Specified by:
getActivationModifiers in interface ModifierActivated
Returns:
the modifier and button mask
See Also:
ModifierActivated.setActivationModifiers(int)


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