Class LayerListTransferHandler
- java.lang.Object
-
- javax.swing.TransferHandler
-
- org.openstreetmap.josm.gui.dialogs.layer.LayerListTransferHandler
-
- All Implemented Interfaces:
Serializable
public class LayerListTransferHandler extends TransferHandler
This class allows the user to transfer layers using drag+drop.It supports copy (duplication) of layers, simple moves and linking layers to a new layer manager.
- Since:
- 10605
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.TransferHandler
TransferHandler.DropLocation, TransferHandler.TransferSupport
-
-
Field Summary
-
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, LINK, MOVE, NONE
-
-
Constructor Summary
Constructors Constructor Description LayerListTransferHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canImport(TransferHandler.TransferSupport support)
private static List<Layer>
createCopy(List<Layer> layersToUse, List<Layer> namesToAvoid)
protected Transferable
createTransferable(JComponent c)
private static List<String>
getNames(List<Layer> namesToAvoid)
int
getSourceActions(JComponent c)
boolean
importData(TransferHandler.TransferSupport support)
private static boolean
onlyDataLayersSelected(LayerListDialog.LayerListModel tableModel)
private static String
suggestNewLayerName(String name, Collection<String> layerNames)
static String
suggestNewLayerName(String name, List<Layer> namesToAvoid)
Suggests a new name in the form "copy of name"-
Methods inherited from class javax.swing.TransferHandler
canImport, exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getDragImage, getDragImageOffset, getPasteAction, getVisualRepresentation, importData, setDragImage, setDragImageOffset
-
-
-
-
Constructor Detail
-
LayerListTransferHandler
public LayerListTransferHandler()
-
-
Method Detail
-
getSourceActions
public int getSourceActions(JComponent c)
- Overrides:
getSourceActions
in classTransferHandler
-
onlyDataLayersSelected
private static boolean onlyDataLayersSelected(LayerListDialog.LayerListModel tableModel)
-
createTransferable
protected Transferable createTransferable(JComponent c)
- Overrides:
createTransferable
in classTransferHandler
-
canImport
public boolean canImport(TransferHandler.TransferSupport support)
- Overrides:
canImport
in classTransferHandler
-
importData
public boolean importData(TransferHandler.TransferSupport support)
- Overrides:
importData
in classTransferHandler
-
createCopy
private static List<Layer> createCopy(List<Layer> layersToUse, List<Layer> namesToAvoid)
-
suggestNewLayerName
public static String suggestNewLayerName(String name, List<Layer> namesToAvoid)
Suggests a new name in the form "copy of name"- Parameters:
name
- The base namenamesToAvoid
- The list of layers to use to avoid duplicate names.- Returns:
- The new name
-
suggestNewLayerName
private static String suggestNewLayerName(String name, Collection<String> layerNames)
-
-