|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.jadice.swing.tool.Tool com.levigo.jadice.swing.lens.HoverLensTool
public class HoverLensTool
A hover lens tool for the PageView
component.
Provides a lens hovering over the document bound to mouse location and movement..
Nested Class Summary | |
---|---|
static class |
HoverLensTool.HoverShape
Shape of the hover lens |
Nested classes/interfaces inherited from class com.levigo.jadice.swing.tool.Tool |
---|
Tool.ActivationRequest |
Field Summary | |
---|---|
protected Point2D |
fullScaleLensPosition
the position of the lens center in document scale |
Fields inherited from class com.levigo.jadice.swing.tool.Tool |
---|
DEFAULT_PRIORITY, MAX_PRIORITY, MIN_PRIORITY |
Constructor Summary | |
---|---|
HoverLensTool()
|
Method Summary | |
---|---|
protected Tool.ActivationRequest |
getActivationFeedback(MouseEditEvent e)
Provide feedback for the user about what would happen, if the mouse were pressed at the current location. |
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. |
protected Tool.ActivationRequest |
getActivationRequest(EditEvent e)
Return the auto-activation request for this this tool in response to the given event. |
Insets |
getAutoscrollInsets()
|
int |
getDecrementalScaleModifier()
|
int |
getDecrementalScaleMouseButton()
|
int |
getDecrementalSizeKeyCode()
|
int |
getDecrementalSizeModifier()
|
float |
getDefaultScale()
|
float |
getDefaultScaleStep()
|
FrozenStateMode |
getFrozenStateMode()
Return the frozen state mode, which describes how instances of hover lens handles the frozen mode. |
HoverLensTool.HoverShape |
getHoverShape()
|
Dimension |
getHoverSize()
|
int |
getIncrementalScaleModifier()
|
int |
getIncrementalScaleMouseButton()
|
int |
getIncrementalSizeKeyCode()
|
int |
getIncrementalSizeModifier()
|
int |
getInitialAutoscrollDelay()
|
float |
getMinimumScale()
|
protected int |
getRenderPriority()
Return the render priority for this tool. |
int |
getRepeatAutoscrollDelay()
|
float |
getScale()
Gets the scale. |
MessageFormat |
getTextFormat()
|
protected void |
handleEditEvent(boolean isActive,
EditEvent e)
Handle the given EditEvent . |
protected void |
handleKeyPressed(KeyEditEvent e,
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 |
handleMouseEntered(MouseEditEvent e,
boolean isActive)
Invoked when the mouse cursor enters the unobscured part of component's geometry. |
protected void |
handleMouseExited(MouseEditEvent e,
boolean isActive)
Invoked when the mouse cursor exits the unobscured part of component's geometry. |
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 |
isAutoScrollModeOn()
Returns whether hover lens may cause an autoscroll on the viewer if the mouse moved outside the visible area. |
boolean |
isChangeFrozenStateInLensArea()
|
boolean |
isFrozen()
Gets the frozen state of the lens. |
boolean |
isRestrictToPageBounds()
|
boolean |
isUseAbsoluteMagnification()
|
boolean |
isUseClickScaling()
|
protected void |
render(RenderParameters parameters,
boolean isActive)
Renders the Tool's UI onto the given Graphics2D context using the given
RenderControls . |
void |
resetScale()
Resets the scale to the value defined by defaultScale . |
void |
setActivationModifiers(int activationModifiers)
Set the mask of modifier keys and mouse buttons to be used to change the frozen state. |
void |
setAutoscrollInsets(Insets autoscrollInsets)
|
void |
setAutoScrollModeOn(boolean doAutoScroll)
Sets a flag, whether hover lens may cause an autoscroll on the viewer if the mouse moved outside the visible area. |
void |
setChangeFrozenStateInLensArea(boolean changeFrozenStateInLensArea)
Set if the frozen state should be changed only if the mouse position points to the lens interior. |
void |
setDecrementalScaleModifier(int decrementalScaleModifier)
Set the mouse modifier(s) for decrementing the scale factor. Allowed values: Several modifiers can be combined with binary OR ( | ). |
void |
setDecrementalScaleModifier(String decrementalScaleModifier)
Set the mouse modifier(s) for decrementing the scale factor. Allowed values: ctrl_mask
alt_mask
shift_mask
Several modifiers can be combined with the pipe character (| ). |
void |
setDecrementalScaleMouseButton(int decrementalScaleMouseButton)
Set the mouse button for decrementing the scale factor. Allowed values: |
void |
setDecrementalScaleMouseButton(String decrementalScaleMouseButton)
Set the mouse button for decrementing the scale factor. Allowed values: button1_mask
button2_mask
button3_mask
|
void |
setDecrementalSizeKeyCode(int decrementalSizeKeyCode)
Set the key code for decrementing the scale factor. Allowed values: See the constants KeyEvent.VK_* |
void |
setDecrementalSizeModifier(int decrementalSizeModifier)
Set the key modifier(s) for decrementing the scale factor. Allowed values: Several modifiers can be combined with binary OR ( | ). |
void |
setDecrementalSizeModifier(String decrementalSizeModifier)
Set the key modifier(s) for decrementing the scale factor. Allowed values: ctrl_mask
alt_mask
shift_mask
Several modifiers can be combined with the pipe character (| ). |
void |
setDefaultScale(float defaultScale)
|
void |
setDefaultScaleStep(float defaultScaleStep)
Set the default step to increase / decrease the scale value |
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 lens will remain in focus of the last point before being set to frozen. |
void |
setFrozenStateMode(FrozenStateMode frozenStateMode)
Set the frozen state mode, which describes how instances of hover lens handles the frozen mode. |
void |
setHoverShape(HoverLensTool.HoverShape hoverShape)
Sets the shape of the hoverlens. |
void |
setHoverSize(Dimension hoverSize)
Sets the size of the hover lens. |
void |
setIncrementalScaleModifier(int incrementalScaleModifier)
Set the mouse modifier(s) for incrementing the scale factor. Allowed values: Several modifiers can be combined with binary OR ( | ). |
void |
setIncrementalScaleModifier(String incrementalScaleModifier)
Set the mouse modifier(s) for incrementing the scale factor. Allowed values: ctrl_mask
alt_mask
shift_mask
Several modifiers can be combined with the pipe character (| ). |
void |
setIncrementalScaleMouseButton(int incrementalScaleMouseButton)
Set the mouse button for incrementing the scale factor. Allowed values: |
void |
setIncrementalScaleMouseButton(String incrementalScaleMouseButton)
Set the mouse button for incrementing the scale factor. Allowed values: button1_mask
button2_mask
button3_mask
|
void |
setIncrementalSizeKeyCode(int incrementalSizeKeyCode)
Set the key code for incrementing the scale factor. Allowed values: See the constants KeyEvent.VK_* |
void |
setIncrementalSizeModifier(int incrementalSizeModifier)
Set the key modifier(s) for incrementing the scale factor. Allowed values: Several modifiers can be combined with binary OR ( | ). |
void |
setIncrementalSizeModifier(String incrementalSizeModifier)
Set the key modifier(s) for incrementing the scale factor. Allowed values: ctrl_mask
alt_mask
shift_mask
Several modifiers can be combined with the pipe character (| ). |
void |
setInitialAutoscrollDelay(int initialAutoscrollDelay)
|
protected void |
setManager(ToolManager manager)
Receives the ToolManager instance, which the Tool implementation has been
registered for. |
void |
setMinimumScale(float minimumScale)
Set the minimum value for scaling the page. |
void |
setRepeatAutoscrollDelay(int repeatAutoscrollDelay)
|
void |
setRestrictToPageBounds(boolean restrictToPageBounds)
Set the behavior when the mouse cursor leaves the bounds of the current page. |
void |
setScale(float scale)
Sets the scale. |
void |
setTextFormat(MessageFormat textFormat)
Set the text format to indicate scale factor and the optional frozen state. |
void |
setUseClickScaling(boolean useClickScaling)
Whether the lens's scale should be modifiable using mouse clicks. |
Methods inherited from class com.levigo.jadice.swing.tool.Tool |
---|
contribute, getActivationRequestForKeyPressed, getActivationRequestForMouseDragged, getActivationRequestForMousePressed, getCursor, getDispatchPriority, getManager, handleKeyReleased, handleKeyTyped, handleMouseWheelMoved, propagatePropertyChange, setActive, setCursor, setStatusFeedback |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Point2D fullScaleLensPosition
Constructor Detail |
---|
public HoverLensTool()
Method Detail |
---|
protected int getRenderPriority()
Tool
Tool.MIN_PRIORITY
...Tool.MAX_PRIORITY
.
The default priority is equal to Tool.DEFAULT_PRIORITY
.
getRenderPriority
in class Tool
protected void setEnabled(boolean enabled)
Tool
Tool.handleEditEvent(boolean, EditEvent)
and Tool.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.
setEnabled
in class Tool
protected void setManager(ToolManager manager)
Tool
ToolManager
instance, which the Tool
implementation has been
registered for. If the Tool
is deregistered
this
method will be called with null.
setManager
in class Tool
protected Tool.ActivationRequest getActivationFeedback(MouseEditEvent e)
Tool
MouseEvent.MOUSE_MOVED
events. If this
method returns null
no feedback is provided at all.
The activation request returned from this method is the same object that is used during
Tool.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 using Tool.getActivationRequestForMousePressed(MouseEditEvent)
or
Tool.getActivationRequestForMouseDragged(MouseEditEvent)
.
getActivationFeedback
in class Tool
protected Tool.ActivationRequest getActivationRequest(EditEvent e)
Tool
Tool.ActivationRequest
, it becomes eligible for auto-activation.
However, the final decision about which tool will actually be activated is up to the
ToolActivationPolicy
used be the tool manager.
getActivationRequest
in class Tool
e
- the event
Tool.ActivationRequest
or null
if the tool does not seek to be
auto-activated at this time.protected void handleEditEvent(boolean isActive, EditEvent e)
Tool
EditEvent
. This method dispatches the edit event to the individual
handleXYZ()
-Methods. However, implementors may want and are allowed to override
this method in order to perform standard handling tasks common to all types of events.
handleEditEvent
in class Tool
isActive
- whether this tool is currently activee
- the eventTool.handleEditEvent(boolean,
com.levigo.jadice.swing.tool.EditEvent)
protected void handleKeyPressed(KeyEditEvent e, boolean isActive)
Tool
KeyEvent
for a
definition of a key pressed event.
handleKeyPressed
in class Tool
isActive
- whether this tool is currently activeprotected void handleMousePressed(MouseEditEvent e, boolean isActive)
Tool
handleMousePressed
in class Tool
isActive
- whether this tool is currently activeprotected void handleMouseReleased(MouseEditEvent e, boolean isActive)
Tool
handleMouseReleased
in class Tool
isActive
- whether this tool is currently activeprotected void handleMouseClicked(MouseEditEvent e, boolean isActive)
Tool
handleMouseClicked
in class Tool
isActive
- whether this tool is currently activeprotected void handleMouseDragged(MouseEditEvent e, boolean isActive)
Tool
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 Drag&Drop implementations, MOUSE_DRAGGED
events may
not be delivered during a native Drag&Drop operation.
handleMouseDragged
in class Tool
isActive
- whether this tool is currently activeprotected void handleMouseEntered(MouseEditEvent e, boolean isActive)
Tool
handleMouseEntered
in class Tool
isActive
- whether this tool is currently activeprotected void handleMouseExited(MouseEditEvent e, boolean isActive)
Tool
handleMouseExited
in class Tool
isActive
- whether this tool is currently activeprotected void handleMouseMoved(MouseEditEvent e, boolean isActive)
Tool
handleMouseMoved
in class Tool
isActive
- whether this tool is currently activepublic void resetScale()
defaultScale
.
public float getScale()
public void setScale(float scale)
scale
- The scale to be set.protected void render(RenderParameters parameters, boolean isActive)
Tool
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.
render
in class Tool
parameters
- the view component which is currently being renderedisActive
- whether the called tool is currently activepublic Dimension getHoverSize()
public void setHoverSize(Dimension hoverSize)
hoverSize
- The hoverSize to set
IllegalArgumentException
- if hoverSize is null
, hoverSize#width or
hoverSize#height is less or equal zero.public HoverLensTool.HoverShape getHoverShape()
HoverLensTool.HoverShape
public void setHoverShape(HoverLensTool.HoverShape hoverShape)
hoverShape
- The shape to setHoverLensTool.HoverShape
public boolean isAutoScrollModeOn()
true
causes autoscroll, otherwise false
public void setAutoScrollModeOn(boolean doAutoScroll)
doAutoScroll
- true
causes autoscroll, otherwise false
public boolean isFrozen()
true
if the lens is in frozen state; false
otherwisepublic void setFrozen(boolean frozen)
frozen
- the frozen flag to be setpublic FrozenStateMode getFrozenStateMode()
FrozenStateMode
public void setFrozenStateMode(FrozenStateMode frozenStateMode)
frozenStateMode
- the frozen state mode used by instances of hover lens
IllegalArgumentException
- the given frozen mode to change to must not be
null
.FrozenStateMode
public void setIncrementalScaleMouseButton(String incrementalScaleMouseButton)
button1_mask
button2_mask
button3_mask
incrementalScaleMouseButton
- The mouse buttonpublic void setIncrementalScaleMouseButton(int incrementalScaleMouseButton)
incrementalScaleMouseButton
- The mouse buttonMouseEvent
public void setIncrementalScaleModifier(String incrementalScaleModifier)
ctrl_mask
alt_mask
shift_mask
|
).
incrementalScaleModifier
- The modifierpublic void setIncrementalScaleModifier(int incrementalScaleModifier)
|
).
incrementalScaleModifier
- The modifierInputEvent
public void setDecrementalScaleMouseButton(String decrementalScaleMouseButton)
button1_mask
button2_mask
button3_mask
decrementalScaleMouseButton
- The mouse buttonpublic void setDecrementalScaleMouseButton(int decrementalScaleMouseButton)
decrementalScaleMouseButton
- The mouse buttonMouseEvent
public void setDecrementalScaleModifier(String decrementalScaleModifier)
ctrl_mask
alt_mask
shift_mask
|
).
decrementalScaleModifier
- The modifierpublic void setDecrementalScaleModifier(int decrementalScaleModifier)
|
).
decrementalScaleModifier
- The modifierInputEvent
public void setIncrementalSizeKeyCode(int incrementalSizeKeyCode)
KeyEvent.VK_*
incrementalSizeKeyCode
- A key codeKeyEvent
public void setIncrementalSizeModifier(String incrementalSizeModifier)
ctrl_mask
alt_mask
shift_mask
|
).
incrementalSizeModifier
- The modifierpublic void setIncrementalSizeModifier(int incrementalSizeModifier)
|
).
incrementalSizeModifier
- The modifierInputEvent
public void setDecrementalSizeKeyCode(int decrementalSizeKeyCode)
KeyEvent.VK_*
decrementalSizeKeyCode
- A key codeKeyEvent
public void setDecrementalSizeModifier(String decrementalSizeModifier)
ctrl_mask
alt_mask
shift_mask
|
).
decrementalSizeModifier
- The modifierpublic void setDecrementalSizeModifier(int decrementalSizeModifier)
|
).
decrementalSizeModifier
- The modifierInputEvent
public int getActivationModifiers()
getActivationModifiers
in interface ModifierActivated
setActivationModifiers(int)
,
setFrozen(boolean)
,
isFrozen()
public void setActivationModifiers(int activationModifiers)
InputEvent.getModifiersEx()
, i.e. it must use the
InputEvent
constants containing _DOWN_
in their name. Allowed modifiers
and button keys are:|
). The default value is
InputEvent.BUTTON1_DOWN_MASK | InputEvent.CTRL_DOWN_MASK
.
setActivationModifiers
in interface ModifierActivated
activationModifiers
-
IllegalArgumentException
- if other modifier keys other than those listed above.InputEvent.ALT_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()
public void setMinimumScale(float minimumScale)
minimumScale
- minimum scaling valuepublic float getMinimumScale()
public float getDefaultScaleStep()
public int getIncrementalScaleMouseButton()
public int getIncrementalScaleModifier()
public int getDecrementalScaleMouseButton()
public int getDecrementalScaleModifier()
public int getIncrementalSizeKeyCode()
public int getIncrementalSizeModifier()
public int getDecrementalSizeKeyCode()
public int getDecrementalSizeModifier()
public boolean isUseAbsoluteMagnification()
public void setDefaultScaleStep(float defaultScaleStep)
defaultScaleStep
- scale valuepublic MessageFormat getTextFormat()
public void setTextFormat(MessageFormat textFormat)
textFormat
- text format of the hover lens' text.MessageFormat
public boolean isUseClickScaling()
public void setUseClickScaling(boolean useClickScaling)
useClickScaling
- enables or disables click scalingpublic boolean isChangeFrozenStateInLensArea()
public void setChangeFrozenStateInLensArea(boolean changeFrozenStateInLensArea)
changeFrozenStateInLensArea
- if set to true
, frozen state changes only if
the mouse is inside the lens area.public void setRestrictToPageBounds(boolean restrictToPageBounds)
true
the center of the lens is restricted to the page bounds. If set to
false
the lens always follows the mouse cursor even there is no content to magnify
(default behavior).
restrictToPageBounds
- if the lens is restricted to the page boundspublic boolean isRestrictToPageBounds()
public void setDefaultScale(float defaultScale)
public float getDefaultScale()
public void setAutoscrollInsets(Insets autoscrollInsets)
public Insets getAutoscrollInsets()
public void setInitialAutoscrollDelay(int initialAutoscrollDelay)
public int getInitialAutoscrollDelay()
public void setRepeatAutoscrollDelay(int repeatAutoscrollDelay)
public int getRepeatAutoscrollDelay()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |