public class ReparentNodeHandler extends Object implements IReparentNodeHandler
IReparentNodeHandler that treats shift key presses as reparent gestures and
allows for reparenting all nodes.| Constructor and Description |
|---|
ReparentNodeHandler() |
| Modifier and Type | Method and Description |
|---|---|
IEventRecognizer |
getReparentRecognizer()
Gets the
IEventRecognizer that will be queried to determine whether the gesture is a reparent gesture. |
boolean |
isReparentGesture(IInputModeContext context,
INode node)
Determines whether the current gesture that can be determined through the context is a reparent gesture.
|
boolean |
isValidParent(IInputModeContext context,
INode node,
INode newParent)
Determines whether the provided node may be reparented to a
newParent. |
void |
reparent(IInputModeContext context,
INode node,
INode newParent)
Performs the actual reparenting after the reparent gesture has been finalized.
|
void |
setReparentRecognizer(IEventRecognizer value)
Sets the
IEventRecognizer that will be queried to determine whether the gesture is a reparent gesture. |
boolean |
shouldReparent(IInputModeContext context,
INode node)
Determines whether the user may detach the given node from its current parent in order to reparent it.
|
public final IEventRecognizer getReparentRecognizer()
IEventRecognizer that will be queried to determine whether the gesture is a reparent gesture.
The default is IEventRecognizer.SHIFT_PRESSED
isReparentGesture(IInputModeContext, INode),
setReparentRecognizer(IEventRecognizer)public boolean isReparentGesture(IInputModeContext context, INode node)
IReparentNodeHandlerisReparentGesture in interface IReparentNodeHandlercontext - The context that provides information about the user input.node - The node that will possibly be reparented.public boolean isValidParent(IInputModeContext context, INode node, INode newParent)
IReparentNodeHandlernewParent.isValidParent in interface IReparentNodeHandlercontext - The context that provides information about the user input.node - The node that will be reparented.newParent - The potential new parent or null. Can be a group or a non-group node.newParent is a valid new parent for node.public void reparent(IInputModeContext context, INode node, INode newParent)
IReparentNodeHandler
Implementations should set the parent of node to
newParent.
reparent in interface IReparentNodeHandlercontext - The context that provides information about the user input.node - The node that will be reparented.newParent - The potential new parent or null. Can be a group or a non-group node.public final void setReparentRecognizer(IEventRecognizer value)
IEventRecognizer that will be queried to determine whether the gesture is a reparent gesture.
The default is IEventRecognizer.SHIFT_PRESSED
value - The ReparentRecognizer to set.isReparentGesture(IInputModeContext, INode),
getReparentRecognizer()public boolean shouldReparent(IInputModeContext context, INode node)
IReparentNodeHandlershouldReparent in interface IReparentNodeHandlercontext - The context that provides information about the user input.node - The node that is about to be detached from its current parent.