classes.container
Class ShapeContainer

java.lang.Object
  extended by interfaces.CommandColleague
      extended by classes.container.ShapeContainer
All Implemented Interfaces:
IShapeContainer

public class ShapeContainer
extends CommandColleague
implements IShapeContainer

Holds the Shape class object

Version:
1.0, 21-Mar-07
Author:
Prathab, Mukesh
See Also:
CommandColleague

Field Summary
 int CONTAINER_SIZE
           
 boolean isPermanentShape
           
 int NO_OF_COLS
           
 int NO_OF_ROWS
           
 ShapeCoordinates shapeCoordinates
           
 IShape[] shapeList
           
 
Fields inherited from class interfaces.CommandColleague
commandMediator
 
Constructor Summary
ShapeContainer(ShapeCoordinates shapeCoordinates, ICommandMediator commandMediator)
          Initializes with shapecoordinates and mediator object
 
Method Summary
 boolean addShape(IShape shape)
          Adds the given shape object to container
 void drawShape()
          Draws the container by encapuslating the drawing information using Command object.
 IShape getShape(int index)
          Returns the shape object for the given index
 boolean removeShape(IShape shape)
          Removes the given shape from the container
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shapeCoordinates

public ShapeCoordinates shapeCoordinates

shapeList

public IShape[] shapeList

CONTAINER_SIZE

public int CONTAINER_SIZE

NO_OF_ROWS

public int NO_OF_ROWS

NO_OF_COLS

public int NO_OF_COLS

isPermanentShape

public boolean isPermanentShape
Constructor Detail

ShapeContainer

public ShapeContainer(ShapeCoordinates shapeCoordinates,
                      ICommandMediator commandMediator)
Initializes with shapecoordinates and mediator object

See Also:
ShapeCoordinates, ICommandMediator
Method Detail

drawShape

public void drawShape()
Draws the container by encapuslating the drawing information using Command object. Uses the commandMediator object to send the command to CommandContainer object

Specified by:
drawShape in interface IShapeContainer

addShape

public boolean addShape(IShape shape)
Adds the given shape object to container

Specified by:
addShape in interface IShapeContainer
Parameters:
shape - shape to be added
Returns:
true if the shape object is added

removeShape

public boolean removeShape(IShape shape)
Removes the given shape from the container

Specified by:
removeShape in interface IShapeContainer
Parameters:
shape - shape to be removed
Returns:
true if the shape object is removed

getShape

public IShape getShape(int index)
Returns the shape object for the given index

Specified by:
getShape in interface IShapeContainer
Parameters:
index - index to be retrieved in the ShapeList
Returns:
IShape object type of the given index