Package edu.cnu.mdi.mapping.milsym
Class MilSymbolTransferable
java.lang.Object
edu.cnu.mdi.mapping.milsym.MilSymbolTransferable
- All Implemented Interfaces:
Transferable
Drag-and-drop payload that carries a
MilSymbolDescriptor from the
NatoIconPicker palette to the map canvas.
Usage
// In NatoIconPicker — start the drag:
Transferable t = new MilSymbolTransferable(descriptor);
dragSource.startDrag(dge, customCursor, t, dragListener);
// In MapContainer's DropTarget — receive it:
if (event.isDataFlavorSupported(MilSymbolTransferable.FLAVOR)) {
MilSymbolDescriptor d =
(MilSymbolDescriptor) event.getTransferable()
.getTransferData(MilSymbolTransferable.FLAVOR);
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DataFlavorThe singleDataFlavorused for military symbol drag payloads. -
Constructor Summary
ConstructorsConstructorDescriptionMilSymbolTransferable(MilSymbolDescriptor descriptor) Creates a transferable wrapping the given descriptor. -
Method Summary
Modifier and TypeMethodDescriptiongetTransferData(DataFlavor flavor) booleanisDataFlavorSupported(DataFlavor flavor)
-
Field Details
-
FLAVOR
The singleDataFlavorused for military symbol drag payloads.Uses a JVM-local representation class (
MilSymbolDescriptor) so the flavor is only meaningful within the same JVM — which is all we need for intra-application drag-and-drop.
-
-
Constructor Details
-
MilSymbolTransferable
Creates a transferable wrapping the given descriptor.- Parameters:
descriptor- the symbol to transfer; must not benull
-
-
Method Details
-
getTransferDataFlavors
- Specified by:
getTransferDataFlavorsin interfaceTransferable
-
isDataFlavorSupported
- Specified by:
isDataFlavorSupportedin interfaceTransferable
-
getTransferData
- Specified by:
getTransferDatain interfaceTransferable- Throws:
UnsupportedFlavorExceptionIOException
-