net.sf.freecol.client.gui.panel
Class DragListener

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by net.sf.freecol.client.gui.panel.DragListener
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener

public final class DragListener
extends java.awt.event.MouseAdapter

A DragListener should be attached to Swing components that have a TransferHandler attached. The DragListener will make sure that the Swing component to which it is attached is draggable (moveable to be precise).


Field Summary
private  Canvas canvas
           
private  FreeColPanel parentPanel
           
 
Constructor Summary
DragListener(FreeColPanel parentPanel)
          The constructor to use.
 
Method Summary
private  boolean addCarrierItems(UnitLabel unitLabel, javax.swing.JPopupMenu menu)
           
private  boolean addCommandItems(UnitLabel unitLabel, javax.swing.JPopupMenu menu)
           
private  boolean addEducationItems(UnitLabel unitLabel, javax.swing.JPopupMenu menu)
           
private  boolean addEquipmentItems(UnitLabel unitLabel, javax.swing.JPopupMenu menu)
           
private  boolean addWorkItems(UnitLabel unitLabel, javax.swing.JPopupMenu menu)
           
 javax.swing.JPopupMenu getGoodsMenu(GoodsLabel goodsLabel)
           
 javax.swing.JPopupMenu getUnitMenu(UnitLabel unitLabel)
           
 void mousePressed(java.awt.event.MouseEvent e)
          Gets called when the mouse was pressed on a Swing component that has this object as a MouseListener.
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseReleased, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentPanel

private final FreeColPanel parentPanel

canvas

private final Canvas canvas
Constructor Detail

DragListener

public DragListener(FreeColPanel parentPanel)
The constructor to use.

Parameters:
parentPanel - The layered pane that contains the components to which a DragListener might be attached.
Method Detail

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Gets called when the mouse was pressed on a Swing component that has this object as a MouseListener.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class java.awt.event.MouseAdapter
Parameters:
e - The event that holds the information about the mouse click.

getUnitMenu

public javax.swing.JPopupMenu getUnitMenu(UnitLabel unitLabel)

addCarrierItems

private boolean addCarrierItems(UnitLabel unitLabel,
                                javax.swing.JPopupMenu menu)

addWorkItems

private boolean addWorkItems(UnitLabel unitLabel,
                             javax.swing.JPopupMenu menu)

addEducationItems

private boolean addEducationItems(UnitLabel unitLabel,
                                  javax.swing.JPopupMenu menu)

addCommandItems

private boolean addCommandItems(UnitLabel unitLabel,
                                javax.swing.JPopupMenu menu)

addEquipmentItems

private boolean addEquipmentItems(UnitLabel unitLabel,
                                  javax.swing.JPopupMenu menu)

getGoodsMenu

public javax.swing.JPopupMenu getGoodsMenu(GoodsLabel goodsLabel)