game.military.gui
Class AbstractArmyCell

java.lang.Object
  |
  +--game.military.gui.AbstractMilitaryCell
        |
        +--game.military.gui.AbstractArmyCell
All Implemented Interfaces:
MilitaryCell
Direct Known Subclasses:
CivilizationCell, OneRowCell, SquareCell, TaskForceCell

public abstract class AbstractArmyCell
extends AbstractMilitaryCell

Extends AbstractMilitaryCell for items with subunits.


Field Summary
(package private)  java.util.Collection subUnits
          Collection of the contained units indexed by the contained armies.
 
Constructor Summary
AbstractArmyCell(Command command, int relativeX, int relativeY)
          Constructor.
 
Method Summary
protected  void add(MilitaryCell subUnitView)
          Add a new sub-unit.
 java.awt.Image getImage()
          Return the image for this cell.
 java.util.Iterator iterator()
          Iterator over the unit views.
 boolean selectTaskForce(int xMouse, int yMouse)
          Select a task force if the mouse is on it.
 boolean selectUnit(int xMouse, int yMouse)
          Select a task force if the mouse is on it.
 
Methods inherited from class game.military.gui.AbstractMilitaryCell
contains, getBufferedImage, getCommand, getHeight, getPowerLength, getPowerLength, getRelativeX, getRelativeY, getWidth, setHeight, setRelativeX, setRelativeY, setWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subUnits

java.util.Collection subUnits
Collection of the contained units indexed by the contained armies.

Constructor Detail

AbstractArmyCell

public AbstractArmyCell(Command command,
                        int relativeX,
                        int relativeY)
Constructor.

Parameters:
command - the command to display.
relativeX - the relative x coordinate of the left hand edge.
relativeY - the relative y coordinate of the top edge.
Method Detail

getImage

public java.awt.Image getImage()
Return the image for this cell.

Specified by:
getImage in interface MilitaryCell
Specified by:
getImage in class AbstractMilitaryCell
Returns:
the image for this cell.

selectTaskForce

public boolean selectTaskForce(int xMouse,
                               int yMouse)
Select a task force if the mouse is on it.

Specified by:
selectTaskForce in interface MilitaryCell
Overrides:
selectTaskForce in class AbstractMilitaryCell
Parameters:
xMouse - the x coordinate of the mouse.
yMouse - the y coordinate of the mouse.
Returns:
the true if found.

selectUnit

public boolean selectUnit(int xMouse,
                          int yMouse)
Select a task force if the mouse is on it.

Specified by:
selectUnit in interface MilitaryCell
Overrides:
selectUnit in class AbstractMilitaryCell
Parameters:
xMouse - the x coordinate of the mouse.
yMouse - the y coordinate of the mouse.
Returns:
true if found.

add

protected void add(MilitaryCell subUnitView)
Add a new sub-unit.

Parameters:
subUnitView - sub-unit to add.

iterator

public java.util.Iterator iterator()
Iterator over the unit views.

Specified by:
iterator in interface MilitaryCell
Overrides:
iterator in class AbstractMilitaryCell
Returns:
iterator over the unit views.