public class ContextMenuInputMode extends AbstractContextMenuInputMode<ContextMenu>
AbstractContextMenuInputMode
interface that will
display a ContextMenu
when the user right clicks on the com.yworks.yfiles.canvas.CanvasControl
or presses the menu key.Constructor and Description |
---|
ContextMenuInputMode()
Creates a new instance with no initial popup menu.
|
ContextMenuInputMode(ContextMenu menu)
Creates a new instance using the provided menu.
|
Modifier and Type | Method and Description |
---|---|
protected void |
clearMenu(ContextMenu contextMenu)
Clears all items of the given popup menu.
|
protected ContextMenu |
createMenu()
Creates a new instance of the popup menu.
|
protected void |
hideMenu(ContextMenu contextMenu)
Hides the given popup menu.
|
protected boolean |
isMenuEmpty(ContextMenu contextMenu)
Indicates whether the given popup menu does not have any items.
|
protected void |
setMenuClosedCallback(ContextMenu contextMenu,
Runnable menuClosedCallback)
Defines or removes a function to be called when the given popup menu has been closed.
|
protected void |
showMenu(ContextMenu contextMenu,
PointD viewLocation)
Shows the given popup menu at the given location in view coordinates.
|
addPopulateMenuListener, cancel, createPopulateMenuContext, getController, getInputModeContext, getMenu, getPriority, getValidMenuLocationHitTestable, install, isEnabled, isExclusive, isMenuClearingEnabled, onCanceled, onConcurrencyControllerActivated, onConcurrencyControllerDeactivated, onPopulateMenu, onPopulateMenu, onStopped, removePopulateMenuListener, setEnabled, setExclusive, setMenu, setMenuClearingEnabled, setPriority, setValidMenuLocationHitTestable, stop, uninstall
public ContextMenuInputMode()
public ContextMenuInputMode(ContextMenu menu)
menu
- The menu to show.protected void clearMenu(ContextMenu contextMenu)
AbstractContextMenuInputMode
Subclasses have to implement this method for the given framework specific popup menu instance that has been
created by AbstractContextMenuInputMode.createMenu()
. Whenever yFiles framework needs to clear a popup menu and
AbstractContextMenuInputMode.isMenuClearingEnabled()
returns true
this method for GUI framework specific removal of menu
items is called.
clearMenu
in class AbstractContextMenuInputMode<ContextMenu>
contextMenu
- the framework specific popup menu to remove the items fromprotected ContextMenu createMenu()
AbstractContextMenuInputMode
Subclasses have to create the framework specific popup menu instance here. The other abstract methods of this class need to be able to handle popup menu instances created by this method.
createMenu
in class AbstractContextMenuInputMode<ContextMenu>
AbstractContextMenuInputMode.showMenu(Object, com.yworks.yfiles.geometry.PointD)
,
AbstractContextMenuInputMode.hideMenu(Object)
,
AbstractContextMenuInputMode.clearMenu(Object)
,
AbstractContextMenuInputMode.isMenuEmpty(Object)
protected void hideMenu(ContextMenu contextMenu)
AbstractContextMenuInputMode
Subclasses have to implement this method for the given framework specific popup menu instance that has been
created by AbstractContextMenuInputMode.createMenu()
. Whenever yFiles framework needs to hide a popup menu this method for GUI
framework specific hiding of popup menus is called.
hideMenu
in class AbstractContextMenuInputMode<ContextMenu>
contextMenu
- the framework specific popup menu to hideprotected boolean isMenuEmpty(ContextMenu contextMenu)
AbstractContextMenuInputMode
Subclasses have to implement this method for the given framework specific popup menu instance that has been
created by AbstractContextMenuInputMode.createMenu()
. Whenever yFiles input framework needs to know if a popup menu does not have
any items this method for GUI framework specific query is called.
isMenuEmpty
in class AbstractContextMenuInputMode<ContextMenu>
contextMenu
- the framework specific popup menu to to check for itemstrue
if the given popup menu does not have any items; false
otherwiseprotected void setMenuClosedCallback(ContextMenu contextMenu, Runnable menuClosedCallback)
AbstractContextMenuInputMode
Subclasses have to implement this method for the given framework specific popup menu instance that has been
created by AbstractContextMenuInputMode.createMenu()
. The yFiles framework calls this method to define a function that should be
called when the given popup menu has been closed. If the menuClosedCallback
is null
,
then a former defined function should no longer be called.
setMenuClosedCallback
in class AbstractContextMenuInputMode<ContextMenu>
contextMenu
- the framework specific popup menu to set the callback formenuClosedCallback
- the function to be called when the popup menu has been closed or null
if a
former defined function should no longer be called.protected void showMenu(ContextMenu contextMenu, PointD viewLocation)
AbstractContextMenuInputMode
Subclasses have to implement this method for the given framework specific popup menu instance that has been
created by AbstractContextMenuInputMode.createMenu()
. Whenever yFiles framework requires a popup menu this method for GUI framework
specific display of popup menus is called.
showMenu
in class AbstractContextMenuInputMode<ContextMenu>
contextMenu
- the framework specific popup menu to showviewLocation
- the location in view coordinates where to show the popup menu