public abstract class ConstrainedReshapeHandler extends Object implements IReshapeHandler
IReshapeHandler
interface that can be used to constrain the reshaping of an
existing instance conveniently.Modifier | Constructor and Description |
---|---|
protected |
ConstrainedReshapeHandler(IReshapeHandler wrappedHandler)
Initializes a new instance of the
ConstrainedReshapeHandler class that delegates to the wrappedHandler . |
Modifier and Type | Method and Description |
---|---|
void |
cancelReshape(IInputModeContext context,
RectD originalBounds)
Cancels the move operation and calls
onCanceled(IInputModeContext, RectD) . |
protected abstract RectD |
constrainNewBounds(IInputModeContext context,
RectD originalBounds,
RectD newBounds)
Callback that needs to implement the constraints for the new bounds.
|
IRectangle |
getBounds()
Delegates to the
WrappedHandler 's Bounds property. |
protected IReshapeHandler |
getWrappedHandler()
Gets the wrapped handler to which calls will be ultimately delegated.
|
void |
handleReshape(IInputModeContext context,
RectD originalBounds,
RectD newBounds)
Handles the reshape operation and subsequently calls
onReshaped(IInputModeContext, RectD, RectD) . |
void |
initializeReshape(IInputModeContext context)
Initializes the reshape operation and subsequently calls
onInitialized(IInputModeContext, RectD) . |
protected void |
onCanceled(IInputModeContext context,
RectD originalBounds)
Called when the
cancelReshape(IInputModeContext, RectD) method has been called. |
protected void |
onFinished(IInputModeContext context,
RectD originalBounds,
RectD newBounds)
Called when the
reshapeFinished(IInputModeContext, RectD, RectD) method has been called. |
protected void |
onInitialized(IInputModeContext context,
RectD originalBounds)
Called when the
initializeReshape(IInputModeContext) method has been called. |
protected void |
onReshaped(IInputModeContext context,
RectD originalBounds,
RectD newBounds)
Called when the
handleReshape(IInputModeContext, RectD, RectD) operation has been performed. |
void |
reshapeFinished(IInputModeContext context,
RectD originalBounds,
RectD newBounds)
Handles the finish operation and invokes
onFinished(IInputModeContext, RectD, RectD) . |
protected ConstrainedReshapeHandler(IReshapeHandler wrappedHandler)
ConstrainedReshapeHandler
class that delegates to the wrappedHandler
.wrappedHandler
- The handler to wrap.public final void cancelReshape(IInputModeContext context, RectD originalBounds)
onCanceled(IInputModeContext, RectD)
.cancelReshape
in interface IReshapeHandler
context
- The context to retrieve information about the drag from.originalBounds
- The value of the coordinate of the Bounds
property at the time of
initializeReshape(IInputModeContext)
.protected abstract RectD constrainNewBounds(IInputModeContext context, RectD originalBounds, RectD newBounds)
context
- The context in which the reshape will be performed.originalBounds
- The value of the Bounds
property at the time of initializeReshape(IInputModeContext)
.newBounds
- The coordinates in the world coordinate system that the client wants the handle to be at. Depending on the
implementation the Bounds
may or may not be modified to reflect the new value.newBounds
.public final IRectangle getBounds()
WrappedHandler
's Bounds
property.getBounds
in interface IReshapeHandler
protected final IReshapeHandler getWrappedHandler()
public final void handleReshape(IInputModeContext context, RectD originalBounds, RectD newBounds)
onReshaped(IInputModeContext, RectD, RectD)
.
This method will use the constrainNewBounds(IInputModeContext, RectD, RectD)
callback to let subclasses
constrain the reshaping.
handleReshape
in interface IReshapeHandler
context
- The context in which the reshape will be performed.originalBounds
- The value of the Bounds
property at the time of initializeReshape(IInputModeContext)
.newBounds
- The coordinates in the world coordinate system that the client wants to reshape the item to. Depending on the
implementation the Bounds
may or may not be modified to reflect the new value.public final void initializeReshape(IInputModeContext context)
onInitialized(IInputModeContext, RectD)
.initializeReshape
in interface IReshapeHandler
context
- The context in which the drag will be performed.protected void onCanceled(IInputModeContext context, RectD originalBounds)
cancelReshape(IInputModeContext, RectD)
method has been called.context
- The input mode context.originalBounds
- The original bounds.protected void onFinished(IInputModeContext context, RectD originalBounds, RectD newBounds)
reshapeFinished(IInputModeContext, RectD, RectD)
method has been called.context
- The input mode context.originalBounds
- The original bounds.newBounds
- The new bounds.protected void onInitialized(IInputModeContext context, RectD originalBounds)
initializeReshape(IInputModeContext)
method has been called.context
- The input mode context.originalBounds
- The original bounds.protected void onReshaped(IInputModeContext context, RectD originalBounds, RectD newBounds)
handleReshape(IInputModeContext, RectD, RectD)
operation has been performed.context
- The input mode context.originalBounds
- The original Bounds.newBounds
- The new Bounds.public final void reshapeFinished(IInputModeContext context, RectD originalBounds, RectD newBounds)
onFinished(IInputModeContext, RectD, RectD)
.reshapeFinished
in interface IReshapeHandler
context
- The context to retrieve information about the drag from.originalBounds
- The value of the Bounds
property at the time of initializeReshape(IInputModeContext)
.newBounds
- The coordinates in the world coordinate system that the client wants the handle to be at. Depending on the
implementation the Bounds
may or may not be modified to reflect the new value. This is the same
value as delivered in the last invocation of handleReshape(IInputModeContext, RectD, RectD)