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

package interfaces;

import java.awt.Color;
import java.awt.Graphics;

import types.Command;


/**
 * Decorates the <tt>IShape</tt> object
 *
 * @author  Prathab
 * @version 1.0, 22-Mar-07
 * @see interfaces.IShape
 */
public abstract class ShapeDecorator implements IShape{
	
	public IShape shape;
	
	public ShapeDecorator(IShape shape) {
		this.shape = shape;
	}
	
	/**
	 * Set the Graphics object which is responsible to draw the graphics
	 * @param g <tt>Graphics</tt> object to be set
	 * @see interfaces.IShapeDrawer#setGraphicsObject(java.awt.Graphics)
	 */
	public void setGraphicsObject(Graphics g) {
		shape.setGraphicsObject(g);
	}

	/**
	 * Set the Command object which contains the commands to draw the shape
	 * @param command <tt>Command</tt> object to set
	 * @see interfaces.IShapeDrawer#setCommandObject(types.Command)
	 */
	public void setCommandObject(Command command) {
		shape.setCommandObject(command);
	}

	/**
	 * Draws the shape based on the operations stored in command object
	 * @see interfaces.IShapeDrawer#drawShape()
	 */
	public void drawShape() {
		shape.drawShape();
	}	
	/**
	 * Draws the shape at the external specified location 
	 * @see interfaces.IShape#drawShape(int, int)
	 */
	public void drawShape(int x, int y) {
		shape.drawShape(x,y);
	}
	
	/**
	 * Relocate the shape at external specified location 
	 * @see interfaces.IShape#drawShape(int, int)
	 */
	public void changeShapeXYCoordinates(int x, int y) {
		shape.changeShapeXYCoordinates(x,y);
	}
	
	/**
	 * Sets whether the shape is permanent or tempory with respect to drawing
	 * @see interfaces.IShape#setAsPermanentShape(boolean)
	 */
	public void setAsPermanentShape(boolean isPermanent) {
		shape.setAsPermanentShape(isPermanent);
	}
	
	/**
	 * Return whether the shape is permanent
	 * @return <tt>true</tt> if shape is permanent
	 * @see interfaces.IShape#IsPermanentShape()
	 */
	public boolean IsPermanentShape() {
		return shape.IsPermanentShape();
	}
	
	/**
	 * Sets the color attribute for the shape
	 * @param color color to be set
	 * @see interfaces.IShape#setColor(java.awt.Color)
	 */
	public void setColor(Color color) {
		shape.setColor(color);
		
	}
	/**
	 * Returns the color attribute for the shape
	 * @return <tt>java.awt.Color</tt> object
	 * @see interfaces.IShape#getColor()
	 */
	public Color getColor(){
		return shape.getColor();
	}
	/**
	 * Create clone of the object
	 * @return created clone object 
	 * @see interfaces.IShape#clone()
	 */
	public Object clone() {
		return shape.clone();
	}
	
	/**
	 * Decorate the shape. Implementation is deferred to sub class
	 */
	public void decorateShape(){}
}
