|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.view.ViewMode
y.view.MouseInputMode
public class MouseInputMode
This class is a ViewMode implementation that delegates Mouse2DEvents to MouseInputEditor instances.
The corresponding MouseInputEditor instances are queried using the MouseInputEditorProvider interface that
may be implemented by NodeRealizer, EdgeRealizer, and Drawable classes. Node and edge realizers do not have to
implement this interface themselves, but can also delegate the calls to an instance of an external class, since
this class uses NodeRealizer.getMouseInputEditorProvider() and
EdgeRealizer.getMouseInputEditorProvider() respectively.
Additionally it is possible to
add
and remove any number of providers to this class that
will be queried for editor instances.
This mode uses findMouseInputEditor(Graph2DView, double, double, HitInfo) whenever it receives
a Mouse Event and tries to set the returned MouseInputEditor instance as the current MouseInputEditor.
Then it registers a ChangeListener to the editor via its MouseInputEditor.addChangeListener(ChangeListener)
method and delivers Mouse2DEvents to that instance until it notifies this mode via a ChangeEvent that
it does not any longer want to be the current MouseInputEditor.
By default this mode does not search the Drawables, NodeRealizers, and EdgeRealizers for
the MouseInputEditorProvider interface but queries the internal list of providers only.
Use the corresponding properties to enable the search for each of those elements.
This ViewMode has integrated support in EditMode.
MouseInputEditor,
MouseInputEditorProvider,
addMouseInputEditorProvider(MouseInputEditorProvider),
EditMode.setMouseInputMode(MouseInputMode)![]() |
![]() |
| 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 | |
|---|---|
MouseInputMode()
Constructs a new MouseInputMode that queries the list of MouseInputEditorProviders only. |
|
| Method Summary | |
|---|---|
void |
addMouseInputEditorProvider(MouseInputEditorProvider provider)
Adds a MouseInputEditorProvider to the list of providers that will be queried in findMouseInputEditor(Graph2DView, double, double, HitInfo) for editors when this mode receives
mouse events. |
protected void |
editingStopped()
Callback method when the current editor has stopped editing. |
MouseInputEditor |
findMouseInputEditor(Graph2DView view,
double x,
double y,
HitInfo hitInfo)
Callback method that determines the new MouseInputEditor if no current editor is set for this view. |
MouseInputEditor |
getCurrentEditor()
Returns the current MouseInputEditor instance that is the receiver of
the Mouse2DEvents. |
protected void |
grabFocus()
Callback called by mousePressed(java.awt.event.MouseEvent) to
initiate a focus request of the Graph2DView associated to
this mode. |
boolean |
isDrawableSearchingEnabled()
Returns whether Drawables will be checked whether they implement the
MouseInputEditorProvider interface in findMouseInputEditor(Graph2DView, double, double, HitInfo). |
boolean |
isEdgeSearchingEnabled()
Returns whether EdgeRealizers will be checked whether they implement the
MouseInputEditorProvider interface in findMouseInputEditor(Graph2DView, double, double, HitInfo)
when the Node of the EdgeRealizer is hit by the current mouse event. |
boolean |
isNodeSearchingEnabled()
Returns whether NodeRealizers will be checked whether they implement the
MouseInputEditorProvider interface in findMouseInputEditor(Graph2DView, double, double, HitInfo)
when the Node of the NodeRealizer is hit by the current mouse event. |
boolean |
isReactivateParentOnEditingStopped()
Returns whether to reactivate the parent ViewMode if editingStopped()
is invoked. |
void |
mouseClicked(java.awt.event.MouseEvent e)
A mouse button get clicked |
void |
mouseDragged(java.awt.event.MouseEvent e)
The mouse gets dragged |
void |
mouseEntered(java.awt.event.MouseEvent e)
The mouse enters the viewer component. |
void |
mouseExited(java.awt.event.MouseEvent e)
The mouse leaves the viewer component. |
void |
mouseMoved(java.awt.event.MouseEvent e)
The Mouse gets moved. |
void |
mousePressed(java.awt.event.MouseEvent e)
A mouse button gets pressed. |
void |
mouseReleased(java.awt.event.MouseEvent e)
A mouse button get released |
void |
removeMouseInputEditorProvider(MouseInputEditorProvider provider)
Removes a previously added MouseInputEditorProvider from the list of providers. |
void |
setDrawableSearchingEnabled(boolean drawableSearchingEnabled)
Determines whether Drawables will be checked whether they implement the
MouseInputEditorProvider interface in findMouseInputEditor(Graph2DView, double, double, HitInfo). |
void |
setEdgeSearchingEnabled(boolean edgeSearchingEnabled)
Determines whether EdgeRealizers will be checked whether they implement the
MouseInputEditorProvider interface in findMouseInputEditor(Graph2DView, double, double, HitInfo)
when the Node of the EdgeRealizer is hit by the current mouse event. |
void |
setNodeSearchingEnabled(boolean nodeSearchingEnabled)
Determines whether NodeRealizers will be checked whether they implement the
MouseInputEditorProvider interface in findMouseInputEditor(Graph2DView, double, double, HitInfo)
when the Node of the NodeRealizer is hit by the current mouse event. |
void |
setReactivateParentOnEditingStopped(boolean reactivateParentOnEditingStopped)
Determines whether to reactivate the parent ViewMode if editingStopped()
is invoked. |
boolean |
startEditor(MouseInputEditor newEditor)
Sets the current MouseInputEditor instance programmatically and tries to
start it. |
void |
stopEditing()
Stops the current editor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MouseInputMode()
MouseInputEditorProviders only.
| Method Detail |
|---|
public boolean isDrawableSearchingEnabled()
Drawables will be checked whether they implement the
MouseInputEditorProvider interface in findMouseInputEditor(Graph2DView, double, double, HitInfo).
public boolean isReactivateParentOnEditingStopped()
reactivate the parent ViewMode if editingStopped()
is invoked.
public void setReactivateParentOnEditingStopped(boolean reactivateParentOnEditingStopped)
reactivate the parent ViewMode if editingStopped()
is invoked.
The default is true.
reactivateParentOnEditingStopped - whether to reactivate the parentpublic void setDrawableSearchingEnabled(boolean drawableSearchingEnabled)
Drawables will be checked whether they implement the
MouseInputEditorProvider interface in findMouseInputEditor(Graph2DView, double, double, HitInfo).
drawableSearchingEnabled - whether to check for the interface in all Drawablespublic boolean isNodeSearchingEnabled()
NodeRealizers will be checked whether they implement the
MouseInputEditorProvider interface in findMouseInputEditor(Graph2DView, double, double, HitInfo)
when the Node of the NodeRealizer is hit by the current mouse event.
public void setNodeSearchingEnabled(boolean nodeSearchingEnabled)
NodeRealizers will be checked whether they implement the
MouseInputEditorProvider interface in findMouseInputEditor(Graph2DView, double, double, HitInfo)
when the Node of the NodeRealizer is hit by the current mouse event.
nodeSearchingEnabled - whether to check for the interface in the hit realizerpublic boolean isEdgeSearchingEnabled()
EdgeRealizers will be checked whether they implement the
MouseInputEditorProvider interface in findMouseInputEditor(Graph2DView, double, double, HitInfo)
when the Node of the EdgeRealizer is hit by the current mouse event.
public void setEdgeSearchingEnabled(boolean edgeSearchingEnabled)
EdgeRealizers will be checked whether they implement the
MouseInputEditorProvider interface in findMouseInputEditor(Graph2DView, double, double, HitInfo)
when the Node of the EdgeRealizer is hit by the current mouse event.
edgeSearchingEnabled - whether to check for the interface in the hit realizerpublic void addMouseInputEditorProvider(MouseInputEditorProvider provider)
findMouseInputEditor(Graph2DView, double, double, HitInfo) for editors when this mode receives
mouse events.
provider - a new provider instance to add to the list
java.lang.NullPointerException - if provider is nullpublic void removeMouseInputEditorProvider(MouseInputEditorProvider provider)
provider - a new provider instance to add to the listaddMouseInputEditorProvider(MouseInputEditorProvider)public MouseInputEditor getCurrentEditor()
MouseInputEditor instance that is the receiver of
the Mouse2DEvents.
null if there is no current editorstartEditor(MouseInputEditor)public void stopEditing()
Stops the current editor.
public boolean startEditor(MouseInputEditor newEditor)
MouseInputEditor instance programmatically and tries to
start it.
If there is an editor currently active it will first be stopped.
newEditor - the new editor or null
protected void editingStopped()
public void mousePressed(java.awt.event.MouseEvent e)
ViewMode
mousePressed in interface java.awt.event.MouseListenermousePressed in class ViewModeprotected void grabFocus()
mousePressed(java.awt.event.MouseEvent) to
initiate a focus request of the Graph2DView associated to
this mode.
public void mouseReleased(java.awt.event.MouseEvent e)
ViewMode
mouseReleased in interface java.awt.event.MouseListenermouseReleased in class ViewModepublic void mouseClicked(java.awt.event.MouseEvent e)
ViewMode
mouseClicked in interface java.awt.event.MouseListenermouseClicked in class ViewModepublic void mouseDragged(java.awt.event.MouseEvent e)
ViewMode
mouseDragged in interface java.awt.event.MouseMotionListenermouseDragged in class ViewModepublic void mouseMoved(java.awt.event.MouseEvent e)
ViewModeViewMode.mouseMoved(double,double).
mouseMoved in interface java.awt.event.MouseMotionListenermouseMoved in class ViewModepublic void mouseEntered(java.awt.event.MouseEvent e)
ViewMode
mouseEntered in interface java.awt.event.MouseListenermouseEntered in class ViewModepublic void mouseExited(java.awt.event.MouseEvent e)
ViewMode
mouseExited in interface java.awt.event.MouseListenermouseExited in class ViewMode
public MouseInputEditor findMouseInputEditor(Graph2DView view,
double x,
double y,
HitInfo hitInfo)
Drawables should also be searched, the following sequence is
used:
view - the view that will host the new editor instancex - the x coordinate of the mouse eventy - the y coordinate of the mouse eventhitInfo - The HitInfo object to use.
If null is given, a new HitInfo object is retrieved from the current
view.
null if none was
found.setNodeSearchingEnabled(boolean),
setEdgeSearchingEnabled(boolean),
setDrawableSearchingEnabled(boolean)
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||