Search this API

y.view
Class NavigationMode

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

public class NavigationMode
extends ViewMode

A view mode that allows to navigate in a view

 
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
NavigationMode()
          Initializes a new NavigationMode.
NavigationMode(ViewContainer vc)
          Initializes a new NavigationMode for the given ViewContainer.
 
Method Summary
 void activate(boolean b)
          When activated disables scrollbars in Graph2DView, when deactivated restores previous scroll bar state and cursor.
 java.awt.Cursor getDefaultCursor()
          Returns the default cursor that will be used if the navigation will not be active.
 java.awt.Cursor getNavigationCursor()
          Returns the cursor that will be used if the navigation will be active.
 PopupMode getPopupMode()
          Returns the popup mode associated with this mode.
 Scroller getScroller()
          Returns the Scroller instance used to implement the right drag navigation action.
 boolean isAdjustScrollBarPolicy()
          Returns true if the scroll bars in Graph2DView will be disabled when this mode is activated (default).
 void mouseDraggedLeft(double x, double y)
          Moves the viewport of this view.
 void mouseDraggedRight(double x, double y)
          Moves the viewport of this view in an animated fashion.
 void mousePressedLeft(double x, double y)
          Initiates a navigation action.
 void mousePressedRight(double x, double y)
          Either activates a popup mode or an animated scroller for the view.
 void mouseReleasedLeft(double x, double y)
          Terminates a navigation action.
 void mouseReleasedRight(double x, double y)
          Terminates a navigation action.
 void setAdjustScrollBarPolicy(boolean adjustScrollBarPolicy)
          Whether the scroll bars will be disabled when this mode is activated.
 void setDefaultCursor(java.awt.Cursor defaultCursor)
          Sets the default cursor for this view mode.
 void setNavigationCursor(java.awt.Cursor navigationCursor)
          Sets the cursor for this view mode that will be used if the navigation will be active.
 void setPopupMode(PopupMode pl)
          Sets the popup mode for this mode.
 
Methods inherited from class y.view.ViewMode
addPropertyChangeListener, addPropertyChangeListener, cancelEditing, 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, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mousePressedMiddle, mouseReleased, mouseReleased, mouseReleasedMiddle, mouseShiftPressedLeft, mouseShiftPressedMiddle, mouseShiftPressedRight, mouseShiftReleasedLeft, 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

NavigationMode

public NavigationMode(ViewContainer vc)
Initializes a new NavigationMode for the given ViewContainer.


NavigationMode

public NavigationMode()
Initializes a new NavigationMode.

Method Detail

activate

public void activate(boolean b)
When activated disables scrollbars in Graph2DView, when deactivated restores previous scroll bar state and cursor.

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

isAdjustScrollBarPolicy

public boolean isAdjustScrollBarPolicy()
Returns true if the scroll bars in Graph2DView will be disabled when this mode is activated (default).

Returns:
true if the scroll bars in Graph2DView will be disabled when this mode is activated (default).

setAdjustScrollBarPolicy

public void setAdjustScrollBarPolicy(boolean adjustScrollBarPolicy)
Whether the scroll bars will be disabled when this mode is activated.

Parameters:
adjustScrollBarPolicy - true if the scroll bars in Graph2DView should be disabled when this mode is activated (default).

getPopupMode

public PopupMode getPopupMode()
Returns the popup mode associated with this mode.


setPopupMode

public void setPopupMode(PopupMode pl)
Sets the popup mode for this mode. If a popup mode is set for this mode then the right mouse button will be used to activate that mode.


mousePressedLeft

public void mousePressedLeft(double x,
                             double y)
Initiates a navigation action.

Overrides:
mousePressedLeft in class ViewMode
Parameters:
x - the x-coordinate of the mouse event in world coordinates.
y - the y-coordinate of the mouse event in world coordinates.

mousePressedRight

public void mousePressedRight(double x,
                              double y)
Either activates a popup mode or an animated scroller for the view.

Overrides:
mousePressedRight in class ViewMode
Parameters:
x - the x-coordinate of the mouse event in world coordinates.
y - the y-coordinate of the mouse event in world coordinates.

mouseReleasedRight

public void mouseReleasedRight(double x,
                               double y)
Terminates a navigation action.

Overrides:
mouseReleasedRight in class ViewMode
Parameters:
x - the x-coordinate of the mouse event in world coordinates.
y - the y-coordinate of the mouse event in world coordinates.

mouseReleasedLeft

public void mouseReleasedLeft(double x,
                              double y)
Terminates a navigation action.

Overrides:
mouseReleasedLeft in class ViewMode
Parameters:
x - the x-coordinate of the mouse event in world coordinates.
y - the y-coordinate of the mouse event in world coordinates.

mouseDraggedLeft

public void mouseDraggedLeft(double x,
                             double y)
Moves the viewport of this view.

Overrides:
mouseDraggedLeft in class ViewMode
Parameters:
x - the x-coordinate of the mouse event in world coordinates.
y - the y-coordinate of the mouse event in world coordinates.

mouseDraggedRight

public void mouseDraggedRight(double x,
                              double y)
Moves the viewport of this view in an animated fashion.

Overrides:
mouseDraggedRight in class ViewMode
Parameters:
x - the x-coordinate of the mouse event in world coordinates.
y - the y-coordinate of the mouse event in world coordinates.

getDefaultCursor

public java.awt.Cursor getDefaultCursor()
Returns the default cursor that will be used if the navigation will not be active.

Returns:
the default cursor that will be used if the navigation will not be active.

setDefaultCursor

public void setDefaultCursor(java.awt.Cursor defaultCursor)
Sets the default cursor for this view mode. By default this cursor will be used when the left mouse button is not being pressed. By default the Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR) is set.

Parameters:
defaultCursor - the cursor that is visible if the left mouse button is not pressed.

getNavigationCursor

public java.awt.Cursor getNavigationCursor()
Returns the cursor that will be used if the navigation will be active.

Returns:
the cursor that will be used if the navigation will be active.

setNavigationCursor

public void setNavigationCursor(java.awt.Cursor navigationCursor)
Sets the cursor for this view mode that will be used if the navigation will be active. By default this cursor will be used when the left mouse button is being pressed. By default the Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR) is set.

Parameters:
navigationCursor - the cursor that is visible if the left mouse button is pressed.

getScroller

public Scroller getScroller()
Returns the Scroller instance used to implement the right drag navigation action.


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