Search this API

y.view
Class InteractiveViewMode

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

public class InteractiveViewMode
extends ViewMode

A ViewMode for interactive input scenarios. This class provides blocking methods such as getClickedNode that allow interactive processing of view based input events. The caller of such a method blocks until a user clicks on a node, etc. The caller of the blocking query methods may not live in the same AWT thread that provides coordinates to this mode.

 

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
InteractiveViewMode()
          Initializes a new InteractiveViewMode.
 
Method Summary
 Node getClickedNode()
          Blocks until a node in the associated view gets clicked by a user.
 void mousePressedLeft(double x, double y)
          Stores the press location.
 void mouseReleasedLeft(double x, double y)
          Called when the left mouse button was released.
 void waitForClick()
          Blocks until a click occurred in the associated view.
 
Methods inherited from class y.view.ViewMode
activate, 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, mouseDraggedLeft, mouseDraggedMiddle, mouseDraggedRight, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mousePressedMiddle, mousePressedRight, mouseReleased, mouseReleased, mouseReleasedMiddle, mouseReleasedRight, 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

InteractiveViewMode

public InteractiveViewMode()
Initializes a new InteractiveViewMode.

Method Detail

mousePressedLeft

public void mousePressedLeft(double x,
                             double y)
Stores the press location.

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.

mouseReleasedLeft

public void mouseReleasedLeft(double x,
                              double y)
Description copied from class: ViewMode
Called when the left mouse button was released.

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.

getClickedNode

public Node getClickedNode()
Blocks until a node in the associated view gets clicked by a user. This method must be invoked from outside the AWT Event thread.

Returns:
the node clicked on

waitForClick

public void waitForClick()
Blocks until a click occurred in the associated view. This method must be invoked from outside the AWT Event thread.


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