Class TransferHandler
java.lang.Object
vaadinx.swing.TransferHandler
- All Implemented Interfaces:
Serializable
Emulator for
TransferHandler. Reproduces the Swing
transfer-handler API surface against vaadinx.* component types so
import-swapped code subclasses it unchanged. The default (un-subclassed)
handler exports/imports nothing — the JDK's property-backed cut/copy/paste
default is drop-and-WARN per R_vaadin_first (D_drag_and_drop accepted limitations).- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEmulator forTransferHandler.DropLocation.static final classEmulator forTransferHandler.TransferSupport. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intCopy action.static final intCopy-or-move action.static final intLink/reference action.static final intMove action.static final intNo transfer action. -
Constructor Summary
ConstructorsConstructorDescriptionConvenience handler with no property-backed default behaviour.TransferHandler(String property) Property-backed handler. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanImport(JComponent comp, DataFlavor[] transferFlavors) Deprecated.booleancanImport(TransferHandler.TransferSupport support) Whether a drop/paste described bysupportcan be imported.protected TransferableBuilds theTransferablerepresentingc's current data for export.voidexportAsDrag(JComponent comp, InputEvent e, int action) Initiates a drag ofcomp's data.protected voidexportDone(JComponent source, Transferable data, int action) Invoked after an export completes (successfully or not) with the action that was performed.voidexportToClipboard(JComponent comp, Clipboard clip, int action) Exportscomp's data toclip.intbooleanimportData(JComponent comp, Transferable t) Deprecated.component+transferable form retained for API compatibility.booleanPerforms the import described bysupport, returning whether it succeeded.voidStores the offset; the browser renders its own drag image, which is the effect R_decline_effect_only permits dropping.
-
Field Details
-
NONE
public static final int NONENo transfer action.- See Also:
-
COPY
public static final int COPYCopy action.- See Also:
-
MOVE
public static final int MOVEMove action.- See Also:
-
COPY_OR_MOVE
public static final int COPY_OR_MOVECopy-or-move action.- See Also:
-
LINK
public static final int LINKLink/reference action.- See Also:
-
-
Constructor Details
-
TransferHandler
public TransferHandler()Convenience handler with no property-backed default behaviour. -
TransferHandler
Property-backed handler. The JDK builds a default Transferable from the named bean property for cut/copy/paste; we store the name for API fidelity but the property-backed default is drop-and-WARN (D_drag_and_drop).
-
-
Method Details
-
getSourceActions
-
createTransferable
Builds theTransferablerepresentingc's current data for export. Default null (nothing to export). Subclasses override. -
exportDone
Invoked after an export completes (successfully or not) with the action that was performed.MOVEis the source's cue to delete the moved data. Default no-op; subclasses override. -
canImport
Whether a drop/paste described bysupportcan be imported. Default false. Subclasses override. -
canImport
Deprecated.array form retained for API compatibility; theTransferHandler.TransferSupportform is canonical. -
importData
Performs the import described bysupport, returning whether it succeeded. Default false. Subclasses override. -
importData
Deprecated.component+transferable form retained for API compatibility. -
exportAsDrag
Initiates a drag ofcomp's data. In Swing this is called from a component's UI on a drag gesture; here the browser drag gesture drives the Vaadin DragSource which callscreateTransferable(JComponent)directly, so this entry point is rarely used by migrated code. Best-effort R_best_effort_behaviour: it records the export so a subsequent programmatic flow sees consistent state, but the actual gesture originates in the browser. -
exportToClipboard
Exportscomp's data toclip. Bridges to the sameWebClipboardthe clipboard slice (D_clipboard) installs. -
getDragImageOffset
- Returns:
- a fresh copy,
(0, 0)until something sets an offset — as the JDK does
-
setDragImageOffset
Stores the offset; the browser renders its own drag image, which is the effect R_decline_effect_only permits dropping.- Throws:
NullPointerException- on a null offset, which is what the JDK's ownnew Point(p.x, p.y)does to it
-
TransferHandler.TransferSupportform is canonical.