public class StripeDropInputMode extends ItemDropInputMode<IStripe>
ItemDropInputMode
specialized to drag 'n' drop IStripe
s.
A dragged IStripe
is optionally visualized during the drag operation.
DATA_FORMAT_DROP_ID
Constructor and Description |
---|
StripeDropInputMode()
Constructs a new instance of class
StripeDropInputMode . |
Modifier and Type | Method and Description |
---|---|
void |
addStripeCreatedListener(IEventHandler<ItemEventArgs<IStripe>> stripeCreatedEvent)
Adds the given listener for the
StripeCreated event that occurs when a new stripe gets created by this input
mode. |
void |
cancel()
Cleanly cancels this mode.
|
protected ITable |
createPreviewTable()
Create a preview version of the table that is temporarily used to show the dragged stripe.
|
protected IStripe |
createStripe(IInputModeContext context,
IStripe newParent)
Create a new stripe as the result of a drag and drop gesture.
|
protected RectD |
getPreviewTableLayout(PointD location,
SizeD size)
Calculates the layout of the new table.
|
protected void |
onDragDropped(InputModeEventArgs eventArgs)
Called once a drag has been dropped on the canvas.
|
protected void |
onDragEntered(InputModeEventArgs eventArgs)
Called once a drag has entered the canvas.
|
protected void |
onDragExited(InputModeEventArgs eventArgs)
Called once a drag has left the canvas.
|
protected void |
onDraggedOver(InputModeEventArgs e)
Called whenever a drag is over the canvas.
|
protected void |
onStripeCreated(ItemEventArgs<IStripe> args)
Called whenever a new stripe is created.
|
protected void |
populatePreviewGraph(IGraph previewGraph)
Subclasses shall fill the specified graph that is used to preview the dragged item.
|
void |
removeStripeCreatedListener(IEventHandler<ItemEventArgs<IStripe>> stripeCreatedEvent)
Removes the given listener for the
StripeCreated event that occurs when a new stripe gets created by this input
mode. |
protected void |
setDragLocation(PointD location)
Sets the
drag location and calls ItemDropInputMode.updatePreview(IGraph, PointD) to
update the layout of item preview based on the mouse coordinates and the results of the
SnapContext . |
protected void |
updatePreview(IGraph previewGraph,
PointD newLocation)
Subclasses shall update the
preview graph so the dragged item is displayed at the specified
dragLocation . |
addItemCreatedListener, cleanup, cleanupDropTarget, cleanupPreview, cleanupSnapContext, collectSnapResults, getDraggedItem, getDropTarget, getDropTarget, getItemCreator, getPreviewGraph, getSnapContext, getSnappedMousePosition, initializeDropTarget, initializePreview, initializeSnapContext, isDropTargetHighlightEnabled, isPreviewEnabled, isSnappingEnabled, onConcurrencyControllerDeactivated, onItemCreated, removeItemCreatedListener, setDropTarget, setDropTargetHighlightEnabled, setItemCreator, setPreviewEnabled, setSnapContext, setSnappingEnabled, updateDropTarget
addDragDroppedListener, addDragEnteredListener, addDragLeftListener, addDragOverListener, adjustTransferMode, createInputModeEventArgs, getController, getDropData, getDropData, getDropDataMap, getDropLocation, getExpectedType, getInputModeContext, getLastDragEvent, getMousePosition, getPriority, getTransferMode, getValidDropHitTestable, install, isCapturingMouseInputDuringDragEnabled, isEnabled, isExclusive, onCanceled, onConcurrencyControllerActivated, onStopped, removeDragDroppedListener, removeDragEnteredListener, removeDragLeftListener, removeDragOverListener, setCapturingMouseInputDuringDragEnabled, setDropDataMap, setEnabled, setExclusive, setPriority, setTransferMode, setValidDropHitTestable, stop, uninstall
public StripeDropInputMode()
StripeDropInputMode
.public final void addStripeCreatedListener(IEventHandler<ItemEventArgs<IStripe>> stripeCreatedEvent)
StripeCreated
event that occurs when a new stripe gets created by this input
mode.stripeCreatedEvent
- The listener to add.removeStripeCreatedListener(IEventHandler)
public void cancel()
DropInputMode
cancel
in interface IInputMode
cancel
in class DropInputMode
protected ITable createPreviewTable()
protected IStripe createStripe(IInputModeContext context, IStripe newParent)
This method is called by the ItemCreator
that is set as default on this
class.
newParent
- The parent for which to create the stripe.context
- The context for which the stripe should be created.protected RectD getPreviewTableLayout(PointD location, SizeD size)
In this implementation the mouse location is used as center of the table. Can be overridden in child class to implement a different layout.
location
- Current mouse positionsize
- Size of the tableRectD
with the given size and the mouse location as center.protected void onDragDropped(InputModeEventArgs eventArgs)
DropInputMode
onDragDropped
in class ItemDropInputMode<IStripe>
protected void onDragEntered(InputModeEventArgs eventArgs)
ItemDropInputMode
Calls ItemDropInputMode.initializeSnapContext()
, ItemDropInputMode.initializePreview()
and ItemDropInputMode.initializeDropTarget()
.
onDragEntered
in class ItemDropInputMode<IStripe>
protected void onDragExited(InputModeEventArgs eventArgs)
DropInputMode
onDragExited
in class ItemDropInputMode<IStripe>
protected void onDraggedOver(InputModeEventArgs e)
DropInputMode
onDraggedOver
in class ItemDropInputMode<IStripe>
protected void onStripeCreated(ItemEventArgs<IStripe> args)
protected void populatePreviewGraph(IGraph previewGraph)
ItemDropInputMode
populatePreviewGraph
in class ItemDropInputMode<IStripe>
previewGraph
- The preview graph to fill.public final void removeStripeCreatedListener(IEventHandler<ItemEventArgs<IStripe>> stripeCreatedEvent)
StripeCreated
event that occurs when a new stripe gets created by this input
mode.stripeCreatedEvent
- The listener to remove.addStripeCreatedListener(IEventHandler)
protected void setDragLocation(PointD location)
ItemDropInputMode
drag location
and calls ItemDropInputMode.updatePreview(IGraph, PointD)
to
update the layout of item preview based on the mouse coordinates and the results of the
SnapContext
.setDragLocation
in class ItemDropInputMode<IStripe>
location
- The current location of the mouse in world coordinates.protected void updatePreview(IGraph previewGraph, PointD newLocation)
ItemDropInputMode
preview graph
so the dragged item is displayed at the specified
dragLocation
.updatePreview
in class ItemDropInputMode<IStripe>
previewGraph
- The preview graph to update.newLocation
- The current drag location.