Package jmri.util.datatransfer
Class RosterEntrySelection
java.lang.Object
jmri.util.datatransfer.RosterEntrySelection
- All Implemented Interfaces:
ClipboardOwner,Transferable
Transfer roster entries either via drag-and-drop or via the clipboard.
This file is part of JMRI.
Note that roster entries can only be transfered within a single JVM instance, and cannot be shared between programs via this mechanism.
This file is part of JMRI.
JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRosterEntrySelection(ArrayList<String> rosterEntries) Create the transferable. -
Method Summary
Modifier and TypeMethodDescriptionstatic RosterEntrySelectioncreateRosterEntrySelection(ArrayList<RosterEntry> rosterEntries) Create a transferable with a list of RosterEntries.static ArrayList<RosterEntry>Get an ArrayList of RosterEntries from a RosterEntrySelection.booleanvoidlostOwnership(Clipboard clpbrd, Transferable t)
-
Field Details
-
rosterEntryFlavor
-
-
Constructor Details
-
RosterEntrySelection
Create the transferable.Takes as a parameter an ArrayList containing Strings representing RosterEntry Ids.
- Parameters:
rosterEntries- an ArrayList of RosterEntry Ids
-
-
Method Details
-
createRosterEntrySelection
Create a transferable with a list of RosterEntries.- Parameters:
rosterEntries- entries to include in the selection- Returns:
- a new selection with the given entries
-
getTransferDataFlavors
- Specified by:
getTransferDataFlavorsin interfaceTransferable
-
isDataFlavorSupported
- Specified by:
isDataFlavorSupportedin interfaceTransferable
-
getTransferData
- Specified by:
getTransferDatain interfaceTransferable- Throws:
UnsupportedFlavorExceptionIOException
-
lostOwnership
- Specified by:
lostOwnershipin interfaceClipboardOwner
-
getRosterEntries
public static ArrayList<RosterEntry> getRosterEntries(Transferable t) throws UnsupportedFlavorException, IOException Get an ArrayList of RosterEntries from a RosterEntrySelection.- Parameters:
t- a Transferable object. This should be a RosterEntrySelection, but for simplicity, will accept any Transferable object.- Returns:
- the transfered roster entries
- Throws:
UnsupportedFlavorException- if the transferable is incorrectIOException- if unable to transfer the entries
-