Class AbstractOsmDataPaster
- java.lang.Object
-
- org.openstreetmap.josm.gui.datatransfer.importers.AbstractOsmDataPaster
-
- Direct Known Subclasses:
AbstractTagPaster
,FilePaster
,OsmLinkPaster
,PrimitiveDataPaster
public abstract class AbstractOsmDataPaster extends Object
This is an abstract class that helps implementing the transfer support required by swing.It implements a mechanism to import a given data flavor into the current OSM data layer.
- Since:
- 10604
-
-
Field Summary
Fields Modifier and Type Field Description protected DataFlavor
df
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractOsmDataPaster(DataFlavor df)
Create a newAbstractOsmDataPaster
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
importData(TransferHandler.TransferSupport support, OsmDataLayer layer, EastNorth pasteAt)
Attempts to import the given transfer data.boolean
importTagsOn(TransferHandler.TransferSupport support, Collection<? extends OsmPrimitive> selection)
Imports only if this import changes the tags only.private static boolean
isCopy(TransferHandler.TransferSupport support)
boolean
supports(Collection<DataFlavor> available)
Checks if this supports any of the available flavors.boolean
supports(TransferHandler.TransferSupport support)
Checks if this supports importing the given transfer support.
-
-
-
Field Detail
-
df
protected final DataFlavor df
-
-
Constructor Detail
-
AbstractOsmDataPaster
protected AbstractOsmDataPaster(DataFlavor df)
Create a newAbstractOsmDataPaster
- Parameters:
df
- The data flavor that this support supports.
-
-
Method Detail
-
supports
public boolean supports(TransferHandler.TransferSupport support)
Checks if this supports importing the given transfer support.- Parameters:
support
- The support that should be supported.- Returns:
- True if we support that transfer.
-
supports
public boolean supports(Collection<DataFlavor> available)
Checks if this supports any of the available flavors.- Parameters:
available
- The flavors that should be supported- Returns:
- True if any of them is supported.
-
isCopy
private static boolean isCopy(TransferHandler.TransferSupport support)
-
importData
public abstract boolean importData(TransferHandler.TransferSupport support, OsmDataLayer layer, EastNorth pasteAt) throws UnsupportedFlavorException, IOException
Attempts to import the given transfer data.- Parameters:
support
- The transfer support to import from.layer
- The layer to paste at. May be null.pasteAt
- The position to paste at.- Returns:
true
if the import was successful.- Throws:
UnsupportedFlavorException
- if the requested data flavor is not supportedIOException
- if an I/O error occurs
-
importTagsOn
public boolean importTagsOn(TransferHandler.TransferSupport support, Collection<? extends OsmPrimitive> selection) throws UnsupportedFlavorException, IOException
Imports only if this import changes the tags only. Does nothing if more than tags would be changed.- Parameters:
support
- The supportselection
- The primitives to apply on.- Returns:
true
if an import was done.- Throws:
UnsupportedFlavorException
- if the requested data flavor is not supportedIOException
- if an I/O error occurs
-
-