ballwar.model.paint
Class FixedColorDecoratorPaintStrategy

java.lang.Object
  extended by ballwar.model.paint.ADecoratorPaintStrategy
      extended by ballwar.model.paint.FixedColorDecoratorPaintStrategy
All Implemented Interfaces:
IPaintStrategy

public class FixedColorDecoratorPaintStrategy
extends ADecoratorPaintStrategy

Decorator paint strategy that decorates another IPaintStrategy and causes the painted color to always be a specified, fixed color. Useful when you want a shape that is a specific color and not the color of the host Ball, for example, the black colored eye on a fish. Note that this class only works in situations where paintXfrm is called, because if paint is called, the call is delegated to the decoree, which will then delegate to its own paintXfrm method, not this decorator's method. Thus, this class is best used when being composed with other paint strategies inside a MultiPaintStrategy.


Field Summary
(package private)  Color color
          The color that will be painted.
 
Fields inherited from interface ballwar.model.IPaintStrategy
NullObject
 
Constructor Summary
FixedColorDecoratorPaintStrategy(Color color, IPaintStrategy decoree)
          Constructor that
 
Method Summary
 void paintXfrm(Graphics g, Ball host, AffineTransform at)
          Default behavior is to simply delegate to the decoree's paintXfrm method
 
Methods inherited from class ballwar.model.paint.ADecoratorPaintStrategy
init, paint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

color

Color color
The color that will be painted.

Constructor Detail

FixedColorDecoratorPaintStrategy

public FixedColorDecoratorPaintStrategy(Color color,
                                        IPaintStrategy decoree)
Constructor that

Method Detail

paintXfrm

public void paintXfrm(Graphics g,
                      Ball host,
                      AffineTransform at)
Description copied from class: ADecoratorPaintStrategy
Default behavior is to simply delegate to the decoree's paintXfrm method

Specified by:
paintXfrm in interface IPaintStrategy
Overrides:
paintXfrm in class ADecoratorPaintStrategy
Parameters:
g - The graphics context which is passed to the decoree
host - The host Ball which is passed to the decoree.
at - The affine transform which is passed to the decoree.