public class TableReshapeHandler extends Object implements IReshapeHandler
IReshapeHandler
implementation that constrains node resizes so that minimum size constraints of an associated ITable
are satisfied and which resizes the outer IStripe
s of such a table when the node is resized.
The constraints are applied in addition to any constraints imposed by the IReshapeHandler
which is wrapped by
this implementation.
Constructor and Description |
---|
TableReshapeHandler(IReshapeHandler coreHandler,
INode tableNode,
ITable table)
Creates a new instance of this Handler which wraps an existing instance of
coreHandler and uses table
for additional constraints. |
Modifier and Type | Method and Description |
---|---|
void |
cancelReshape(IInputModeContext context,
RectD originalBounds)
Called by clients to indicate that the reshaping has been canceled by the user.
|
IRectangle |
getBounds()
Returns a view of the bounds of the item.
|
IReshapeHandler |
getCoreHandler()
The core reshape handler wrapped by this instance.
|
ITable |
getTable()
The table used for additional constraints.
|
INode |
getTableNode()
The node this handler is used for.
|
void |
handleReshape(IInputModeContext context,
RectD originalBounds,
RectD newBounds)
Called by clients to indicate that the element has been dragged and its position should be updated.
|
void |
initializeReshape(IInputModeContext context)
Called by clients to indicate that the element is going to be reshaped.
|
void |
reshapeFinished(IInputModeContext context,
RectD originalBounds,
RectD newBounds)
Called by clients to indicate that the reshaping has just been finished.
|
public TableReshapeHandler(IReshapeHandler coreHandler, INode tableNode, ITable table)
coreHandler
and uses table
for additional constraints.
In addition, table
's outer stripes are resized if necessary.
table
should be associated to tableNode
coreHandler
- The handler that is wrapped by this instance.tableNode
- The node for which this handler is usedtable
- The table that is used for additional constraints.public final void cancelReshape(IInputModeContext context, RectD originalBounds)
IReshapeHandler
This method may be called after the initial IReshapeHandler.initializeReshape(IInputModeContext)
and zero or more invocations
of IReshapeHandler.handleReshape(IInputModeContext, RectD, RectD)
. Implementations should reset the bounds of the items they
modify to their initial state. Alternatively to this method the IReshapeHandler.reshapeFinished(IInputModeContext, RectD, RectD)
method might be called.
cancelReshape
in interface IReshapeHandler
context
- The context to retrieve information about the reshaping from.originalBounds
- The value of the coordinate of the Bounds
property at the time of
IReshapeHandler.initializeReshape(IInputModeContext)
.public final IRectangle getBounds()
IReshapeHandler
The rectangle describes the current world coordinate of the element that can be modified by this handler.
getBounds
in interface IReshapeHandler
public final IReshapeHandler getCoreHandler()
public final ITable getTable()
public final INode getTableNode()
public final void handleReshape(IInputModeContext context, RectD originalBounds, RectD newBounds)
IReshapeHandler
This method may be called more than once after an initial IReshapeHandler.initializeReshape(IInputModeContext)
and will the
final call will be followed by either one IReshapeHandler.reshapeFinished(IInputModeContext, RectD, RectD)
or one IReshapeHandler.cancelReshape(IInputModeContext, RectD)
call.
handleReshape
in interface IReshapeHandler
context
- The context to retrieve information about the reshaping from.originalBounds
- The value of the Bounds
property at the time of IReshapeHandler.initializeReshape(IInputModeContext)
.newBounds
- The coordinates of the bounds in the world coordinate system that the client wants the shape to be at. Depending on the
implementation the Bounds
may or may not be modified to reflect the new value.public final void initializeReshape(IInputModeContext context)
IReshapeHandler
This call will be followed by one or more calls to IReshapeHandler.handleReshape(IInputModeContext, RectD, RectD)
, and a final
IReshapeHandler.reshapeFinished(IInputModeContext, RectD, RectD)
or IReshapeHandler.cancelReshape(IInputModeContext, RectD)
.
initializeReshape
in interface IReshapeHandler
context
- The context to retrieve information about the drag from.public final void reshapeFinished(IInputModeContext context, RectD originalBounds, RectD newBounds)
IReshapeHandler
This method may be called after the initial IReshapeHandler.initializeReshape(IInputModeContext)
and zero or more invocations
of IReshapeHandler.handleReshape(IInputModeContext, RectD, RectD)
. Alternatively to this method the IReshapeHandler.cancelReshape(IInputModeContext, RectD)
method might be called.
reshapeFinished
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
IReshapeHandler.initializeReshape(IInputModeContext)
.newBounds
- The coordinates of the bounds in the world coordinate system that the client wants the shape 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 IReshapeHandler.handleReshape(IInputModeContext, RectD, RectD)