Search this API

y.view
Class AreaZoomMode

java.lang.Object
  extended by y.view.ViewMode
      extended by y.view.AbstractSelectionBoxMode
          extended by y.view.AreaZoomMode
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.swing.event.MouseInputListener

public class AreaZoomMode
extends AbstractSelectionBoxMode

Implements a a ViewMode which allows setting the visible part of a view via a rectangle. Set instances of this class as a child ViewMode of the current ViewMode to allow for interactive zooming.

 
Your browser does not support SVG content.

Field Summary
 
Fields inherited from class y.view.ViewMode
ACTIVE_PROPERTY, ACTIVE_VIEW_PROPERTY, CHILD_MODE_PROPERTY, EDITING_PROPERTY, GRAB_FOCUS_ENABLED_PROPERTY, lastClickEvent, lastDragEvent, lastMoveEvent, lastPressEvent, lastReleaseEvent, MODIFIER_MASK_PROPERTY, NAME_PROPERTY, originalX, originalY, PARENT_MODE_PROPERTY, view
 
Constructor Summary
AreaZoomMode()
           
 
Method Summary
 void activate(boolean b)
          Invoked when the Mode is activated/deactivated from the ViewControl or via the setChild() and reactivateParent operations This behaves like a bound property using ViewMode.ACTIVE_PROPERTY as the property name.
protected  void focusView(double newZoom, java.awt.geom.Point2D newCenter)
          Calls focusView(newZoom, newCenter, isAnimatedZoomEnabled()); .
protected  void focusView(double newZoom, java.awt.geom.Point2D newCenter, boolean animatedZoom)
          Calls view.focusView(newZoom, newCenter, animatedZoom); view.updateView();.
 java.awt.Cursor getCursor()
          Getter for the cursor that is used when this ViewMode is active.
 boolean isAnimatedZoomEnabled()
          Returns whether or not area zooming will be performed in a smooth animated fashion.
protected  void selectionBoxAction(java.awt.geom.Rectangle2D.Double sb, boolean shiftMode)
          Zooms view to selection box bounds and updates view.
protected  void selectionBoxAction(java.awt.Rectangle sb, boolean shiftMode)
          zooms view to selection box bounds and updates view.
 void setAnimatedZoomEnabled(boolean animated)
          Whether or not area zooming should be performed in a smooth animated fashion.
 void setCursor(java.awt.Cursor cursor)
          Setter for the cursor that is used when this ViewMode is active.
 
Methods inherited from class y.view.AbstractSelectionBoxMode
cancelEditing, mouseDraggedLeft, mousePressedLeft, mouseReleasedLeft, mouseReleasedRight, mouseShiftPressedLeft, mouseShiftReleasedLeft, updateDoubleSelectionBox
 
Methods inherited from class y.view.ViewMode
addPropertyChangeListener, addPropertyChangeListener, deactivateChild, firePropertyChange, firePropertyChange, firePropertyChange, getChild, getGraph2D, getGridX, getGridY, getHitInfo, getHitInfo, getLastClickEvent, getLastDragEvent, getLastHitInfo, getLastMoveEvent, getLastPressEvent, getLastReleaseEvent, getModifierMask, getName, getParent, init, isActive, isEditing, isGrabFocusEnabled, isGridMode, isModifierPressed, mouseClicked, mouseClicked, mouseDragged, mouseDraggedMiddle, mouseDraggedRight, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mousePressedMiddle, mousePressedRight, mouseReleased, mouseReleased, mouseReleasedMiddle, mouseShiftPressedMiddle, mouseShiftPressedRight, mouseShiftReleasedMiddle, mouseShiftReleasedRight, reactivateParent, removePropertyChangeListener, removePropertyChangeListener, setActiveView, setChild, setChild, setEditing, setGrabFocusEnabled, setGridMode, setLastHitInfo, setModifierMask, setName, setParent, translateX, translateY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AreaZoomMode

public AreaZoomMode()
Method Detail

selectionBoxAction

protected void selectionBoxAction(java.awt.Rectangle sb,
                                  boolean shiftMode)
zooms view to selection box bounds and updates view.

Specified by:
selectionBoxAction in class AbstractSelectionBoxMode
Parameters:
sb - The position and size of the selection box.
shiftMode - true if shift was pressed when box was closed, false otherwise.

activate

public void activate(boolean b)
Invoked when the Mode is activated/deactivated from the ViewControl or via the setChild() and reactivateParent operations This behaves like a bound property using ViewMode.ACTIVE_PROPERTY as the property name.

Overrides:
activate in class ViewMode
Parameters:
b - set true when mode was activated false otherwise

selectionBoxAction

protected void selectionBoxAction(java.awt.geom.Rectangle2D.Double sb,
                                  boolean shiftMode)
Zooms view to selection box bounds and updates view.

Overrides:
selectionBoxAction in class AbstractSelectionBoxMode
Parameters:
sb - The position and size of the selection box.
shiftMode - true if shift was pressed when box was closed, false otherwise.

focusView

protected void focusView(double newZoom,
                         java.awt.geom.Point2D newCenter)
Calls focusView(newZoom, newCenter, isAnimatedZoomEnabled()); .

Parameters:
newZoom - the new zoom factor
newCenter - the new center

focusView

protected void focusView(double newZoom,
                         java.awt.geom.Point2D newCenter,
                         boolean animatedZoom)
Calls view.focusView(newZoom, newCenter, animatedZoom); view.updateView();.

Parameters:
newZoom - the new zoom factor
newCenter - the new center

getCursor

public java.awt.Cursor getCursor()
Getter for the cursor that is used when this ViewMode is active.

Returns:
The cursor that is used when this ViewMode is active.

setCursor

public void setCursor(java.awt.Cursor cursor)
Setter for the cursor that is used when this ViewMode is active.

Parameters:
cursor -

setAnimatedZoomEnabled

public void setAnimatedZoomEnabled(boolean animated)
Whether or not area zooming should be performed in a smooth animated fashion. By default this feature is disabled.


isAnimatedZoomEnabled

public boolean isAnimatedZoomEnabled()
Returns whether or not area zooming will be performed in a smooth animated fashion. By default this feature is disabled.


© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.