lab5lib
Class TripleShape

java.lang.Object
  extended by lab5lib.TripleShape
All Implemented Interfaces:
CenterLocatable, IGraphic, ILocatable, IRotatable, ISizeable

public class TripleShape
extends Object
implements IGraphic

A composite shape that contains a circle, square and oval.

Author:
Adrienne M Decker Created on: Feb 16, 2007

Constructor Summary
TripleShape()
          Creates a new instance of ManipulatableCompositeShape
 
Method Summary
 void actualPaint(Graphics2D gs, Point location, Dimension dimension)
          This method uses the Graphics2D object to paint the actual shape onto the Container.
 void addMouseListener(MouseListener ml)
          Adds a java.awt.event.MouseListener onto this graphic TODO: remove mouse listener?
 void addMouseMotionListener(MouseMotionListener mml)
          Adds a java.awt.event.MouseMotionListener onto this graphic TODO: remove listener?
 boolean contains(Point p)
          Checks whether a given point is contained within this graphic
 Rectangle getBounds()
          Returns the bounding box of this graphic
 Point getCenterLocation()
          Finds the center location of this Object
 IContainer getContainer()
           
 Dimension getDimension()
          Gets the Dimension of this Object
 Point getLocation()
          Gets the location of this Object
 Collection<MouseListener> getMouseListeners()
          Returns all the java.awt.event.MouseListeners of this graphic
 Collection<MouseMotionListener> getMouseMotionListeners()
          Returns all the java.awt.event.MouseMotionListeners of this graphic
 Integer getRotation()
          Gets the current rotation of this Object in degrees.
 Shape getShape()
          Should return a java.awt.Shape representation of this graphic.
 boolean intersects(IGraphic shape)
          In Beta Testing Tests to see if two Graphics intersect with each other.
 Vector move(Vector v)
          Moves the Object from one location to another by a specific vector
 void paint(Graphics2D gs)
          This method uses the Graphics2D object to paint itself onto its container
 void rotate(Integer degreesToRotate)
          Rotates clockwise the Object by the specified number of degrees
 void setCenterLocation(Point p)
          Sets the location of this graphic by putting the center of the Object at the specified point
 void setColorCircle(Color newColor)
          Set the color of the circle only from this composite.
 void setColorOval(Color newColor)
          Set the color of the oval only from this composite.
 void setColorSquare(Color newColor)
          Set the color of the square only from this composite.
 void setContainer(IContainer container)
          This sets the container of this graphic
 void setDimension(Dimension d)
          Sets the Dimension of this Object
 void setDimensionCircle(Dimension newSize)
          Set the dimension of the circle only from this composite.
 void setDimensionOval(Dimension newSize)
          Set the dimension of the oval only from this composite.
 void setDimensionSquare(Dimension newSize)
          Set the dimension of the square only from the composite.
 void setDirectionVector(Vector newVector)
          Set the directional vector for the entire composite shape.
 void setLocation(Point p)
          Sets the Location of this Object to be the specified point
 void setLocationCircle(Point newLocation)
          Set the location of the circle only from this composite.
 void setLocationOval(Point newLocation)
          Set the location of the oval only from this composite.
 void setLocationSquare(Point newLocation)
          Set the location of the square only from this composite.
 void setMovement(IGraphicMovement movement)
          Sets the movement of the Graphic.
 void setRotation(Integer degree)
          Sets the Rotation of the Object to be a certain degree.
 void setRotationOval(Integer newRotationAngle)
          Set the rotation of the oval only from this composite.
 void setRotationSquare(Integer newRotationAngle)
          Set the rotation of the square only from this composite.
 void startMotion()
          Starts the motion of this graphic.
 void stopMotion()
          Stops the motion of this graphic.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TripleShape

public TripleShape()
Creates a new instance of ManipulatableCompositeShape

Method Detail

startMotion

public void startMotion()
Starts the motion of this graphic.


stopMotion

public void stopMotion()
Stops the motion of this graphic.


setDimensionSquare

public void setDimensionSquare(Dimension newSize)
Set the dimension of the square only from the composite.

