Search this API

y.view
Class MultiplexingNodeEditor.EventReporter

java.lang.Object
  extended by y.view.AbstractMouseInputEditor
      extended by y.view.MultiplexingNodeEditor.EventReporter
All Implemented Interfaces:
MouseInputEditor, MultiplexingNodeEditor.NodeEditor
Enclosing class:
MultiplexingNodeEditor

public static class MultiplexingNodeEditor.EventReporter
extends AbstractMouseInputEditor
implements MultiplexingNodeEditor.NodeEditor

Editor that plays recorded MouseEvents back to a parent EditMode instance for further processing.

This is useful to enable e.g. EditMode's default handling for right mouse-clicks to trigger PopupMode even though the event coordinates would qualify as a valid starting point in the EditMode's MouseInputMode instance.

By default, drag events and click events for all but the left mouse button trigger play back of recorded events.

 

Constructor Summary
MultiplexingNodeEditor.EventReporter()
          Initializes a new event reporter.
 
Method Summary
protected  boolean checkEvent(Mouse2DEvent event)
          Returns true if the specified event should trigger event play back and false otherwise.
 java.awt.Cursor getCursor(Mouse2DEvent event)
          Returns a mouse cursor to indicate what action this event could trigger or null if the editor does not want to initiate a cursor change.
 boolean isValidStartPosition(double x, double y)
          Determines if the input mode could start editing at the given position.
 void mouse2DEventHappened(Mouse2DEvent event)
          Listener-like interface that will be notified of Mouse2DEvents.
protected  void reportEvent(Mouse2DEvent event)
          Plays the recorded events back to the parent EditMode of the specified event's dispatcher MouseInputMode.
 void setContext(Graph2DView view, MultiplexingNodeEditor parent, NodeRealizer realizer)
          Provides context information for the editor.
 boolean startsEditing(Mouse2DEvent event)
          This method is used by clients to query whether the given event is deemed as a starting gesture.
 
Methods inherited from class y.view.AbstractMouseInputEditor
addChangeListener, fireStateChanged, isEditing, isEnabled, isInterestedInEvents, removeChangeListener, setEnabled, startEditing, stopEditing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface y.view.MouseInputEditor
addChangeListener, isEditing, isInterestedInEvents, removeChangeListener, startEditing, stopEditing
 

Constructor Detail

MultiplexingNodeEditor.EventReporter

public MultiplexingNodeEditor.EventReporter()
Initializes a new event reporter.

Method Detail

checkEvent

protected boolean checkEvent(Mouse2DEvent event)
Returns true if the specified event should trigger event play back and false otherwise.

The default implementation returns true for mouse drag events and mouse click events of all but the left mouse button.

Parameters:
event - the event to check.
Returns:
true if the specified event should trigger event play back and false otherwise.

startsEditing

public boolean startsEditing(Mouse2DEvent event)
Description copied from interface: MouseInputEditor
This method is used by clients to query whether the given event is deemed as a starting gesture.

Specified by:
startsEditing in interface MouseInputEditor
Parameters:
event - the event that happened
Returns:
whether the given gesture can be used to start the editing
See Also:
MouseInputEditor.isInterestedInEvents()

mouse2DEventHappened

public void mouse2DEventHappened(Mouse2DEvent event)
Description copied from interface: MouseInputEditor
Listener-like interface that will be notified of Mouse2DEvents.

Specified by:
mouse2DEventHappened in interface MouseInputEditor
Parameters:
event - the event that happened
See Also:
MouseInputEditor.isInterestedInEvents()

setContext

public void setContext(Graph2DView view,
                       MultiplexingNodeEditor parent,
                       NodeRealizer realizer)
Description copied from interface: MultiplexingNodeEditor.NodeEditor
Provides context information for the editor.

Specified by:
setContext in interface MultiplexingNodeEditor.NodeEditor
Parameters:
view - the current view in which the editing is done.
parent - the multiplexing editor that delegates to the node editor.
realizer - the realizer representing the node to edit.

isValidStartPosition

public boolean isValidStartPosition(double x,
                                    double y)
Description copied from interface: MultiplexingNodeEditor.NodeEditor
Determines if the input mode could start editing at the given position. This method is called to determine whether a subordinate editor of a MultiplexingNodeEditor instance is able to handle mouse gestures at the specified position.

Specified by:
isValidStartPosition in interface MultiplexingNodeEditor.NodeEditor
Parameters:
x - The horizontal position.
y - The vertical position.
Returns:
true if the input mode could start editing at the given position; false otherwise.

getCursor

public java.awt.Cursor getCursor(Mouse2DEvent event)
Description copied from interface: MultiplexingNodeEditor.NodeEditor
Returns a mouse cursor to indicate what action this event could trigger or null if the editor does not want to initiate a cursor change.

Specified by:
getCursor in interface MultiplexingNodeEditor.NodeEditor
Parameters:
event - The mouse event a cursor can be returned for.
Returns:
A Cursor if a possible action for this mouse event shall be indicated or null.

reportEvent

protected void reportEvent(Mouse2DEvent event)
Plays the recorded events back to the parent EditMode of the specified event's dispatcher MouseInputMode.

Parameters:
event - the event that triggered play back.
See Also:
Mouse2DEvent.getDispatcher()

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