public class OverviewInputMode extends MultiplexingInputMode
IInputMode
that can be used for an overview CanvasControl
.
This mode will add navigation capabilities to the control it is installed in.
Modifier and Type | Field and Description |
---|---|
static ResourceKey |
VIEWPORT_TEMPLATE_KEY
A
ResourceKey that should yield a IVisualTemplate that will be used by this mode render the viewport. |
Constructor and Description |
---|
OverviewInputMode()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected ClickInputMode |
createClickInputMode()
Factory method for the
ClickInputMode property. |
protected HandleInputMode |
createHandleInputMode()
Factory method for the HandleInputMode property.
|
protected KeyboardInputMode |
createKeyboardInputMode()
Factory method for the KeyboardInputMode property.
|
protected MoveInputMode |
createMoveInputMode()
Factory method for the MoveInputMode property.
|
protected TapInputMode |
createTapInputMode()
Factory method for the
TapInputMode property. |
Collection<ICommand> |
getAvailableCommands()
Gets the list of commands that are available in this instance.
|
ClickInputMode |
getClickInputMode()
Gets the
ClickInputMode . |
CanvasControl |
getClientCanvas()
Gets the canvas this canvas should use to navigate.
|
HandleInputMode |
getHandleInputMode()
Gets the HandleInputMode.
|
KeyboardInputMode |
getKeyboardInputMode()
Gets the KeyboardInputMode.
|
InsetsD |
getMargins()
Gets the insets in view coordinates that should be used by the
updateVisibleArea() operation. |
MoveInputMode |
getMoveInputMode()
Gets the MoveInputMode.
|
TapInputMode |
getTapInputMode()
Gets the
TapInputMode . |
IVisualTemplate |
getTemplate()
Gets the template that is used for the visualization of the marquee rectangle.
|
protected void |
initialize()
Performs one-time initialization of this instance.
|
void |
install(IInputModeContext context,
ConcurrencyController controller)
Installs this mode into the given context that is provided by the canvas.
|
boolean |
isAutoMouseWheelZoomEnabled()
Determines whether the mouse wheel can be used to perform zooming in the
ClientCanvas . |
boolean |
isAutoUpdateEnabled()
Determines whether the the canvas this mode is installed in should automatically be invalidated if the client canvas
gets invalidated.
|
void |
setAutoMouseWheelZoomEnabled(boolean value)
Determines whether the mouse wheel can be used to perform zooming in the
ClientCanvas . |
void |
setAutoUpdateEnabled(boolean value)
Determines whether the the canvas this mode is installed in should automatically be invalidated if the client canvas
gets invalidated.
|
void |
setClientCanvas(CanvasControl value)
Sets the canvas this canvas should use to navigate.
|
void |
setMargins(InsetsD value)
Sets the insets in view coordinates that should be used by the
updateVisibleArea() operation. |
void |
setTemplate(IVisualTemplate value)
Sets the template that is used for the visualization of the marquee rectangle.
|
protected boolean |
shouldInstallCommand(ICommand command)
Callback method that is used by
createKeyboardInputMode() to determine which of the built-in
ICommand s to install. |
void |
uninstall(IInputModeContext context)
Uninstalls this mode from the given context.
|
protected void |
updateVisibleArea()
|
add, adjustCursor, cancel, childInputModeContextLookup, createChildInputModeContext, createInputModeEventArgs, getController, getDefaultCursor, getInputModeContext, getMutexOwner, getPriority, getSortedModes, invalidate, isEnabled, isExclusive, onConcurrencyControllerActivated, onConcurrencyControllerDeactivated, remove, setDefaultCursor, setEnabled, setExclusive, setPriority, stop, subModePriorityChanged
public static final ResourceKey VIEWPORT_TEMPLATE_KEY
ResourceKey
that should yield a IVisualTemplate
that will be used by this mode render the viewport.
When explicitly setting a Template
, this key will not be used. This is only a fallback if Template
is null
.
protected ClickInputMode createClickInputMode()
ClickInputMode
property.
This method will be called upon first access to the ClickInputMode
property.
protected HandleInputMode createHandleInputMode()
This method will be called upon first access to the HandleInputMode
property.
protected KeyboardInputMode createKeyboardInputMode()
This method will be called upon first access to the KeyboardInputMode
property.
protected MoveInputMode createMoveInputMode()
This method will be called upon first access to the MoveInputMode
property.
protected TapInputMode createTapInputMode()
TapInputMode
property.
This method will be called upon first access to the TapInputMode
property.
public final Collection<ICommand> getAvailableCommands()
Removing commands from this collection also removes the command bindings registered by this instance.
Add supported commands to make them available in this instance.
Supported commands are
public final ClickInputMode getClickInputMode()
ClickInputMode
.
If the field has not yet been initialized upon first access, the factory method createClickInputMode()
will be
called.
By default this input mode has a priority of 0
.
public final CanvasControl getClientCanvas()
setClientCanvas(CanvasControl)
public final HandleInputMode getHandleInputMode()
This mode is responsible for handling the single handle that allows to resize the viewport rectangle.
If the field has not yet been initialized upon first access, the factory method createHandleInputMode()
will be
called.
By default this input mode has a priority of 10
.
public final KeyboardInputMode getKeyboardInputMode()
This mode handles all keyboard interaction gestures with the overview control.
If the field has not yet been initialized upon first access, the factory method createKeyboardInputMode()
will
be called.
By default this input mode has a priority of 0
.
public final InsetsD getMargins()
updateVisibleArea()
operation.
This influences the amount of visible whitespace in the view coordinate system around the graph after the content rect
of the ClientCanvas
has changed. The default value is (5,5,5,5)
.
setMargins(InsetsD)
public final MoveInputMode getMoveInputMode()
This mode is responsible for moving the viewport rectangle.
If the field has not yet been initialized upon first access, the factory method createMoveInputMode()
will be
called.
By default this input mode has a priority of 20
.
public final TapInputMode getTapInputMode()
TapInputMode
.
If the field has not yet been initialized upon first access, the factory method createTapInputMode()
will be
called.
By default this input mode has a priority of 30
.
public final IVisualTemplate getTemplate()
setTemplate(IVisualTemplate)
protected void initialize()
MultiplexingInputMode
This method should not be invoked by subclasses. This will be done automatically upon first installation
of this mode.
This code will be executed only once per instance. The Canvas
property and InputModeContext
property will be null
when this code is executed. This method should not be used to install this mode into a
specific canvas. Subclasses should always call base.Initialize()
first.
initialize
in class MultiplexingInputMode
MultiplexingInputMode.install(IInputModeContext, ConcurrencyController)
public void install(IInputModeContext context, ConcurrencyController controller)
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.
Overriding implementations should call the base implementation, first.
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 isAutoMouseWheelZoomEnabled()
ClientCanvas
.
The default value is true
.
setAutoMouseWheelZoomEnabled(boolean)
public final boolean isAutoUpdateEnabled()
Automatic invalidation will be deferred to avoid too frequent updates of the overview.
To manually update the overview when this property is false
, call the CanvasControl.invalidate()
method
on the GraphOverviewControl
.
setAutoUpdateEnabled(boolean)
public final void setAutoMouseWheelZoomEnabled(boolean value)
ClientCanvas
.
The default value is true
.
value
- The AutoMouseWheelZoomEnabled to set.isAutoMouseWheelZoomEnabled()
public final void setAutoUpdateEnabled(boolean value)
Automatic invalidation will be deferred to avoid too frequent updates of the overview.
To manually update the overview when this property is false
, call the CanvasControl.invalidate()
method
on the GraphOverviewControl
.
value
- The AutoUpdateEnabled to set.isAutoUpdateEnabled()
public final void setClientCanvas(CanvasControl value)
value
- The ClientCanvas to set.getClientCanvas()
public final void setMargins(InsetsD value)
updateVisibleArea()
operation.
This influences the amount of visible whitespace in the view coordinate system around the graph after the content rect
of the ClientCanvas
has changed. The default value is (5,5,5,5)
.
value
- The Margins to set.getMargins()
public final void setTemplate(IVisualTemplate value)
value
- The template.getTemplate()
protected boolean shouldInstallCommand(ICommand command)
createKeyboardInputMode()
to determine which of the built-in
ICommand
s to install.
This implementation unconditionally returns true
, subclasses may override this method to adjust the behavior.
command
- The command to install.public void uninstall(IInputModeContext context)
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.
Overriding implementations should call the base implementation after their own code.
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.protected void updateVisibleArea()
zoom
and viewpoint
of the
overview control
.
This method is called when the graph bounds
of the getClientCanvas()
have changed. The margins
should be respected.