Parameters:
newSize - The new size to make the square.

setDimensionCircle

public void setDimensionCircle(Dimension newSize)
Set the dimension of the circle only from this composite.

Parameters:
newSize - The new size to make the circle.

setDimensionOval

public void setDimensionOval(Dimension newSize)
Set the dimension of the oval only from this composite.

Parameters:
newSize - The new size to make the oval.

setLocationCircle

public void setLocationCircle(Point newLocation)
Set the location of the circle only from this composite.

Parameters:
newLocation - The new location for the circle.

setLocationOval

public void setLocationOval(Point newLocation)
Set the location of the oval only from this composite.

Parameters:
newLocation - The new location for the oval.

setLocationSquare

public void setLocationSquare(Point newLocation)
Set the location of the square only from this composite.

Parameters:
newLocation - The new location of the square.

setRotationOval

public void setRotationOval(Integer newRotationAngle)
Set the rotation of the oval only from this composite.

Parameters:
newRotationAngle - The number of degrees to rotate the oval.

setRotationSquare

public void setRotationSquare(Integer newRotationAngle)
Set the rotation of the square only from this composite.

Parameters:
newRotationAngle - The number of degrees to rotate the square.

setColorSquare

public void setColorSquare(Color newColor)
Set the color of the square only from this composite.

Parameters:
newColor - The new color for the square.

setColorCircle

public void setColorCircle(Color newColor)
Set the color of the circle only from this composite.

Parameters:
newColor - The new color for the circle.

setColorOval

public void setColorOval(Color newColor)
Set the color of the oval only from this composite.

Parameters:
newColor - The new color for the oval.

setDirectionVector

public void setDirectionVector(Vector newVector)
Set the directional vector for the entire composite shape.

Parameters:
newVector - The new directional vector.

actualPaint

public void actualPaint(Graphics2D gs,
                        Point location,
                        Dimension dimension)
Description copied from interface: IGraphic
This method uses the Graphics2D object to paint the actual shape onto the Container.

Specified by:
actualPaint in interface IGraphic
Parameters:
gs -
location -
dimension -
See Also:
IGraphic.actualPaint(java.awt.Graphics2D, java.awt.Point, java.awt.Dimension)

addMouseListener

public void addMouseListener(MouseListener ml)
Description copied from interface: IGraphic
Adds a java.awt.event.MouseListener onto this graphic TODO: remove mouse listener?

Specified by:
addMouseListener in interface IGraphic
Parameters:
ml -
See Also:
IGraphic.addMouseListener(java.awt.event.MouseListener)

addMouseMotionListener

public void addMouseMotionListener(MouseMotionListener mml)
Description copied from interface: IGraphic
Adds a java.awt.event.MouseMotionListener onto this graphic TODO: remove listener?

Specified by:
addMouseMotionListener in interface IGraphic
Parameters:
mml -
See Also:
IGraphic.addMouseMotionListener(java.awt.event.MouseMotionListener)

contains

public boolean contains(Point p)
Description copied from interface: IGraphic
Checks whether a given point is contained within this graphic

Specified by:
contains in interface IGraphic
Parameters:
p -
Returns:
See Also:
IGraphic.contains(java.awt.Point)

getBounds

public Rectangle getBounds()
Description copied from interface: IGraphic
Returns the bounding box of this graphic

Specified by:
getBounds in interface IGraphic
Returns:
See Also:
IGraphic.getBounds()

getContainer

public IContainer getContainer()
Specified by:
getContainer in interface IGraphic
Returns:
See Also:
IGraphic.getContainer()

getMouseListeners

public Collection<MouseListener> getMouseListeners()
Description copied from interface: IGraphic
Returns all the java.awt.event.MouseListeners of this graphic

Specified by:
getMouseListeners in interface IGraphic
Returns:
See Also:
IGraphic.getMouseListeners()

getMouseMotionListeners

public Collection<MouseMotionListener> getMouseMotionListeners()
Description copied from interface: IGraphic
Returns all the java.awt.event.MouseMotionListeners of this graphic

