public class ResizeStripeInputMode extends Object implements IInputMode
By default, adjacent stripes are moved. To redistribute the space instead, use
ResizeNeighborsRecognizer
. Also, by default the content of the stripes is
either moved or constrains the minimum available sizes for the stripe resize operations. To completely ignore all
content nodes, use IgnoreContentRecognizer
.
This mode is Exclusive
by default.
Constructor and Description |
---|
ResizeStripeInputMode()
Creates a new instance of this input mode.
|
Modifier and Type | Method and Description |
---|---|
void |
addDragCanceledListener(IEventHandler<InputModeEventArgs> dragCanceledEvent)
Adds the given listener for the
DragCanceled event that occurs when the drag has been canceled. |
void |
addDragCancelingListener(IEventHandler<InputModeEventArgs> dragCancelingEvent)
Adds the given listener for the
DragCanceling event that occurs before the drag will be canceled. |
void |
addDragFinishedListener(IEventHandler<InputModeEventArgs> dragFinishedEvent)
Adds the given listener for the
DragFinished event that occurs once the drag has been finished. |
void |
addDragFinishingListener(IEventHandler<InputModeEventArgs> dragFinishingEvent)
Adds the given listener for the
DragFinishing event that occurs before the drag will be finished. |
void |
addDraggedListener(IEventHandler<InputModeEventArgs> draggedEvent)
Adds the given listener for the
Dragged event that occurs at the end of every drag. |
void |
addDraggingListener(IEventHandler<InputModeEventArgs> draggingEvent)
Adds the given listener for the
Dragging event that occurs at the start of every drag. |
void |
addDragStartedListener(IEventHandler<InputModeEventArgs> dragStartedEvent)
Adds the given listener for the
DragStarted event that occurs once the drag is initialized and has started. |
void |
addDragStartingListener(IEventHandler<InputModeEventArgs> dragStartingEvent)
Adds the given listener for the
DragStarting event that occurs once the drag is starting. |
void |
cancel()
Cancels the editing of this mode.
|
IEventRecognizer |
getCancelRecognizer()
Gets the "cancel" recognizer.
|
protected ConcurrencyController |
getController()
Returns the installed
Controller . |
IEventRecognizer |
getDraggedRecognizer()
Gets the "dragged" recognizer.
|
IEventRecognizer |
getDraggedRecognizerTouch()
Gets the "dragged" recognizer for touch input.
|
IEventRecognizer |
getIgnoreContentRecognizer()
Gets the recognizer that changes the behavior to ignore the content of all stripes instead of moving them or considering
for minimum sizes.
|
IInputModeContext |
getInputModeContext()
Returns the context instance this mode is currently installed in or
null if this instance is not installed. |
IEventRecognizer |
getPressedRecognizer()
Gets the "pressed" state recognizer.
|
IEventRecognizer |
getPressedRecognizerTouch()
Gets the "pressed" state recognizer for touch input.
|
int |
getPriority()
The priority of this input mode.
|
IEventRecognizer |
getReleasedRecognizer()
Gets the "released" recognizer.
|
IEventRecognizer |
getReleasedRecognizerTouch()
Gets the "released" recognizer for touch input.
|
IEventRecognizer |
getResizeNeighborsRecognizer()
Gets the recognizer that changes the behavior to resize adjacent stripes instead of moving them.
|
void |
install(IInputModeContext context,
ConcurrencyController controller)
Installs this mode into the given context that is provided by the canvas.
|
boolean |
isEnabled()
Gets the enabled state of this input mode.
|
boolean |
isExclusive()
Gets a value indicating whether this mode will be the only one running when it has the mutex.
|
protected boolean |
isValidBegin(Object source,
IEventArgs args)
Called to determine whether it is valid to begin the gesture.
|
protected void |
onCanceled()
Called after
cancel() has been called. |
protected void |
onConcurrencyControllerActivated()
|
protected void |
onConcurrencyControllerDeactivated()
|
protected void |
onDragCanceled(InputModeEventArgs inputModeEventArgs)
Triggers the
DragCanceled event. |
protected void |
onDragCanceling(InputModeEventArgs inputModeEventArgs)
Triggers the
DragCanceling event. |
protected void |
onDragFinished(InputModeEventArgs inputModeEventArgs)
Callback triggered once the drag has been finalized.
|
protected void |
onDragFinishing(InputModeEventArgs inputModeEventArgs)
Callback triggered before the drag will be finalized.
|
protected void |
onDragged(InputModeEventArgs inputModeEventArgs)
Callback triggered at the end of each drag.
|
protected void |
onDragging(InputModeEventArgs inputModeEventArgs)
Callback triggered at the start of each drag.
|
protected void |
onDragStarted(InputModeEventArgs inputModeEventArgs)
Triggers the
DragStarted event. |
protected void |
onDragStarting(InputModeEventArgs inputModeEventArgs)
Triggers the
DragStarting event. |
protected void |
onStopped()
Called after
stop() has been called. |
void |
removeDragCanceledListener(IEventHandler<InputModeEventArgs> dragCanceledEvent)
Removes the given listener for the
DragCanceled event that occurs when the drag has been canceled. |
void |
removeDragCancelingListener(IEventHandler<InputModeEventArgs> dragCancelingEvent)
Removes the given listener for the
DragCanceling event that occurs before the drag will be canceled. |
void |
removeDragFinishedListener(IEventHandler<InputModeEventArgs> dragFinishedEvent)
Removes the given listener for the
DragFinished event that occurs once the drag has been finished. |
void |
removeDragFinishingListener(IEventHandler<InputModeEventArgs> dragFinishingEvent)
Removes the given listener for the
DragFinishing event that occurs before the drag will be finished. |
void |
removeDraggedListener(IEventHandler<InputModeEventArgs> draggedEvent)
Removes the given listener for the
Dragged event that occurs at the end of every drag. |
void |
removeDraggingListener(IEventHandler<InputModeEventArgs> draggingEvent)
Removes the given listener for the
Dragging event that occurs at the start of every drag. |
void |
removeDragStartedListener(IEventHandler<InputModeEventArgs> dragStartedEvent)
Removes the given listener for the
DragStarted event that occurs once the drag is initialized and has started. |
void |
removeDragStartingListener(IEventHandler<InputModeEventArgs> dragStartingEvent)
Removes the given listener for the
DragStarting event that occurs once the drag is starting. |
void |
setCancelRecognizer(IEventRecognizer value)
Sets the "cancel" recognizer.
|
void |
setDraggedRecognizer(IEventRecognizer value)
Sets the "dragged" recognizer.
|
void |
setDraggedRecognizerTouch(IEventRecognizer value)
Sets the "dragged" recognizer for touch input.
|
void |
setEnabled(boolean value)
Sets the enabled state of this input mode.
|
void |
setExclusive(boolean value)
Sets a value indicating whether this mode will be the only one running when it has the mutex.
|
void |
setIgnoreContentRecognizer(IEventRecognizer value)
Sets the recognizer that changes the behavior to ignore the content of all stripes instead of moving them or considering
for minimum sizes.
|
void |
setPressedRecognizer(IEventRecognizer value)
Sets the "pressed" state recognizer.
|
void |
setPressedRecognizerTouch(IEventRecognizer value)
Sets the "pressed" state recognizer for touch input.
|
void |
setPriority(int value)
The priority of this input mode.
|
void |
setReleasedRecognizer(IEventRecognizer value)
Sets the "released" recognizer.
|
void |
setReleasedRecognizerTouch(IEventRecognizer value)
Sets the "released" recognizer for touch input.
|
void |
setResizeNeighborsRecognizer(IEventRecognizer value)
Sets the recognizer that changes the behavior to resize adjacent stripes instead of moving them.
|
boolean |
stop()
Called by the client in order to stop a current editing progress.
|
void |
uninstall(IInputModeContext context)
Uninstalls this mode from the given context.
|
public ResizeStripeInputMode()
public final void addDragCanceledListener(IEventHandler<InputModeEventArgs> dragCanceledEvent)
DragCanceled
event that occurs when the drag has been canceled.dragCanceledEvent
- The listener to add.removeDragCanceledListener(IEventHandler)
public final void addDragCancelingListener(IEventHandler<InputModeEventArgs> dragCancelingEvent)
DragCanceling
event that occurs before the drag will be canceled.dragCancelingEvent
- The listener to add.removeDragCancelingListener(IEventHandler)
public final void addDragFinishedListener(IEventHandler<InputModeEventArgs> dragFinishedEvent)
DragFinished
event that occurs once the drag has been finished.dragFinishedEvent
- The listener to add.removeDragFinishedListener(IEventHandler)
public final void addDragFinishingListener(IEventHandler<InputModeEventArgs> dragFinishingEvent)
DragFinishing
event that occurs before the drag will be finished.dragFinishingEvent
- The listener to add.removeDragFinishingListener(IEventHandler)
public final void addDraggedListener(IEventHandler<InputModeEventArgs> draggedEvent)
Dragged
event that occurs at the end of every drag.draggedEvent
- The listener to add.removeDraggedListener(IEventHandler)
public final void addDraggingListener(IEventHandler<InputModeEventArgs> draggingEvent)
Dragging
event that occurs at the start of every drag.draggingEvent
- The listener to add.removeDraggingListener(IEventHandler)
public final void addDragStartedListener(IEventHandler<InputModeEventArgs> dragStartedEvent)
DragStarted
event that occurs once the drag is initialized and has started.dragStartedEvent
- The listener to add.removeDragStartedListener(IEventHandler)
public final void addDragStartingListener(IEventHandler<InputModeEventArgs> dragStartingEvent)
DragStarting
event that occurs once the drag is starting.dragStartingEvent
- The listener to add.removeDragStartingListener(IEventHandler)
public void cancel()
This implementation releases
the mutex if it is currently owned by this
instance and calls onCanceled()
.
cancel
in interface IInputMode
onCanceled()
public final IEventRecognizer getCancelRecognizer()
This recognizer recognizes a cancel action during the resize operation.
setCancelRecognizer(IEventRecognizer)
protected final ConcurrencyController getController()
Controller
.public final IEventRecognizer getDraggedRecognizer()
This recognizer instance determines when the user is dragging the mouse to resize the stripe.
setDraggedRecognizer(IEventRecognizer)
public final IEventRecognizer getDraggedRecognizerTouch()
This recognizer instance determines when the user is moving a handle.
setDraggedRecognizerTouch(IEventRecognizer)
public final IEventRecognizer getIgnoreContentRecognizer()
If this recognizer recognizes its gesture, the behavior will be to completely ignore all stripe contents.
setIgnoreContentRecognizer(IEventRecognizer)
public final IInputModeContext getInputModeContext()
IInputMode
null
if this instance is not installed.
Note that this instance should not be passed down to subordinate modes or instances. Instead a corresponding context
that has this instance set as the ParentInputMode
should be used.
getInputModeContext
in interface IInputMode
public final IEventRecognizer getPressedRecognizer()
This recognizer instance will be used to determine when the user begins to resize the stripe.
setPressedRecognizer(IEventRecognizer)
public final IEventRecognizer getPressedRecognizerTouch()
This recognizer instance will be used to determine when the user begins to move a handle.
setPressedRecognizerTouch(IEventRecognizer)
public final int getPriority()
IInputMode
The priority will influence the order in which the modes will be installed
into the canvas control. The lower the priority value, the earlier it will be installed. If two modes are installed
using the same priority value, the first one will be installed earlier.
getPriority
in interface IInputMode
public final IEventRecognizer getReleasedRecognizer()
This instance determines when the user has finished the resize operation.
setReleasedRecognizer(IEventRecognizer)
public final IEventRecognizer getReleasedRecognizerTouch()
This instance determines when the user has finished moving the handle.
setReleasedRecognizerTouch(IEventRecognizer)
public final IEventRecognizer getResizeNeighborsRecognizer()
If this recognizer recognizes its gesture, the behavior will be to resize adjacent stripes instead of moving them (which is the default).
setResizeNeighborsRecognizer(IEventRecognizer)
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
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 Controller
for this mode.IInputMode.uninstall(IInputModeContext)
public boolean isEnabled()
Clients can use this property to disable or reenable this instance. This will set the Enabled
property of the installed Controller
so a disabled instance should never try to acquire the
input mutex.
setEnabled(boolean)
public final boolean isExclusive()
The value of this property will be delegated to the Exclusive
property of
the Controller
.
If this mode is marked as exclusive and has the mutex, all other modes added
to the same MultiplexingInputMode
will be deactivated. Otherwise it will always run
concurrently with all other modes.
setExclusive(boolean)
protected boolean isValidBegin(Object source, IEventArgs args)
This implementation checks whether a stripe border has been hit at the latest
Mouse2DEvent
Mouse2DEvent
protected void onCanceled()
cancel()
has been called.
Can be overridden in subclasses to perform additional actions after the mode has been canceled.
This implementation does nothing.
protected void onConcurrencyControllerActivated()
Active
property of the installed ConcurrencyController
has been set to true
.
Can be overridden in subclasses to perform additional actions after the mode has been activated.
Overriding implementations should call the base implementation.
protected void onConcurrencyControllerDeactivated()
Active
property of the installed ConcurrencyController
has been set to false
.
Can be overridden in subclasses to perform additional actions after the mode has been deactivated.
Overriding implementations should call the base implementation.
protected void onDragCanceled(InputModeEventArgs inputModeEventArgs)
DragCanceled
event.inputModeEventArgs
- The event argument that contains context information.protected void onDragCanceling(InputModeEventArgs inputModeEventArgs)
DragCanceling
event.inputModeEventArgs
- The event argument that contains context information.protected void onDragFinished(InputModeEventArgs inputModeEventArgs)
This method triggers the DragFinished
event.
inputModeEventArgs
- The event argument that contains context information.protected void onDragFinishing(InputModeEventArgs inputModeEventArgs)
This method triggers the DragFinishing
event.
inputModeEventArgs
- The event argument that contains context information.protected void onDragged(InputModeEventArgs inputModeEventArgs)
This method triggers the Dragged
event.
inputModeEventArgs
- The event argument that contains context information.protected void onDragging(InputModeEventArgs inputModeEventArgs)
This method triggers the Dragging
event.
inputModeEventArgs
- The event argument that contains context information.protected void onDragStarted(InputModeEventArgs inputModeEventArgs)
DragStarted
event.inputModeEventArgs
- The event argument that contains context information.protected void onDragStarting(InputModeEventArgs inputModeEventArgs)
DragStarting
event.inputModeEventArgs
- The event argument that contains context information.protected void onStopped()
stop()
has been called.
Can be overridden in subclasses to perform additional actions after the mode has been stopped.
This implementation does nothing.
public final void removeDragCanceledListener(IEventHandler<InputModeEventArgs> dragCanceledEvent)
DragCanceled
event that occurs when the drag has been canceled.dragCanceledEvent
- The listener to remove.addDragCanceledListener(IEventHandler)
public final void removeDragCancelingListener(IEventHandler<InputModeEventArgs> dragCancelingEvent)
DragCanceling
event that occurs before the drag will be canceled.dragCancelingEvent
- The listener to remove.addDragCancelingListener(IEventHandler)
public final void removeDragFinishedListener(IEventHandler<InputModeEventArgs> dragFinishedEvent)
DragFinished
event that occurs once the drag has been finished.dragFinishedEvent
- The listener to remove.addDragFinishedListener(IEventHandler)
public final void removeDragFinishingListener(IEventHandler<InputModeEventArgs> dragFinishingEvent)
DragFinishing
event that occurs before the drag will be finished.dragFinishingEvent
- The listener to remove.addDragFinishingListener(IEventHandler)
public final void removeDraggedListener(IEventHandler<InputModeEventArgs> draggedEvent)
Dragged
event that occurs at the end of every drag.draggedEvent
- The listener to remove.addDraggedListener(IEventHandler)
public final void removeDraggingListener(IEventHandler<InputModeEventArgs> draggingEvent)
Dragging
event that occurs at the start of every drag.draggingEvent
- The listener to remove.addDraggingListener(IEventHandler)
public final void removeDragStartedListener(IEventHandler<InputModeEventArgs> dragStartedEvent)
DragStarted
event that occurs once the drag is initialized and has started.dragStartedEvent
- The listener to remove.addDragStartedListener(IEventHandler)
public final void removeDragStartingListener(IEventHandler<InputModeEventArgs> dragStartingEvent)
DragStarting
event that occurs once the drag is starting.dragStartingEvent
- The listener to remove.addDragStartingListener(IEventHandler)
public final void setCancelRecognizer(IEventRecognizer value)
This recognizer recognizes a cancel action during the resize operation.
value
- The "cancel" recognizer.getCancelRecognizer()
public final void setDraggedRecognizer(IEventRecognizer value)
This recognizer instance determines when the user is dragging the mouse to resize the stripe.
value
- The "dragged" recognizer.getDraggedRecognizer()
public final void setDraggedRecognizerTouch(IEventRecognizer value)
This recognizer instance determines when the user is moving a handle.
value
- The "dragged" recognizer for touch events.getDraggedRecognizerTouch()
public void setEnabled(boolean value)
Clients can use this property to disable or reenable this instance. This will set the Enabled
property of the installed Controller
so a disabled instance should never try to acquire the
input mutex.
value
- The Enabled to set.isEnabled()
public final void setExclusive(boolean value)
The value of this property will be delegated to the Exclusive
property of
the Controller
.
If this mode is marked as exclusive and has the mutex, all other modes added
to the same MultiplexingInputMode
will be deactivated. Otherwise it will always run
concurrently with all other modes.
value
- The Exclusive to set.isExclusive()
public final void setIgnoreContentRecognizer(IEventRecognizer value)
If this recognizer recognizes its gesture, the behavior will be to completely ignore all stripe contents.
value
- The IgnoreContentRecognizer to set.getIgnoreContentRecognizer()
public final void setPressedRecognizer(IEventRecognizer value)
This recognizer instance will be used to determine when the user begins to resize the stripe.
value
- The "pressed" recognizer.getPressedRecognizer()
public final void setPressedRecognizerTouch(IEventRecognizer value)
This recognizer instance will be used to determine when the user begins to move a handle.
value
- The "pressed" recognizer for touch events.getPressedRecognizerTouch()
public final void setPriority(int value)
The priority will influence the order in which the modes will be installed
into the canvas control. The lower the priority value, the earlier it will be installed. If two modes are installed
using the same priority value, the first one will be installed earlier.
value
- The Priority to set.getPriority()
public final void setReleasedRecognizer(IEventRecognizer value)
This instance determines when the user has finished the resize operation.
value
- The "released" recognizer.getReleasedRecognizer()
public final void setReleasedRecognizerTouch(IEventRecognizer value)
This instance determines when the user has finished moving the handle.
value
- The "released" recognizer for touch events.getReleasedRecognizerTouch()
public final void setResizeNeighborsRecognizer(IEventRecognizer value)
If this recognizer recognizes its gesture, the behavior will be to resize adjacent stripes instead of moving them (which is the default).
value
- The ResizeNeighborsRecognizer to set.getResizeNeighborsRecognizer()
public boolean stop()
IInputMode
This should stop the current edit, if one is in progress and possibly commit all of the changes. If stopping is not
possible, this method can return false
stop
in interface IInputMode
true
if and only if the editing has been stopped or there was no edit in progressIInputMode.cancel()
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
context
- The context to deregister from. This is the same instance that had been passed to IInputMode.install(IInputModeContext, ConcurrencyController)
during installation.