Package com.diffplug.common.swt.dnd
Class StructuredDrop
java.lang.Object
com.diffplug.common.swt.dnd.StructuredDrop
Typed mechanism for implementing drop listeners.
https://eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumstatic classstatic interfaceclass -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<TValue> StructuredDrop.TypeMapper<TValue>add(TypedTransfer<TValue> transfer, StructuredDrop.TypedDropHandler<TValue> onEvent) Adds a drop for the given filetype.<TValue,TTransfer extends Transfer>
StructuredDrop.TypeMapper<TValue>add(TTransfer transfer, BiFunction<TTransfer, DropTargetEvent, TValue> valueGetter, StructuredDrop.TypedDropHandler<TValue> onEvent) Adds a drop for the given transfer.addFile(StructuredDrop.TypedDropHandler<ImmutableList<File>> onEvent) Adds the ability to drop files.addText(StructuredDrop.TypedDropHandler<String> onEvent) Adds the ability to drop text.voidvoidstatic <T> StructuredDrop.TypedDropHandler<T>handler(DndOp op, BiConsumer<DropTargetEvent, T> onValue) static <T> StructuredDrop.TypedDropHandler<T>booleanhasHandlerFor(Transfer transfer) Returns true if it contains a handler for this transfer type.static TransferpreferDropTransfer(DropTargetEvent event, Transfer[] preferreds) Sets event.currentDataType to the most preferred possible.
-
Constructor Details
-
StructuredDrop
public StructuredDrop()
-
-
Method Details
-
hasHandlerFor
Returns true if it contains a handler for this transfer type. -
add
public <TValue,TTransfer extends Transfer> StructuredDrop.TypeMapper<TValue> add(TTransfer transfer, BiFunction<TTransfer, DropTargetEvent, TValue> valueGetter, StructuredDrop.TypedDropHandler<TValue> onEvent) Adds a drop for the given transfer. -
add
public <TValue> StructuredDrop.TypeMapper<TValue> add(TypedTransfer<TValue> transfer, StructuredDrop.TypedDropHandler<TValue> onEvent) Adds a drop for the given filetype. -
addText
Adds the ability to drop text. -
addFile
public StructuredDrop.TypeMapper<ImmutableList<File>> addFile(StructuredDrop.TypedDropHandler<ImmutableList<File>> onEvent) Adds the ability to drop files. -
getListener
-
applyTo
-
applyTo
-
preferDropTransfer
Sets event.currentDataType to the most preferred possible. Returns the Transfer that was actually used. -
handler
-
handler
public static <T> StructuredDrop.TypedDropHandler<T> handler(DndOp op, BiConsumer<DropTargetEvent, T> onValue)
-