Specified by:
getMouseMotionListeners in interface IGraphic
Returns:
See Also:
IGraphic.getMouseMotionListeners()

getShape

public Shape getShape()
Description copied from interface: IGraphic
Should return a java.awt.Shape representation of this graphic. The shape is used as a delegate for the methods: contains, intersects, etc.

Specified by:
getShape in interface IGraphic
Returns:
See Also:
IGraphic.getShape()

intersects

public boolean intersects(IGraphic shape)
Description copied from interface: IGraphic
In Beta Testing Tests to see if two Graphics intersect with each other.

Specified by:
intersects in interface IGraphic
Parameters:
shape -
Returns:
See Also:
IGraphic.intersects(graphics.IGraphic)

paint

public void paint(Graphics2D gs)
Description copied from interface: IGraphic
This method uses the Graphics2D object to paint itself onto its container

Specified by:
paint in interface IGraphic
Parameters:
gs -
See Also:
IGraphic.paint(java.awt.Graphics2D)

setContainer

public void setContainer(IContainer container)
Description copied from interface: IGraphic
This sets the container of this graphic

Specified by:
setContainer in interface IGraphic
Parameters:
container -
See Also:
IGraphic.setContainer(graphics.IContainer)

setMovement

public void setMovement(IGraphicMovement movement)
Description copied from interface: IGraphic
Sets the movement of the Graphic. A movement should be a definition of how this will react to the move() method.

Specified by:
setMovement in interface IGraphic
Parameters:
movement -
See Also:
IGraphic.setMovement(graphics.movement.IGraphicMovement)

getDimension

public Dimension getDimension()
Description copied from interface: ISizeable
Gets the Dimension of this Object

Specified by:
getDimension in interface ISizeable
Returns:
See Also:
ISizeable.getDimension()

setDimension

public void setDimension(Dimension d)
Description copied from interface: ISizeable
Sets the Dimension of this Object

Specified by:
setDimension in interface ISizeable
Parameters:
d -
See Also:
ISizeable.setDimension(java.awt.Dimension)

getCenterLocation

public Point getCenterLocation()
Description copied from interface: CenterLocatable
Finds the center location of this Object

Specified by:
getCenterLocation in interface CenterLocatable
Returns:
See Also:
CenterLocatable.getCenterLocation()

setCenterLocation

public void setCenterLocation(Point p)
Description copied from interface: CenterLocatable
Sets the location of this graphic by putting the center of the Object at the specified point

Specified by:
setCenterLocation in interface CenterLocatable
Parameters:
p -
See Also:
CenterLocatable.setCenterLocation(java.awt.Point)

getLocation

public Point getLocation()
Description copied from interface: ILocatable
Gets the location of this Object

Specified by:
getLocation in interface ILocatable
Returns:
See Also:
ILocatable.getLocation()

move

public Vector move(Vector v)
Description copied from interface: ILocatable
Moves the Object from one location to another by a specific vector

Specified by:
move in interface ILocatable
Parameters:
v -
Returns:
See Also:
ILocatable.move(utilities.Vector)

setLocation

public void setLocation(Point p)
Description copied from interface: ILocatable
Sets the Location of this Object to be the specified point

Specified by:
setLocation in interface ILocatable
Parameters:
p -
See Also:
ILocatable.setLocation(java.awt.Point)

getRotation

public Integer getRotation()
Description copied from interface: IRotatable
Gets the current rotation of this Object in degrees.

Specified by:
getRotation in interface IRotatable
Returns:
See Also:
IRotatable.getRotation()

rotate

public void rotate(Integer degreesToRotate)
Description copied from interface: IRotatable
Rotates clockwise the Object by the specified number of degrees

Specified by:
rotate in interface IRotatable
Parameters:
degreesToRotate -
See Also:
IRotatable.rotate(java.lang.Integer)

setRotation

public void setRotation(Integer degree)
Description copied from interface: IRotatable
Sets the Rotation of the Object to be a certain degree.

Specified by:
setRotation in interface IRotatable
Parameters:
degree -
See Also:
IRotatable.setRotation(java.lang.Integer)