interfaces
Class ShapeDecorator

java.lang.Object
  extended by interfaces.ShapeDecorator
All Implemented Interfaces:
IShape, IShapeDrawer, java.lang.Cloneable
Direct Known Subclasses:
ColorDecorator

public abstract class ShapeDecorator
extends java.lang.Object
implements IShape

Decorates the IShape object

Version:
1.0, 22-Mar-07
Author:
Prathab
See Also:
IShape

Field Summary
 IShape shape
           
 
Constructor Summary
ShapeDecorator(IShape shape)
           
 
Method Summary
 void changeShapeXYCoordinates(int x, int y)
          Relocate the shape at external specified location
 java.lang.Object clone()
          Create clone of the object
 void decorateShape()
          Decorate the shape.
 void drawShape()
          Draws the shape based on the operations stored in command object
 void drawShape(int x, int y)
          Draws the shape at the external specified location
 java.awt.Color getColor()
          Returns the color attribute for the shape
 boolean IsPermanentShape()
          Return whether the shape is permanent
 void setAsPermanentShape(boolean isPermanent)
          Sets whether the shape is permanent or tempory with respect to drawing
 void setColor(java.awt.Color color)
          Sets the color attribute for the shape
 void setCommandObject(Command command)
          Set the Command object which contains the commands to draw the shape
 void setGraphicsObject(java.awt.Graphics g)
          Set the Graphics object which is responsible to draw the graphics
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shape

public IShape shape
Constructor Detail

ShapeDecorator

public ShapeDecorator(IShape shape)
Method Detail

setGraphicsObject

public void setGraphicsObject(java.awt.Graphics g)
Set the Graphics object which is responsible to draw the graphics

Specified by:
setGraphicsObject in interface IShapeDrawer
Parameters:
g - Graphics object to be set
See Also:
IShapeDrawer.setGraphicsObject(java.awt.Graphics)

setCommandObject

public void setCommandObject(Command command)
Set the Command object which contains the commands to draw the shape

Specified by:
setCommandObject in interface IShapeDrawer
Parameters:
command - Command object to set
See Also:
IShapeDrawer.setCommandObject(types.Command)

drawShape

public void drawShape()
Draws the shape based on the operations stored in command object

Specified by:
drawShape in interface IShapeDrawer
See Also:
IShapeDrawer.drawShape()

drawShape

public void drawShape(int x,
                      int y)
Draws the shape at the external specified location

Specified by:
drawShape in interface IShape
Parameters:
x - x-coordinate
y - y-coordinate
See Also:
IShape.drawShape(int, int)

changeShapeXYCoordinates

public void changeShapeXYCoordinates(int x,
                                     int y)
Relocate the shape at external specified location

Specified by:
changeShapeXYCoordinates in interface IShape
Parameters:
x - x-coordinate
y - y-coordinate
See Also:
IShape.drawShape(int, int)

setAsPermanentShape

public void setAsPermanentShape(boolean isPermanent)
Sets whether the shape is permanent or tempory with respect to drawing

Specified by:
setAsPermanentShape in interface IShape
Parameters:
isPermanent - status of the shape
See Also:
IShape.setAsPermanentShape(boolean)

IsPermanentShape

public boolean IsPermanentShape()
Return whether the shape is permanent

Specified by:
IsPermanentShape in interface IShape
Returns:
true if shape is permanent
See Also:
IShape.IsPermanentShape()

setColor

public void setColor(java.awt.Color color)
Sets the color attribute for the shape

Specified by:
setColor in interface IShape
Parameters:
color - color to be set
See Also:
IShape.setColor(java.awt.Color)

getColor

public java.awt.Color getColor()
Returns the color attribute for the shape

Specified by:
getColor in interface IShape
Returns:
java.awt.Color object
See Also:
IShape.getColor()

clone

public java.lang.Object clone()
Create clone of the object

Specified by:
clone in interface IShape
Overrides:
clone in class java.lang.Object
Returns:
created clone object
See Also:
IShape.clone()

decorateShape

public void decorateShape()
Decorate the shape. Implementation is deferred to sub class