net.sf.freecol.client.gui.panel
Class BuildQueuePanel.BuildQueueTransferHandler
java.lang.Object
javax.swing.TransferHandler
net.sf.freecol.client.gui.panel.BuildQueuePanel.BuildQueueTransferHandler
- All Implemented Interfaces:
- java.io.Serializable
- Enclosing class:
- BuildQueuePanel
public class BuildQueuePanel.BuildQueueTransferHandler
- extends javax.swing.TransferHandler
This class implements a transfer handler able to transfer
BuildQueueItems between the build queue list, the
unit list and the building list.
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from class javax.swing.TransferHandler |
javax.swing.TransferHandler.DropLocation, javax.swing.TransferHandler.TransferSupport |
| Fields inherited from class javax.swing.TransferHandler |
COPY, COPY_OR_MOVE, LINK, MOVE, NONE |
|
Method Summary |
boolean |
canImport(javax.swing.JComponent comp,
java.awt.datatransfer.DataFlavor[] flavors)
Returns true if the component can import this
data flavor. |
protected java.awt.datatransfer.Transferable |
createTransferable(javax.swing.JComponent comp)
Returns a Transferable suitable for wrapping
the build queue. |
protected void |
exportDone(javax.swing.JComponent source,
java.awt.datatransfer.Transferable data,
int action)
Cleans up after a successful import. |
int |
getSourceActions(javax.swing.JComponent comp)
Returns the possible source actions of the component. |
boolean |
importData(javax.swing.JComponent comp,
java.awt.datatransfer.Transferable data)
Imports a build queue into the build queue list, the
building list or the unit list, if possible. |
| Methods inherited from class javax.swing.TransferHandler |
canImport, exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation, importData |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
buildQueueFlavor
private final java.awt.datatransfer.DataFlavor buildQueueFlavor
source
javax.swing.JList source
indices
int[] indices
numberOfItems
int numberOfItems
BuildQueuePanel.BuildQueueTransferHandler
public BuildQueuePanel.BuildQueueTransferHandler()
importData
public boolean importData(javax.swing.JComponent comp,
java.awt.datatransfer.Transferable data)
- Imports a build queue into the build queue list, the
building list or the unit list, if possible.
- Overrides:
importData in class javax.swing.TransferHandler
- Parameters:
comp - The list which imports data.data - The build queue to import.
- Returns:
- Whether the import was successful.
exportDone
protected void exportDone(javax.swing.JComponent source,
java.awt.datatransfer.Transferable data,
int action)
- Cleans up after a successful import.
- Overrides:
exportDone in class javax.swing.TransferHandler
- Parameters:
source - The component that has exported data.data - The data exported.action - The transfer action, e.g. MOVE.
canImport
public boolean canImport(javax.swing.JComponent comp,
java.awt.datatransfer.DataFlavor[] flavors)
- Returns
true if the component can import this
data flavor.
- Overrides:
canImport in class javax.swing.TransferHandler
- Parameters:
comp - The component to import data.flavors - An array of data flavors.
createTransferable
protected java.awt.datatransfer.Transferable createTransferable(javax.swing.JComponent comp)
- Returns a
Transferable suitable for wrapping
the build queue.
- Overrides:
createTransferable in class javax.swing.TransferHandler
- Parameters:
comp - The source of the build queue.
- Returns:
- A Transferable suitable for wrapping the build
queue.
getSourceActions
public int getSourceActions(javax.swing.JComponent comp)
- Returns the possible source actions of the component.
- Overrides:
getSourceActions in class javax.swing.TransferHandler
- Parameters:
comp - The source component.
- Returns:
- The possible source actions of the component.