public class GraphViewerInputMode extends MultiplexingInputMode
IInputMode
implementation for use in a GraphControl
to assign to the InputMode
property.
This mode can be used in a viewer-centric application where there is no need to modify the IGraph
but browsing of the graph should be convenient. This mode allows for
clicking on items using the mouse
,
displaying tool tips for items
,
showing a context menu
,
allowing for easy navigation and traversal
,
moving the view port
, and
optionally doing marquee selection
. Also ItemHoverInputMode
can be used to get notified of the elements that the mouse is hovering over.
Due to the viewer-centric nature of this input mode, collapsing and expanding groups is disabled per default. To enable
this feature, set CollapseGroupAllowed
and ExpandGroupAllowed
to true
.
This input mode manages a set of specialized input modes, each handling a specific part of the interaction with the
graph. The following list details those along with their default
priorities
. Lower priorities come earlier when handing events.
WaitInputMode
(−1) – Disables this input mode when layouts or animations run.KeyboardInputMode
(0) – Handles commands and arbitrary keyboard shortcuts.ClickInputMode
(10) – Handles mouse clicks and double-clicks.TapInputMode
(20) – Handles taps and double-tap.MarqueeSelectionInputMode
(30) – Allows dragging a rectangle to select items within it.MoveViewportInputMode
(39) – Allows panning the viewport.ItemHoverInputMode
(55) – Provides events to indicate that the mouse pointer hovers over an item.NavigationInputMode
(55) – Provides general navigation facilities, such as navigating from one item to another with the arrow keys.AbstractContextMenuInputMode
(60) – Handles querying the context menu contents based on a location as well as preparing the menu for display.MouseHoverInputMode
(100) – Handles tool tips.Constructor and Description |
---|
GraphViewerInputMode()
Initializes a new instance of the
GraphViewerInputMode class. |
Modifier and Type | Method and Description |
---|---|
void |
addCanvasClickedListener(IEventHandler<ClickEventArgs> canvasClickedEvent)
Adds the given listener for the
CanvasClicked event that occurs when the empty canvas area has been clicked. |
void |
addItemClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemClickedEvent)
Adds the given listener for the
ItemClicked event that occurs when an item has been clicked. |
void |
addItemDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemDoubleClickedEvent)
Adds the given listener for the
ItemDoubleClicked event that occurs when an item has been double clicked. |
void |
addItemLeftClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftClickedEvent)
Adds the given listener for the
ItemLeftClicked event that occurs when an item has been left clicked. |
void |
addItemLeftDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftDoubleClickedEvent)
Adds the given listener for the
ItemLeftDoubleClicked event that occurs when an item has been left double
clicked. |
void |
addItemRightClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightClickedEvent)
Adds the given listener for the
ItemRightClicked event that occurs when an item has been right clicked. |
void |
addItemRightDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightDoubleClickedEvent)
Adds the given listener for the
ItemRightDoubleClicked event that occurs when an item has been right double
clicked. |
void |
addMultiSelectionFinishedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionFinishedEvent)
Adds the given listener for the
MultiSelectionFinished event that occurs when a single or multi select operation
has been finished. |
void |
addMultiSelectionStartedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionStartedEvent)
Adds the given listener for the
MultiSelectionStarted event that occurs when a single or multi select operation
has been started. |
void |
addPopulateItemContextMenuListener(IEventHandler<PopulateItemContextMenuEventArgs<IModelItem>> populateItemContextMenuEvent)
Adds the given listener for the
PopulateItemContextMenu event that occurs when the context menu
over an item is about to be opened to determine the contents of the
Menu . |
void |
addQueryItemToolTipListener(IEventHandler<QueryItemToolTipEventArgs<IModelItem>> queryItemToolTipEvent)
Adds the given listener for the
QueryItemToolTip event that occurs when the mouse is hovering
over an item to determine the tool tip to display. |
protected Object |
childInputModeContextLookup(Class type)
Callback method that will be used by the
child context's ILookup.lookup(Class)
method. |
void |
clearSelection()
Clears the selection on the current
GraphSelection . |
protected void |
click(IModelItem item,
ClickEventArgs args)
Actually performs the click on the given item.
|
protected boolean |
clickClearSelection(IInputModeContext context)
Clears the selection on click if
the click is not
recognized by MultiSelectionRecognizer . |
void |
copy()
Copies the currently selected elements to the clipboard.
|
protected ClickInputMode |
createClickInputMode()
Factory method for the ClickInputMode property.
|
protected AbstractContextMenuInputMode |
createContextMenuInputMode()
Factory method for the
ContextMenuInputMode property. |
protected ItemHoverInputMode |
createItemHoverInputMode()
Factory method for the
ItemHoverInputMode property. |
protected KeyboardInputMode |
createKeyboardInputMode()
Factory method that creates the
KeyboardInputMode instance. |
protected MarqueeSelectionInputMode |
createMarqueeSelectionInputMode()
Factory method for the
MarqueeSelectionInputMode property. |
protected MouseHoverInputMode |
createMouseHoverInputMode()
Factory method for the
MouseHoverInputMode property. |
protected MoveViewportInputMode |
createMoveViewportInputMode()
Factory method for the
MoveViewportInputMode property. |
protected NavigationInputMode |
createNavigationInputMode()
Factory method for the
NavigationInputMode property. |
protected SelectionEventArgs<IModelItem> |
createSelectionEventArgs(IInputModeContext context)
Helper method that yields a suitably configured
SelectionEventArgs using the GraphSelection
for this input mode. |
protected TapInputMode |
createTapInputMode()
Factory method for the
TapInputMode property. |
protected WaitInputMode |
createWaitInputMode()
Factory method for the WaitInputMode property.
|
protected void |
doubleClick(IModelItem item,
ClickEventArgs args)
Actually performs a double-click on the given item.
|
protected void |
doubleTap(IModelItem item,
TapEventArgs args)
Actually performs a double-tap on the given item.
|
IEnumerable<IModelItem> |
findItems(IInputModeContext context,
PointD location,
GraphItemTypes[] tests)
Used as a callback to find the items hit underneath a certain point.
|
IEnumerable<IModelItem> |
findItems(IInputModeContext context,
PointD location,
GraphItemTypes[] tests,
Predicate<IModelItem> filter)
Used as a callback to find the items hit underneath a certain point.
|
IEnumerable<IModelItem> |
findItems(PointD location,
GraphItemTypes[] tests)
Used as a callback to find the items hit underneath a certain point.
|
IEnumerable<IModelItem> |
findItems(PointD location,
GraphItemTypes[] tests,
Predicate<IModelItem> filter)
Used as a callback to find the items hit underneath a certain point.
|
Collection<ICommand> |
getAvailableCommands()
Gets a collection of commands that this input mode will handle.
|
GraphItemTypes |
getClickableItems()
Determines which types of items should be reported through the
item click events . |
GraphItemTypes[] |
getClickHitTestOrder()
Gets the order of the types of items that should be used to determine what item has been clicked or tapped.
|
ClickInputMode |
getClickInputMode()
Gets the
ClickInputMode that is used by this instance to determine clicks. |
GraphItemTypes |
getClickSelectableItems()
Determines which types of items should be selectable by mouse clicks.
|
AbstractContextMenuInputMode |
getContextMenuInputMode()
Gets the
ContextMenuInputMode property. |
GraphItemTypes |
getContextMenuItems()
Gets the types of items a context menu should be queried for.
|
IEventRecognizer |
getCyclicSelectionRecognizer()
Gets the
IEventRecognizer that will be queried to decide if a click should cycle through all the items that are
currently under the mouse cursor. |
IEventRecognizer |
getDetailSelectionRecognizer()
Gets the
IEventRecognizer that will be queried to decide if a click should select the item that is currently
visible under the mouse cursor, without giving more important items higher priority. |
GraphItemTypes[] |
getDoubleClickHitTestOrder()
Gets the order of the types of items that should be used to determine what item has been double-clicked or
double-tapped.
|
GraphItemTypes |
getFocusableItems()
Gets the items that can be given focus via the
setCurrentItem(IModelItem) method. |
IGraph |
getGraph()
Gets the graph instance from the
InputModeContext . |
IGraphSelection |
getGraphSelection()
Gets the graph selection from the
InputModeContext . |
ItemHoverInputMode |
getItemHoverInputMode()
Gets the
ItemHoverInputMode that is provided by this instance for those who need to
make use of it. |
KeyboardInputMode |
getKeyboardInputMode()
Gets the
KeyboardInputMode . |
GraphItemTypes |
getMarqueeSelectableItems()
Determines which types of items should be selected during
marquee selections . |
MarqueeSelectionInputMode |
getMarqueeSelectionInputMode()
Gets the
MarqueeSelectionInputMode property. |
MouseHoverInputMode |
getMouseHoverInputMode()
Gets the
MouseHoverInputMode property. |
MoveViewportInputMode |
getMoveViewportInputMode()
Gets the
MoveViewportInputMode associated with this instance. |
IEventRecognizer |
getMultiSelectionRecognizer()
Gets the
IEventRecognizer that will be queried to decide if a click is deemed a multi selection gesture. |
NavigationInputMode |
getNavigationInputMode()
Gets the
NavigationInputMode property. |
GraphItemTypes |
getSelectableItems()
Determines which types of items should be selectable at all.
|
Predicate<IModelItem> |
getSelectablePredicate()
Gets a predicate that is queried to determine whether a given
IModelItem is selectable. |
TapInputMode |
getTapInputMode()
Gets the
TapInputMode property. |
GraphItemTypes |
getToolTipItems()
Gets the types of the items that should be queried a tool tip for.
|
WaitInputMode |
getWaitInputMode()
Gets the
WaitInputMode that is provided by this instance for those who need to make use of it. |
protected void |
initialize()
Initializes this mode by
adding all of the
minor modes that are used by this mode to this instance. |
void |
install(IInputModeContext context,
ConcurrencyController controller)
Installs this mode into the given context that is provided by the canvas.
|
boolean |
isClipboardOperationsAllowed()
Gets a property that determines whether clipboard operations with the usual shortcuts are enabled on the canvas.
|
boolean |
isIgnoringVoidStylesEnabled()
Gets a value indicating whether void styles (
VoidNodeStyle , VoidEdgeStyle , VoidLabelStyle , and
VoidPortStyle ) should be ignored when selecting or focusing items. |
protected void |
marqueeSelect(IInputModeContext context,
RectD marqueeRectangle)
Performs marquee-selection with the given rectangle.
|
protected <T extends IModelItem> |
marqueeSelect(IInputModeContext context,
RectD marqueeRectangle,
Iterable<T> items,
Predicate<IModelItem> predicate)
Selects the given elements in the editor inside the provided marquee-selection rectangle.
|
void |
marqueeSelect(RectD marqueeRectangle)
Performs marquee-selection with the given rectangle.
|
protected void |
onCanvasClicked(ClickEventArgs args)
Raises the
CanvasClicked event. |
protected void |
onClickInputModeChanged(ClickInputMode oldMode,
ClickInputMode newMode)
Called when the
ClickInputMode property value changes and after initialization of the
field. |
protected void |
onConcurrencyControllerActivated()
|
protected void |
onConcurrencyControllerDeactivated()
|
protected void |
onContextMenuInputModeChanged(AbstractContextMenuInputMode oldMode,
AbstractContextMenuInputMode newMode)
Called when the
AbstractContextMenuInputMode property value changes and after initialization of the field. |
protected void |
onItemClicked(ItemClickedEventArgs<IModelItem> args)
Raises the
ItemClicked event. |
protected void |
onItemDoubleClicked(ItemClickedEventArgs<IModelItem> args)
Raises the
ItemDoubleClicked event. |
protected void |
onItemHoverInputModeChanged(ItemHoverInputMode oldMode,
ItemHoverInputMode newMode)
Called when the
ItemHoverInputMode property value changes and after initialization of
the field. |
protected void |
onItemLeftClicked(ItemClickedEventArgs<IModelItem> args)
Raises the
ItemLeftClicked event. |
protected void |
onItemLeftDoubleClicked(ItemClickedEventArgs<IModelItem> args)
Raises the
ItemLeftDoubleClicked event. |
protected void |
onItemRightClicked(ItemClickedEventArgs<IModelItem> args)
Raises the
ItemRightClicked event. |
protected void |
onItemRightDoubleClicked(ItemClickedEventArgs<IModelItem> args)
Raises the
ItemRightDoubleClicked event. |
protected void |
onKeyboardInputModeChanged(KeyboardInputMode oldMode,
KeyboardInputMode newMode)
Called when the
KeyboardInputMode changed. |
protected void |
onMarqueeSelectionInputModeChanged(MarqueeSelectionInputMode oldMode,
MarqueeSelectionInputMode newMode)
Called when the
MarqueeSelectionInputMode property value changes and after
initialization of the field. |
protected void |
onMouseHoverInputModeChanged(MouseHoverInputMode oldMode,
MouseHoverInputMode newMode)
Called when the
MouseHoverInputMode property value changes and after initialization of the field. |
protected void |
onMoveViewportInputModeChanged(MoveViewportInputMode oldMode,
MoveViewportInputMode newMode)
Called when the
MoveViewportInputMode property value changes and after
initialization of the field. |
protected void |
onMultiSelectionFinished(SelectionEventArgs<IModelItem> args)
Raises the
MultiSelectionFinished event. |
protected void |
onMultiSelectionStarted(SelectionEventArgs<IModelItem> args)
Raises the
MultiSelectionStarted event. |
protected void |
onNavigationInputModeChanged(NavigationInputMode oldMode,
NavigationInputMode newMode)
Called when the
NavigationInputMode property value changes and after initialization of
the field. |
protected void |
onPopulateItemContextMenu(PopulateItemContextMenuEventArgs<IModelItem> args)
Raises the
PopulateItemContextMenu event. |
protected void |
onQueryItemToolTip(QueryItemToolTipEventArgs<IModelItem> args)
Raises the
QueryItemToolTip event. |
protected void |
onTapInputModeChanged(TapInputMode oldMode,
TapInputMode newMode)
Called when the
TapInputMode property value changes and after initialization of the field. |
protected void |
onWaitInputModeChanged(WaitInputMode oldMode,
WaitInputMode newMode)
Called when the
WaitInputMode property value changes and after initialization of the field. |
void |
removeCanvasClickedListener(IEventHandler<ClickEventArgs> canvasClickedEvent)
Removes the given listener for the
CanvasClicked event that occurs when the empty canvas area has been clicked. |
void |
removeItemClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemClickedEvent)
Removes the given listener for the
ItemClicked event that occurs when an item has been clicked. |
void |
removeItemDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemDoubleClickedEvent)
Removes the given listener for the
ItemDoubleClicked event that occurs when an item has been double clicked. |
void |
removeItemLeftClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftClickedEvent)
Removes the given listener for the
ItemLeftClicked event that occurs when an item has been left clicked. |
void |
removeItemLeftDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftDoubleClickedEvent)
Removes the given listener for the
ItemLeftDoubleClicked event that occurs when an item has been left double
clicked. |
void |
removeItemRightClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightClickedEvent)
Removes the given listener for the
ItemRightClicked event that occurs when an item has been right clicked. |
void |
removeItemRightDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightDoubleClickedEvent)
Removes the given listener for the
ItemRightDoubleClicked event that occurs when an item has been right double
clicked. |
void |
removeMultiSelectionFinishedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionFinishedEvent)
Removes the given listener for the
MultiSelectionFinished event that occurs when a single or multi select
operation has been finished. |
void |
removeMultiSelectionStartedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionStartedEvent)
Removes the given listener for the
MultiSelectionStarted event that occurs when a single or multi select
operation has been started. |
void |
removePopulateItemContextMenuListener(IEventHandler<PopulateItemContextMenuEventArgs<IModelItem>> populateItemContextMenuEvent)
Removes the given listener for the
PopulateItemContextMenu event that occurs when the context menu
over an item is about to be opened to determine the contents of the
Menu . |
void |
removeQueryItemToolTipListener(IEventHandler<QueryItemToolTipEventArgs<IModelItem>> queryItemToolTipEvent)
Removes the given listener for the
QueryItemToolTip event that occurs when the mouse is hovering
over an item to determine the tool tip to display. |
void |
selectAll()
Clears the current selection and selects all nodes and bends in this graph.
|
void |
setClickableItems(GraphItemTypes value)
Determines which types of items should be reported through the
item click events . |
void |
setClickHitTestOrder(GraphItemTypes[] value)
Sets the order of the types of items that should be used to determine what item has been clicked or tapped.
|
void |
setClickInputMode(ClickInputMode value)
Sets the
ClickInputMode that is used by this instance to determine clicks. |
void |
setClickSelectableItems(GraphItemTypes value)
Determines which types of items should be selectable by mouse clicks.
|
void |
setClipboardOperationsAllowed(boolean value)
Sets a property that determines whether clipboard operations with the usual shortcuts are enabled on the canvas.
|
void |
setContextMenuInputMode(AbstractContextMenuInputMode value)
Sets the
ContextMenuInputMode property. |
void |
setContextMenuItems(GraphItemTypes value)
Sets the types of items a context menu should be queried for.
|
void |
setCurrentItem(IModelItem item)
Callback that is used by this instance to set the current item on the
NavigationInputMode . |
void |
setCyclicSelectionRecognizer(IEventRecognizer value)
Sets the
IEventRecognizer that will be queried to decide if a click should cycle through all the items that are
currently under the mouse cursor. |
void |
setDetailSelectionRecognizer(IEventRecognizer value)
Sets the
IEventRecognizer that will be queried to decide if a click should select the item that is currently
visible under the mouse cursor, without giving more important items higher priority. |
void |
setDoubleClickHitTestOrder(GraphItemTypes[] value)
Sets the order of the types of items that should be used to determine what item has been double-clicked or
double-tapped.
|
void |
setFocusableItems(GraphItemTypes value)
Sets the items that can be given focus via the
setCurrentItem(IModelItem) method. |
void |
setIgnoringVoidStylesEnabled(boolean value)
Sets a value indicating whether void styles (
VoidNodeStyle , VoidEdgeStyle , VoidLabelStyle , and
VoidPortStyle ) should be ignored when selecting or focusing items. |
void |
setItemHoverInputMode(ItemHoverInputMode value)
Sets the
ItemHoverInputMode that is provided by this instance for those who need to
make use of it. |
void |
setKeyboardInputMode(KeyboardInputMode value)
Sets the
KeyboardInputMode . |
void |
setMarqueeSelectableItems(GraphItemTypes value)
Determines which types of items should be selected during
marquee selections . |
void |
setMarqueeSelectionInputMode(MarqueeSelectionInputMode value)
Sets the
MarqueeSelectionInputMode property. |
void |
setMouseHoverInputMode(MouseHoverInputMode value)
Sets the
MouseHoverInputMode property. |
void |
setMoveViewportInputMode(MoveViewportInputMode value)
Sets the
MoveViewportInputMode associated with this instance. |
void |
setMultiSelectionRecognizer(IEventRecognizer value)
Sets the
IEventRecognizer that will be queried to decide if a click is deemed a multi selection gesture. |
void |
setNavigationInputMode(NavigationInputMode value)
Sets the
NavigationInputMode property. |
void |
setSelectableItems(GraphItemTypes value)
Determines which types of items should be selectable at all.
|
void |
setSelectablePredicate(Predicate<IModelItem> value)
Sets a predicate that is queried to determine whether a given
IModelItem is selectable. |
void |
setSelected(IModelItem item,
boolean selected)
Uses the
GraphSelection to select the given item. |
void |
setTapInputMode(TapInputMode value)
Sets the
TapInputMode property. |
void |
setToolTipItems(GraphItemTypes value)
Sets the types of the items that should be queried a tool tip for.
|
void |
setWaitInputMode(WaitInputMode value)
Sets the
WaitInputMode that is provided by this instance for those who need to make use of it. |
protected boolean |
shouldClick(IModelItem item)
Callback predicate method that is used to determine whether the given
item can be
clicked . |
protected boolean |
shouldClickSelect(IModelItem item)
Callback predicate method that is used to determine whether the given
item should be selected when
clicked with the primary mouse button . |
protected boolean |
shouldDoubleClick(IModelItem item)
Callback predicate method that is used to determine whether the given
item can be
double clicked . |
protected boolean |
shouldFocus(IModelItem item)
Callback that determines whether the provided
IModelItem should be
set to the current item . |
protected boolean |
shouldInstallCommand(ICommand command)
Callback method that is used to determine which of the built-in
ICommand s to install. |
protected boolean |
shouldMarqueeSelect(IModelItem item)
Callback method used by
marqueeSelect(RectD) that takes MarqueeSelectableItems
and shouldSelectItem(IModelItem) into account. |
protected boolean |
shouldPopulateContextMenu(IModelItem item)
Determines whether for the given item a context menu should be queried.
|
protected boolean |
shouldQueryToolTip(IModelItem item)
Determines whether for the given item a tool tip should be queried.
|
protected boolean |
shouldSelectItem(IModelItem item)
Callback predicate method that is used as a broad classification whether an item can generally be selected.
|
protected void |
tap(IModelItem item,
TapEventArgs args)
Actually performs the tap on the given item.
|
void |
uninstall(IInputModeContext context)
Uninstalls this mode from the given context.
|
add, adjustCursor, cancel, createChildInputModeContext, createInputModeEventArgs, getController, getDefaultCursor, getInputModeContext, getMutexOwner, getPriority, getSortedModes, invalidate, isEnabled, isExclusive, remove, setDefaultCursor, setEnabled, setExclusive, setPriority, stop, subModePriorityChanged
public GraphViewerInputMode()
GraphViewerInputMode
class.protected MarqueeSelectionInputMode createMarqueeSelectionInputMode()
MarqueeSelectionInputMode
property.
This method will be called upon first access to the MarqueeSelectionInputMode
property.
protected NavigationInputMode createNavigationInputMode()
NavigationInputMode
property.
This method will be called upon first access to the NavigationInputMode
property.
public final void addCanvasClickedListener(IEventHandler<ClickEventArgs> canvasClickedEvent)
CanvasClicked
event that occurs when the empty canvas area has been clicked.
If one of the event handlers sets the Handled
property to true
the event will
not be propagated anymore.
canvasClickedEvent
- The listener to add.addItemClickedListener(IEventHandler)
,
removeCanvasClickedListener(IEventHandler)
public final void addItemClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemClickedEvent)
ItemClicked
event that occurs when an item has been clicked.
If one of the event handlers sets the Handled
property to true
the
event will not be propagated anymore.
This event will also be raised for taps
.
Button-specific events (ItemLeftClicked
and
ItemRightClicked
) will be raised before this event. If one of
those is marked Handled
this event will not be raised anymore.
itemClickedEvent
- The listener to add.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemLeftClickedListener(IEventHandler)
,
addItemRightClickedListener(IEventHandler)
,
removeItemClickedListener(IEventHandler)
public final void addItemDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemDoubleClickedEvent)
ItemDoubleClicked
event that occurs when an item has been double clicked.
If one of the event handlers sets the Handled
property to true
the
event will not be propagated anymore.
Depending on the value of the DoubleClickPolicy
property of ClickInputMode
this event may be preceded by no, one, or two ItemClicked
events (as well
as the corresponding button-specific event).
Button-specific events (ItemLeftDoubleClicked
and
ItemRightDoubleClicked
) will be raised before this event.
If one of those is marked Handled
this event will not be raised anymore.
itemDoubleClickedEvent
- The listener to add.addItemClickedListener(IEventHandler)
,
getClickableItems()
,
addItemLeftDoubleClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
,
removeItemDoubleClickedListener(IEventHandler)
public final void addItemLeftClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftClickedEvent)
ItemLeftClicked
event that occurs when an item has been left clicked.
This event will be raised before the ItemClicked
event. If one of the
event handlers sets the Handled
property to true
the event will not be
propagated anymore. This also means that the ItemClicked
event will not
be raised in that case.
itemLeftClickedEvent
- The listener to add.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemClickedListener(IEventHandler)
,
addItemRightClickedListener(IEventHandler)
,
addItemLeftDoubleClickedListener(IEventHandler)
,
removeItemLeftClickedListener(IEventHandler)
public final void addItemLeftDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftDoubleClickedEvent)
ItemLeftDoubleClicked
event that occurs when an item has been left double
clicked.
This event will be raised before the ItemDoubleClicked
event. If
one of the event handlers sets the Handled
property to true
the event
will not be propagated anymore. This also means that the ItemDoubleClicked
event will not be raised in that case.
itemLeftDoubleClickedEvent
- The listener to add.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
,
removeItemLeftDoubleClickedListener(IEventHandler)
public final void addItemRightClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightClickedEvent)
ItemRightClicked
event that occurs when an item has been right clicked.
This event will be raised before the ItemClicked
event. If one of the
event handlers sets the Handled
property to true
the event will not be
propagated anymore. This also means that the ItemClicked
event will not
be raised in that case.
itemRightClickedEvent
- The listener to add.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemClickedListener(IEventHandler)
,
addItemLeftClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
,
removeItemRightClickedListener(IEventHandler)
public final void addItemRightDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightDoubleClickedEvent)
ItemRightDoubleClicked
event that occurs when an item has been right double
clicked.
This event will be raised before the ItemDoubleClicked
event. If
one of the event handlers sets the Handled
property to true
the event
will not be propagated anymore. This also means that the ItemDoubleClicked
event will not be raised in that case.
itemRightDoubleClickedEvent
- The listener to add.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemLeftDoubleClickedListener(IEventHandler)
,
removeItemRightDoubleClickedListener(IEventHandler)
public final void addMultiSelectionFinishedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionFinishedEvent)
MultiSelectionFinished
event that occurs when a single or multi select operation
has been finished.
The event is not triggered for the individual selection operations that constitute a multi selection operation.
multiSelectionFinishedEvent
- The listener to add.removeMultiSelectionFinishedListener(IEventHandler)
public final void addMultiSelectionStartedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionStartedEvent)
MultiSelectionStarted
event that occurs when a single or multi select operation
has been started.
The event is not triggered for the individual selection operations that constitute a multi selection operation.
multiSelectionStartedEvent
- The listener to add.removeMultiSelectionStartedListener(IEventHandler)
public final void addPopulateItemContextMenuListener(IEventHandler<PopulateItemContextMenuEventArgs<IModelItem>> populateItemContextMenuEvent)
PopulateItemContextMenu
event that occurs when the context menu
over an item is about to be opened to determine the contents of the
Menu
.
This method will only be called for items that match the ContextMenuItems
type.
populateItemContextMenuEvent
- The listener to add.removePopulateItemContextMenuListener(IEventHandler)
public final void addQueryItemToolTipListener(IEventHandler<QueryItemToolTipEventArgs<IModelItem>> queryItemToolTipEvent)
QueryItemToolTip
event that occurs when the mouse is hovering
over an item to determine the tool tip to display.
This method will only be called for items that match the ToolTipItems
type.
queryItemToolTipEvent
- The listener to add.removeQueryItemToolTipListener(IEventHandler)
protected Object childInputModeContextLookup(Class type)
MultiplexingInputMode
child context's
ILookup.lookup(Class)
method.childInputModeContextLookup
in class MultiplexingInputMode
type
- The type argument passed to ILookup.lookup(Class)
.null
.MultiplexingInputMode.createChildInputModeContext()
public void clearSelection()
GraphSelection
.
This implementation may be overridden for customizations. All it does is call
ISelectionModel.clear()
.
protected void click(IModelItem item, ClickEventArgs args)
This will raise the ItemLeftClicked
, ItemRightClicked
(depending on the button), and ItemClicked
events. If either event is
unhandled by all its event handlers the item will be selected
and
focused
. Before selection
the current selection will be cleared
, unless the MultiSelectionRecognizer
is triggered.
item
- The item that has been clicked.args
- The original event arguments for the click. Setting its Handled
property to true
will indicate that the click was handled. By default this happens when the clicked item is either selected or focused.protected boolean clickClearSelection(IInputModeContext context)
the click
is not
recognized by MultiSelectionRecognizer
.
This method is only called if no item has been hit and at least one item is currently selected.
This will use the clearSelection()
method to deselect all items.
context
- The context where the click appearedpublic void copy()
protected ClickInputMode createClickInputMode()
This method will be called upon first access to the ClickInputMode
property.
This implementation activates
both MouseButtons.LEFT
and
MouseButtons.RIGHT
protected AbstractContextMenuInputMode createContextMenuInputMode()
ContextMenuInputMode
property.
This method will be called upon first access to the AbstractContextMenuInputMode
property.
protected ItemHoverInputMode createItemHoverInputMode()
ItemHoverInputMode
property.
This method will be called upon first access to the ItemHoverInputMode
property.
ItemHoverInputMode
with the HoverItems
property set to GraphItemTypes.NONE
.protected KeyboardInputMode createKeyboardInputMode()
KeyboardInputMode
instance.protected MouseHoverInputMode createMouseHoverInputMode()
MouseHoverInputMode
property.
This method will be called upon first access to the MouseHoverInputMode
property.
MouseHoverInputMode
protected MoveViewportInputMode createMoveViewportInputMode()
MoveViewportInputMode
property.
This method will be called upon first access to the MoveViewportInputMode
property.
MoveViewportInputMode
protected SelectionEventArgs<IModelItem> createSelectionEventArgs(IInputModeContext context)
SelectionEventArgs
using the GraphSelection
for this input mode.context
- An input mode context that is available in the SelectionEventArgs
.
Can be null
in which case a new context for this instance is created automatically.
protected TapInputMode createTapInputMode()
TapInputMode
property.
This method will be called upon first access to the TapInputMode
property.
protected WaitInputMode createWaitInputMode()
This method will be called upon first access to the WaitInputMode
property.
WaitInputMode
protected void doubleClick(IModelItem item, ClickEventArgs args)
This will raise the ItemLeftDoubleClicked
and ItemRightDoubleClicked
(depending on the button), and ItemDoubleClicked
events.
item
- The item that has been double-clicked.args
- The original event arguments for the click. Setting its Handled
property to true
will indicate that the double-click was handled and events on other items in the same location are no longer raised.protected void doubleTap(IModelItem item, TapEventArgs args)
This will raise the ItemDoubleClicked
event.
item
- The item that has been double-tapped.args
- The original event arguments for the tap. Setting its Handled
property to true
will indicate that the double-tap was handled and events on other items in the same location are no longer raised.public final IEnumerable<IModelItem> findItems(IInputModeContext context, PointD location, GraphItemTypes[] tests)
This implementation uses the HitTester
to
determine the hit items.
context
- The context to use for to the IHitTestable.isHit(IInputModeContext, PointD)
callback.location
- The location to test.tests
- An array of GraphItemTypes
values that encode for which model items the hit test should be performed for
prioritizing.public IEnumerable<IModelItem> findItems(IInputModeContext context, PointD location, GraphItemTypes[] tests, Predicate<IModelItem> filter)
This implementation uses the HitTester
to
determine the hit items.
context
- The context to use for to the IHitTestable.isHit(IInputModeContext, PointD)
callback.location
- The location to test.tests
- An array of GraphItemTypes
values that encode for which model items the hit test should be performed for
prioritizing.filter
- The predicate that can be used to filter the results. May be null
.public final IEnumerable<IModelItem> findItems(PointD location, GraphItemTypes[] tests)
This implementation uses the HitTester
to
determine the hit items.
location
- The location to test.tests
- An array of GraphItemTypes
values that encode for which model items the hit test should be performed for
prioritizing.public IEnumerable<IModelItem> findItems(PointD location, GraphItemTypes[] tests, Predicate<IModelItem> filter)
This implementation uses the HitTester
to
determine the hit items.
location
- The location to test.tests
- An array of GraphItemTypes
values that encode for which model items the hit test should be performed for
prioritizing.filter
- The predicate that can be used to filter the results. May be null
.public final Collection<ICommand> getAvailableCommands()
This collection can be modified by removing commands to prevent the input mode from handling them. Previously removed commands can also be re-added again to enable them again. However, the input mode will never handle commands that weren't in the initial collection. Adding those will do nothing.
public final GraphItemTypes getClickableItems()
item click events
.
This also affects taps.
The default is GraphItemTypes.ALL
.
shouldClick(IModelItem)
,
setClickableItems(GraphItemTypes)
public final GraphItemTypes[] getClickHitTestOrder()
Change this field to adjust which items will be selected
if there are multiple
items at a given location. The default order is
getClickSelectableItems()
,
getSelectableItems()
,
findItems(PointD, GraphItemTypes[], Predicate)
,
setClickHitTestOrder(GraphItemTypes[])
public final ClickInputMode getClickInputMode()
ClickInputMode
that is used by this instance to determine clicks.
Whenever the mode detects a click
, this mode will use the IHitTester
from the InputModeContext
to determine the items being hit. If they
match the ClickableItems
type, the ItemClicked
event will be triggered. If they shouldFocus(IModelItem)
, the item will be
set as the current item
.
If the field has not yet been initialized upon first access, the factory method createClickInputMode()
will be
called. Upon change the onClickInputModeChanged(ClickInputMode, ClickInputMode)
method will be called.
By default this input mode has a priority of 10
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.onItemClicked(ItemClickedEventArgs)
,
setClickInputMode(ClickInputMode)
public final GraphItemTypes getClickSelectableItems()
The default is GraphItemTypes.ALL
.
shouldClickSelect(IModelItem)
,
setSelected(IModelItem, boolean)
,
setClickSelectableItems(GraphItemTypes)
public final AbstractContextMenuInputMode getContextMenuInputMode()
ContextMenuInputMode
property.
If the field has not yet been initialized upon first access, the factory method createContextMenuInputMode()
will be called. Upon change the onContextMenuInputModeChanged(AbstractContextMenuInputMode, AbstractContextMenuInputMode)
method will be called.
By default this input mode has a priority of 60
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setContextMenuInputMode(AbstractContextMenuInputMode)
public final GraphItemTypes getContextMenuItems()
The items for which a context menu should be queried
. The
default value is GraphItemTypes.NODE
|GraphItemTypes.EDGE
.
setContextMenuItems(GraphItemTypes)
public final IEventRecognizer getCyclicSelectionRecognizer()
IEventRecognizer
that will be queried to decide if a click should cycle through all the items that are
currently under the mouse cursor.
If the recognizer determines that the user wanted to use the cyclic click selection behavior, the HitTester
will be queried for the given item and previously reported items will be ignored. E.g. if multiple nodes are overlapping
each other, clicking on them will report the first item for the first click, the second one for the second click and so
on. If all elements have been reported previously, the first one is going to be reported again. If the order of the
elements at the clicked location changes, the cyclic selection is restarted anew.
The default is IEventRecognizer.ALT_PRESSED
.
setCyclicSelectionRecognizer(IEventRecognizer)
public final IEventRecognizer getDetailSelectionRecognizer()
IEventRecognizer
that will be queried to decide if a click should select the item that is currently
visible under the mouse cursor, without giving more important items higher priority.
If the recognizer determines that the user wanted to use the detail clicking behavior, the HitTester
will be queried for the given item and the first item that is returned will be considered a hit. Otherwise all hit items
are examined and are prioritized by item type. E.g. by default clicking on a node will select the node, even if there is
a node label which has been clicked at the same point. If detail selection is recognized, the label will be selected.
The default is IEventRecognizer.SHIFT_PRESSED
.
setDetailSelectionRecognizer(IEventRecognizer)
public final GraphItemTypes[] getDoubleClickHitTestOrder()
Change this field to adjust which items will be considered when double-clicked
if there are multiple items at a given location. The default order is
getClickSelectableItems()
,
getSelectableItems()
,
findItems(IInputModeContext, PointD, GraphItemTypes[], Predicate)
,
setDoubleClickHitTestOrder(GraphItemTypes[])
public final GraphItemTypes getFocusableItems()
setCurrentItem(IModelItem)
method.
The focusable items. The default is GraphItemTypes.NODE
setFocusableItems(GraphItemTypes)
public IGraph getGraph()
InputModeContext
.null
.public IGraphSelection getGraphSelection()
InputModeContext
.public final ItemHoverInputMode getItemHoverInputMode()
ItemHoverInputMode
that is provided by this instance for those who need to
make use of it.
Note that initially the HoverItems
property is set to
GraphItemTypes.NONE
, which effectively disables the functionality of the mode initially. In order to get the
mode to fire events, the property should be set to a corresponding value.
If the backing field has not yet been initialized upon first access, the factory method createItemHoverInputMode()
will be called. Upon change the onItemHoverInputModeChanged(ItemHoverInputMode, ItemHoverInputMode)
method will
be called.
By default this input mode has a priority of 55
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setItemHoverInputMode(ItemHoverInputMode)
public final KeyboardInputMode getKeyboardInputMode()
KeyboardInputMode
.
By default this input mode has a priority of 0
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.KeyboardInputMode
.setKeyboardInputMode(KeyboardInputMode)
public final GraphItemTypes getMarqueeSelectableItems()
marquee selections
.
The default is a combination of GraphItemTypes.NODE
, GraphItemTypes.EDGE
, and
GraphItemTypes.BEND
.
shouldMarqueeSelect(IModelItem)
,
setSelected(IModelItem, boolean)
,
setMarqueeSelectableItems(GraphItemTypes)
public final MarqueeSelectionInputMode getMarqueeSelectionInputMode()
MarqueeSelectionInputMode
property.
If the field has not yet been initialized upon first access, the factory method createMarqueeSelectionInputMode()
will be called. Upon change the onMarqueeSelectionInputModeChanged(MarqueeSelectionInputMode, MarqueeSelectionInputMode)
method will be called.
By default this input mode has a priority of 50
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setMarqueeSelectionInputMode(MarqueeSelectionInputMode)
public final MouseHoverInputMode getMouseHoverInputMode()
MouseHoverInputMode
property.
If the field has not yet been initialized upon first access, the factory method createMouseHoverInputMode()
will be called. Upon change the onMouseHoverInputModeChanged(MouseHoverInputMode, MouseHoverInputMode)
method
will be called.
By default this input mode has a priority of 100
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setMouseHoverInputMode(MouseHoverInputMode)
public final MoveViewportInputMode getMoveViewportInputMode()
MoveViewportInputMode
associated with this instance.
If the field has not yet been initialized upon first access, the factory method createMoveViewportInputMode()
will be called. Upon change the onMoveViewportInputModeChanged(MoveViewportInputMode, MoveViewportInputMode)
method will be called.
By default this input mode has a priority of 39
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setMoveViewportInputMode(MoveViewportInputMode)
public final IEventRecognizer getMultiSelectionRecognizer()
IEventRecognizer
that will be queried to decide if a click is deemed a multi selection gesture.
The default is IEventRecognizer.SHORTCUT_PRESSED
.
setMultiSelectionRecognizer(IEventRecognizer)
public final NavigationInputMode getNavigationInputMode()
NavigationInputMode
property.
This mode is responsible for navigating and traversing the elements in the IGraph
. If the field has not yet been
initialized upon first access, the factory method createNavigationInputMode()
will be called. Upon change the onNavigationInputModeChanged(NavigationInputMode, NavigationInputMode)
method will be called.
By default this input mode has a priority of 55
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setNavigationInputMode(NavigationInputMode)
public final GraphItemTypes getSelectableItems()
The default is GraphItemTypes.ALL
.
setSelected(IModelItem, boolean)
,
setSelectableItems(GraphItemTypes)
public final Predicate<IModelItem> getSelectablePredicate()
IModelItem
is selectable.
This allows to further restrict which items are selectable, compared to SelectableItems
.
If this property is set to null
the effect is the same as a predicate that always returns true
.
setSelectablePredicate(Predicate)
public final TapInputMode getTapInputMode()
TapInputMode
property.
If the field has not yet been initialized upon first access, the factory method createTapInputMode()
will be
called. Upon change the onTapInputModeChanged(TapInputMode, TapInputMode)
method will be called.
By default this input mode has a priority of 20
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setTapInputMode(TapInputMode)
public final GraphItemTypes getToolTipItems()
The items for which a tool tip text should be queried
. The default
value is
GraphItemTypes.NODE
|GraphItemTypes.EDGE
|GraphItemTypes.LABEL
|GraphItemTypes.PORT
|.
setToolTipItems(GraphItemTypes)
public final WaitInputMode getWaitInputMode()
WaitInputMode
that is provided by this instance for those who need to make use of it.
If the field has not yet been initialized upon first access, the factory method createWaitInputMode()
will be
called. Upon change the onWaitInputModeChanged(WaitInputMode, WaitInputMode)
method will be called.
By default this input mode has a priority of -1
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.WaitInputMode.isWaiting()
,
setWaitInputMode(WaitInputMode)
protected void initialize()
adding
all of the
minor modes that are used by this mode to this instance.public void install(IInputModeContext context, ConcurrencyController controller)
IInputMode
In general a mode can only be installed into a single canvas at all times.
This method is called to initialize this instance. Subclasses should override this method to register the corresponding
event handler delegates for the various input events they need to register with.
When this instance gets uninstalled
from the context the same context instance
will be passed to it.
Implementations may hold a reference to the context
instance and use it while they are being installed.
install
in interface IInputMode
install
in class MultiplexingInputMode
context
- The context that this instance shall be installed into. The same instance will be passed to this instance during
IInputMode.uninstall(IInputModeContext)
. A reference to the context may be kept and queried during the time the mode
is installed.controller
- The ConcurrencyController
for this mode.IInputMode.uninstall(IInputModeContext)
public final boolean isClipboardOperationsAllowed()
Default value is true
setClipboardOperationsAllowed(boolean)
public final boolean isIgnoringVoidStylesEnabled()
VoidNodeStyle
, VoidEdgeStyle
, VoidLabelStyle
, and
VoidPortStyle
) should be ignored when selecting or focusing items.true
if void styles should be ignored for selection and focus; false
otherwise. Default is
true
.setIgnoringVoidStylesEnabled(boolean)
protected void marqueeSelect(IInputModeContext context, RectD marqueeRectangle)
This method is called internally when either the marqueeSelect(RectD)
method is called or the user performs a
marquee-selection gesture via MarqueeSelectionInputMode
.
context
- The input mode context.marqueeRectangle
- The selection rectangle.protected <T extends IModelItem> void marqueeSelect(IInputModeContext context, RectD marqueeRectangle, Iterable<T> items, Predicate<IModelItem> predicate)
This implementation iterates over the items and queries them for an implementation of IMarqueeTestable
using
their ILookup.lookup(Class)
. This instance will be used to determine whether the item should be selected.
This method is, in the default implementation, only called with individual item types in items
.
context
- The input mode context.marqueeRectangle
- The rectangle in world coordinates.items
- The items to iterate over.predicate
- The predicate that determines whether the provided item should be tested at all. May be null
.setSelected(IModelItem, boolean)
,
marqueeSelect(IInputModeContext, RectD)
public final void marqueeSelect(RectD marqueeRectangle)
It delegates directly to the marqueeSelect(IInputModeContext, RectD)
overload internally.
marqueeRectangle
- The selection rectangle.protected void onCanvasClicked(ClickEventArgs args)
CanvasClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ClickEventArgs
instance that contains the information about the click.protected void onClickInputModeChanged(ClickInputMode oldMode, ClickInputMode newMode)
ClickInputMode
property value changes and after initialization of the
field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onConcurrencyControllerActivated()
MultiplexingInputMode
Active
property of the installed ConcurrencyController
has been set to true
.
This implementation reenabled previously disabled concurrent child modes.
onConcurrencyControllerActivated
in class MultiplexingInputMode
protected void onConcurrencyControllerDeactivated()
MultiplexingInputMode
Active
property of the installed ConcurrencyController
has been set to false
.
This implementation sets the PreferredCursor
property to null
and releases
the mutex if the mutex is currently owned by this instance.
Also, all concurrent child modes will be disabled.
onConcurrencyControllerDeactivated
in class MultiplexingInputMode
protected void onContextMenuInputModeChanged(AbstractContextMenuInputMode oldMode, AbstractContextMenuInputMode newMode)
AbstractContextMenuInputMode
property value changes and after initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onItemClicked(ItemClickedEventArgs<IModelItem> args)
ItemClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ItemClickedEventArgs
instance that contains the item that has been clicked.protected void onItemDoubleClicked(ItemClickedEventArgs<IModelItem> args)
ItemDoubleClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ItemClickedEventArgs
instance that contains the item that has been double clicked.protected void onItemHoverInputModeChanged(ItemHoverInputMode oldMode, ItemHoverInputMode newMode)
ItemHoverInputMode
property value changes and after initialization of
the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onItemLeftClicked(ItemClickedEventArgs<IModelItem> args)
ItemLeftClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ItemClickedEventArgs
instance that contains the item that has been clicked.protected void onItemLeftDoubleClicked(ItemClickedEventArgs<IModelItem> args)
ItemLeftDoubleClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ItemClickedEventArgs
instance that contains the item that has been double clicked.protected void onItemRightClicked(ItemClickedEventArgs<IModelItem> args)
ItemRightClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ItemClickedEventArgs
instance that contains the item that has been clicked.protected void onItemRightDoubleClicked(ItemClickedEventArgs<IModelItem> args)
ItemRightDoubleClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ItemClickedEventArgs
instance that contains the item that has been double clicked.protected void onKeyboardInputModeChanged(KeyboardInputMode oldMode, KeyboardInputMode newMode)
KeyboardInputMode
changed.oldMode
- The old KeyboardInputMode
.newMode
- The new KeyboardInputMode
.protected void onMarqueeSelectionInputModeChanged(MarqueeSelectionInputMode oldMode, MarqueeSelectionInputMode newMode)
MarqueeSelectionInputMode
property value changes and after
initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onMouseHoverInputModeChanged(MouseHoverInputMode oldMode, MouseHoverInputMode newMode)
MouseHoverInputMode
property value changes and after initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onMoveViewportInputModeChanged(MoveViewportInputMode oldMode, MoveViewportInputMode newMode)
MoveViewportInputMode
property value changes and after
initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onMultiSelectionFinished(SelectionEventArgs<IModelItem> args)
MultiSelectionFinished
event.protected void onMultiSelectionStarted(SelectionEventArgs<IModelItem> args)
MultiSelectionStarted
event.protected void onNavigationInputModeChanged(NavigationInputMode oldMode, NavigationInputMode newMode)
NavigationInputMode
property value changes and after initialization of
the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onPopulateItemContextMenu(PopulateItemContextMenuEventArgs<IModelItem> args)
PopulateItemContextMenu
event.args
- The PopulateItemContextMenuEventArgs
instance containing the event data.protected void onQueryItemToolTip(QueryItemToolTipEventArgs<IModelItem> args)
QueryItemToolTip
event.args
- The QueryItemToolTipEventArgs
instance containing the event data.protected void onTapInputModeChanged(TapInputMode oldMode, TapInputMode newMode)
TapInputMode
property value changes and after initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onWaitInputModeChanged(WaitInputMode oldMode, WaitInputMode newMode)
WaitInputMode
property value changes and after initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valuepublic final void removeCanvasClickedListener(IEventHandler<ClickEventArgs> canvasClickedEvent)
CanvasClicked
event that occurs when the empty canvas area has been clicked.
If one of the event handlers sets the Handled
property to true
the event will
not be propagated anymore.
canvasClickedEvent
- The listener to remove.addItemClickedListener(IEventHandler)
,
addCanvasClickedListener(IEventHandler)
public final void removeItemClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemClickedEvent)
ItemClicked
event that occurs when an item has been clicked.
If one of the event handlers sets the Handled
property to true
the
event will not be propagated anymore.
This event will also be raised for taps
.
Button-specific events (ItemLeftClicked
and
ItemRightClicked
) will be raised before this event. If one of
those is marked Handled
this event will not be raised anymore.
itemClickedEvent
- The listener to remove.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemLeftClickedListener(IEventHandler)
,
addItemRightClickedListener(IEventHandler)
,
addItemClickedListener(IEventHandler)
public final void removeItemDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemDoubleClickedEvent)
ItemDoubleClicked
event that occurs when an item has been double clicked.
If one of the event handlers sets the Handled
property to true
the
event will not be propagated anymore.
Depending on the value of the DoubleClickPolicy
property of ClickInputMode
this event may be preceded by no, one, or two ItemClicked
events (as well
as the corresponding button-specific event).
Button-specific events (ItemLeftDoubleClicked
and
ItemRightDoubleClicked
) will be raised before this event.
If one of those is marked Handled
this event will not be raised anymore.
itemDoubleClickedEvent
- The listener to remove.addItemClickedListener(IEventHandler)
,
getClickableItems()
,
addItemLeftDoubleClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
,
addItemDoubleClickedListener(IEventHandler)
public final void removeItemLeftClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftClickedEvent)
ItemLeftClicked
event that occurs when an item has been left clicked.
This event will be raised before the ItemClicked
event. If one of the
event handlers sets the Handled
property to true
the event will not be
propagated anymore. This also means that the ItemClicked
event will not
be raised in that case.
itemLeftClickedEvent
- The listener to remove.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemClickedListener(IEventHandler)
,
addItemRightClickedListener(IEventHandler)
,
addItemLeftDoubleClickedListener(IEventHandler)
,
addItemLeftClickedListener(IEventHandler)
public final void removeItemLeftDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftDoubleClickedEvent)
ItemLeftDoubleClicked
event that occurs when an item has been left double
clicked.
This event will be raised before the ItemDoubleClicked
event. If
one of the event handlers sets the Handled
property to true
the event
will not be propagated anymore. This also means that the ItemDoubleClicked
event will not be raised in that case.
itemLeftDoubleClickedEvent
- The listener to remove.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
,
addItemLeftDoubleClickedListener(IEventHandler)
public final void removeItemRightClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightClickedEvent)
ItemRightClicked
event that occurs when an item has been right clicked.
This event will be raised before the ItemClicked
event. If one of the
event handlers sets the Handled
property to true
the event will not be
propagated anymore. This also means that the ItemClicked
event will not
be raised in that case.
itemRightClickedEvent
- The listener to remove.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemClickedListener(IEventHandler)
,
addItemLeftClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
,
addItemRightClickedListener(IEventHandler)
public final void removeItemRightDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightDoubleClickedEvent)
ItemRightDoubleClicked
event that occurs when an item has been right double
clicked.
This event will be raised before the ItemDoubleClicked
event. If
one of the event handlers sets the Handled
property to true
the event
will not be propagated anymore. This also means that the ItemDoubleClicked
event will not be raised in that case.
itemRightDoubleClickedEvent
- The listener to remove.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemLeftDoubleClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
public final void removeMultiSelectionFinishedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionFinishedEvent)
MultiSelectionFinished
event that occurs when a single or multi select
operation has been finished.
The event is not triggered for the individual selection operations that constitute a multi selection operation.
multiSelectionFinishedEvent
- The listener to remove.addMultiSelectionFinishedListener(IEventHandler)
public final void removeMultiSelectionStartedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionStartedEvent)
MultiSelectionStarted
event that occurs when a single or multi select
operation has been started.
The event is not triggered for the individual selection operations that constitute a multi selection operation.
multiSelectionStartedEvent
- The listener to remove.addMultiSelectionStartedListener(IEventHandler)
public final void removePopulateItemContextMenuListener(IEventHandler<PopulateItemContextMenuEventArgs<IModelItem>> populateItemContextMenuEvent)
PopulateItemContextMenu
event that occurs when the context menu
over an item is about to be opened to determine the contents of the
Menu
.
This method will only be called for items that match the ContextMenuItems
type.
populateItemContextMenuEvent
- The listener to remove.addPopulateItemContextMenuListener(IEventHandler)
public final void removeQueryItemToolTipListener(IEventHandler<QueryItemToolTipEventArgs<IModelItem>> queryItemToolTipEvent)
QueryItemToolTip
event that occurs when the mouse is hovering
over an item to determine the tool tip to display.
This method will only be called for items that match the ToolTipItems
type.
queryItemToolTipEvent
- The listener to remove.addQueryItemToolTipListener(IEventHandler)
public void selectAll()
By default, this method will be called in response to a Ctrl+A on Windows and Linux and Command+A on Mac OS key press recognized by
KeyboardInputMode
.
public final void setClickableItems(GraphItemTypes value)
item click events
.
This also affects taps.
The default is GraphItemTypes.ALL
.
value
- The ClickableItems to set.shouldClick(IModelItem)
,
getClickableItems()
public final void setClickHitTestOrder(GraphItemTypes[] value)
Change this field to adjust which items will be selected
if there are multiple
items at a given location. The default order is
value
- The ClickHitTestOrder to set.getClickSelectableItems()
,
getSelectableItems()
,
findItems(PointD, GraphItemTypes[], Predicate)
,
getClickHitTestOrder()
public final void setClickInputMode(ClickInputMode value)
ClickInputMode
that is used by this instance to determine clicks.
Whenever the mode detects a click
, this mode will use the IHitTester
from the InputModeContext
to determine the items being hit. If they
match the ClickableItems
type, the ItemClicked
event will be triggered. If they shouldFocus(IModelItem)
, the item will be
set as the current item
.
If the field has not yet been initialized upon first access, the factory method createClickInputMode()
will be
called. Upon change the onClickInputModeChanged(ClickInputMode, ClickInputMode)
method will be called.
By default this input mode has a priority of 10
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The ClickInputMode to set.onItemClicked(ItemClickedEventArgs)
,
getClickInputMode()
public final void setClickSelectableItems(GraphItemTypes value)
The default is GraphItemTypes.ALL
.
value
- The ClickSelectableItems to set.shouldClickSelect(IModelItem)
,
setSelected(IModelItem, boolean)
,
getClickSelectableItems()
public final void setClipboardOperationsAllowed(boolean value)
Default value is true
value
- The ClipboardOperationsAllowed to set.isClipboardOperationsAllowed()
public final void setContextMenuInputMode(AbstractContextMenuInputMode value)
ContextMenuInputMode
property.
If the field has not yet been initialized upon first access, the factory method createContextMenuInputMode()
will be called. Upon change the onContextMenuInputModeChanged(AbstractContextMenuInputMode, AbstractContextMenuInputMode)
method will be called.
By default this input mode has a priority of 60
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The ContextMenuInputMode to set.getContextMenuInputMode()
public final void setContextMenuItems(GraphItemTypes value)
The items for which a context menu should be queried
. The
default value is GraphItemTypes.NODE
|GraphItemTypes.EDGE
.
value
- The ContextMenuItems to set.getContextMenuItems()
public void setCurrentItem(IModelItem item)
NavigationInputMode
.item
- The item to set as the new "current" item.public final void setCyclicSelectionRecognizer(IEventRecognizer value)
IEventRecognizer
that will be queried to decide if a click should cycle through all the items that are
currently under the mouse cursor.
If the recognizer determines that the user wanted to use the cyclic click selection behavior, the HitTester
will be queried for the given item and previously reported items will be ignored. E.g. if multiple nodes are overlapping
each other, clicking on them will report the first item for the first click, the second one for the second click and so
on. If all elements have been reported previously, the first one is going to be reported again. If the order of the
elements at the clicked location changes, the cyclic selection is restarted anew.
The default is IEventRecognizer.ALT_PRESSED
.
value
- The CyclicSelectionRecognizer to set.getCyclicSelectionRecognizer()
public final void setDetailSelectionRecognizer(IEventRecognizer value)
IEventRecognizer
that will be queried to decide if a click should select the item that is currently
visible under the mouse cursor, without giving more important items higher priority.
If the recognizer determines that the user wanted to use the detail clicking behavior, the HitTester
will be queried for the given item and the first item that is returned will be considered a hit. Otherwise all hit items
are examined and are prioritized by item type. E.g. by default clicking on a node will select the node, even if there is
a node label which has been clicked at the same point. If detail selection is recognized, the label will be selected.
The default is IEventRecognizer.SHIFT_PRESSED
.
value
- The DetailSelectionRecognizer to set.getDetailSelectionRecognizer()
public final void setDoubleClickHitTestOrder(GraphItemTypes[] value)
Change this field to adjust which items will be considered when double-clicked
if there are multiple items at a given location. The default order is
value
- The DoubleClickHitTestOrder to set.getClickSelectableItems()
,
getSelectableItems()
,
findItems(IInputModeContext, PointD, GraphItemTypes[], Predicate)
,
getDoubleClickHitTestOrder()
public final void setFocusableItems(GraphItemTypes value)
setCurrentItem(IModelItem)
method.
The focusable items. The default is GraphItemTypes.NODE
value
- The FocusableItems to set.getFocusableItems()
public final void setIgnoringVoidStylesEnabled(boolean value)
VoidNodeStyle
, VoidEdgeStyle
, VoidLabelStyle
, and
VoidPortStyle
) should be ignored when selecting or focusing items.value
- true
if void styles should be ignored for selection and focus; false
otherwise. Default is
true
.isIgnoringVoidStylesEnabled()
public final void setItemHoverInputMode(ItemHoverInputMode value)
ItemHoverInputMode
that is provided by this instance for those who need to
make use of it.
Note that initially the HoverItems
property is set to
GraphItemTypes.NONE
, which effectively disables the functionality of the mode initially. In order to get the
mode to fire events, the property should be set to a corresponding value.
If the backing field has not yet been initialized upon first access, the factory method createItemHoverInputMode()
will be called. Upon change the onItemHoverInputModeChanged(ItemHoverInputMode, ItemHoverInputMode)
method will
be called.
By default this input mode has a priority of 55
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The ItemHoverInputMode to set.getItemHoverInputMode()
public final void setKeyboardInputMode(KeyboardInputMode value)
KeyboardInputMode
.
By default this input mode has a priority of 0
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The KeyboardInputMode
.getKeyboardInputMode()
public final void setMarqueeSelectableItems(GraphItemTypes value)
marquee selections
.
The default is a combination of GraphItemTypes.NODE
, GraphItemTypes.EDGE
, and
GraphItemTypes.BEND
.
value
- The MarqueeSelectableItems to set.shouldMarqueeSelect(IModelItem)
,
setSelected(IModelItem, boolean)
,
getMarqueeSelectableItems()
public final void setMarqueeSelectionInputMode(MarqueeSelectionInputMode value)
MarqueeSelectionInputMode
property.
If the field has not yet been initialized upon first access, the factory method createMarqueeSelectionInputMode()
will be called. Upon change the onMarqueeSelectionInputModeChanged(MarqueeSelectionInputMode, MarqueeSelectionInputMode)
method will be called.
By default this input mode has a priority of 50
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The MarqueeSelectionInputMode to set.getMarqueeSelectionInputMode()
public final void setMouseHoverInputMode(MouseHoverInputMode value)
MouseHoverInputMode
property.
If the field has not yet been initialized upon first access, the factory method createMouseHoverInputMode()
will be called. Upon change the onMouseHoverInputModeChanged(MouseHoverInputMode, MouseHoverInputMode)
method
will be called.
By default this input mode has a priority of 100
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The MouseHoverInputMode to set.getMouseHoverInputMode()
public final void setMoveViewportInputMode(MoveViewportInputMode value)
MoveViewportInputMode
associated with this instance.
If the field has not yet been initialized upon first access, the factory method createMoveViewportInputMode()
will be called. Upon change the onMoveViewportInputModeChanged(MoveViewportInputMode, MoveViewportInputMode)
method will be called.
By default this input mode has a priority of 39
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The MoveViewportInputMode to set.getMoveViewportInputMode()
public final void setMultiSelectionRecognizer(IEventRecognizer value)
IEventRecognizer
that will be queried to decide if a click is deemed a multi selection gesture.
The default is IEventRecognizer.SHORTCUT_PRESSED
.
value
- The MultiSelectionRecognizer to set.getMultiSelectionRecognizer()
public final void setNavigationInputMode(NavigationInputMode value)
NavigationInputMode
property.
This mode is responsible for navigating and traversing the elements in the IGraph
. If the field has not yet been
initialized upon first access, the factory method createNavigationInputMode()
will be called. Upon change the onNavigationInputModeChanged(NavigationInputMode, NavigationInputMode)
method will be called.
By default this input mode has a priority of 55
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The NavigationInputMode to set.getNavigationInputMode()
public final void setSelectableItems(GraphItemTypes value)
The default is GraphItemTypes.ALL
.
value
- The SelectableItems to set.setSelected(IModelItem, boolean)
,
getSelectableItems()
public final void setSelectablePredicate(Predicate<IModelItem> value)
IModelItem
is selectable.
This allows to further restrict which items are selectable, compared to SelectableItems
.
If this property is set to null
the effect is the same as a predicate that always returns true
.
value
- The SelectablePredicate to set.getSelectablePredicate()
public void setSelected(IModelItem item, boolean selected)
GraphSelection
to select the given item.item
- The item to set the selection state on.selected
- The new selection state.public final void setTapInputMode(TapInputMode value)
TapInputMode
property.
If the field has not yet been initialized upon first access, the factory method createTapInputMode()
will be
called. Upon change the onTapInputModeChanged(TapInputMode, TapInputMode)
method will be called.
By default this input mode has a priority of 20
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The TapInputMode to set.getTapInputMode()
public final void setToolTipItems(GraphItemTypes value)
The items for which a tool tip text should be queried
. The default
value is
GraphItemTypes.NODE
|GraphItemTypes.EDGE
|GraphItemTypes.LABEL
|GraphItemTypes.PORT
|.
value
- The ToolTipItems to set.getToolTipItems()
public final void setWaitInputMode(WaitInputMode value)
WaitInputMode
that is provided by this instance for those who need to make use of it.
If the field has not yet been initialized upon first access, the factory method createWaitInputMode()
will be
called. Upon change the onWaitInputModeChanged(WaitInputMode, WaitInputMode)
method will be called.
By default this input mode has a priority of -1
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The WaitInputMode to set.WaitInputMode.isWaiting()
,
getWaitInputMode()
protected boolean shouldClick(IModelItem item)
item
can be
clicked
.
This implementation uses the ClickableItems
value to determine whether the item should be
clicked. Note that this method will not be called for items that don't match ClickableItems
for performance reasons.
item
- The item to check.clicked
in response to a detected mouse click.protected boolean shouldClickSelect(IModelItem item)
item
should be selected when
clicked with the primary mouse button
.
This implementation uses the ClickSelectableItems
value to determine whether the item
should be selected. Note that this method will not be called for items that don't match ClickSelectableItems
and SelectableItems
for performance reasons.
item
- The item to check.protected boolean shouldDoubleClick(IModelItem item)
item
can be
double clicked
.
This implementation uses the shouldClick(IModelItem)
method to determine whether the item should be double
clicked. Note that this method will not be called for items that don't match ClickableItems
for performance reasons.
item
- The item to check.double clicked
in response to a detected
mouse click.protected boolean shouldFocus(IModelItem item)
IModelItem
should be
set to the current item
.
This implementation uses the FocusableItems
property to determine whether the item can be
set to the current item. It also honors the IgnoringVoidStylesEnabled
property.
item
- The item to check.protected boolean shouldInstallCommand(ICommand command)
ICommand
s to install.
This implementation unconditionally returns true
, subclasses may override this method to adjust the behavior.
command
- The command to install.protected boolean shouldMarqueeSelect(IModelItem item)
marqueeSelect(RectD)
that takes MarqueeSelectableItems
and shouldSelectItem(IModelItem)
into account.item
- The item to check.protected boolean shouldPopulateContextMenu(IModelItem item)
This implementation uses the ContextMenuItems
property to determine whether a context
menu should be queried for the given item.
item
- The item to check.PopulateItemContextMenu
event for the
given item.protected boolean shouldQueryToolTip(IModelItem item)
This implementation uses the ToolTipItems
property to determine whether tool tip should be
queried for the given item.
item
- The item to check.QueryItemToolTip
event for the given item.protected boolean shouldSelectItem(IModelItem item)
This implementation uses and honors the SelectableItems
, IgnoringVoidStylesEnabled
and SelectablePredicate
properties. This method is by default also called by shouldClickSelect(IModelItem)
and shouldMarqueeSelect(IModelItem)
, so turning selection off here also turns it off in other places.
item
- The item to check.true
if the item is selectable in general, false
if not.protected void tap(IModelItem item, TapEventArgs args)
This will raise the ItemClicked
event. If the event is unhandled by all
its event handlers the item will be selected
and
focused
. Before selection
the current selection will be cleared
.
item
- The item that has been tapped.args
- The original event arguments for the tap. Setting its Handled
property to true
will indicate that the tap was handled. By default this happens when the tapped item is either selected or focused.public void uninstall(IInputModeContext context)
IInputMode
This code should clean up all changes made to the canvas in the IInputMode.install(IInputModeContext, ConcurrencyController)
method. After a mode has been uninstalled it can be installed again into the same or another canvas.
uninstall
in interface IInputMode
uninstall
in class MultiplexingInputMode
context
- The context to deregister from. This is the same instance that had been passed to IInputMode.install(IInputModeContext, ConcurrencyController)
during installation.