/*
 * @(#)ColorShapeFactory.java	1.0 11-Apr-07
 *
 * IIT Bombay,
 * Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License.
 */
package classes.shapes;

import java.awt.Color;

import classes.shapes.decorators.ColorDecorator;
import classes.shapes.decorators.ColorFactory;
import types.ShapeCoordinates;
import interfaces.IColorFactory;
import interfaces.ICommandMediator;
import interfaces.IShape;
import interfaces.IShapeAbstractFactory;
import interfaces.IShapeFactory;

/**
 * Factory class for the Colored Shape objects
 *
 * @author  Prathab, Mukesh
 * @version 1.0, 06-Apr-07
 */
public class RedRectangleFactory implements IShapeAbstractFactory {

	/**
	 * Creates a red rectangular shape (demonstrate Abstract Factory pattern)
	 * @param shapeName name of the shape
	 * @param object object(abstract) required to make shape
	 * @param shapeCoordinates default coordinates of the shape
	 * @param commandMediator command meditor to interact with other classes
	 * @return new <tt>ColorDecorator</tt> object (of IShape type)
	 * @see interfaces.IShapeAbstractFactory#getAbstractShape(java.lang.String, java.lang.Object, types.ShapeCoordinates, interfaces.ICommandMediator)
	 * @see types.ShapeCoordinates
	 * @see interfaces.ICommandMediator
	 */
	public IShape getAbstractShape(String shapeName, Object object,
			ShapeCoordinates shapeCoordinates, ICommandMediator commandMediator) {
		IShapeFactory shapeFactory = new ShapeFactory();
   	 	IShape shape = shapeFactory.getShape("Rectangle", shapeCoordinates, commandMediator);
   	 	IColorFactory colorFactory = new ColorFactory();
   	 	Color color =  colorFactory.getColor("Red");
   	 	return new ColorDecorator(shape, color);
	}

}
