sos.reports
Class DefaultFill

java.lang.Object
  |
  +--sos.reports.DefaultFill
All Implemented Interfaces:
Fill, java.io.Serializable

public class DefaultFill
extends java.lang.Object
implements Fill, java.io.Serializable

A default implementation of Fill.

Since:
1.0

Field Summary
 
Fields inherited from interface sos.reports.Fill
BLACK, BLUE, CYAN, DARK_GRAY, GRAY, GREEN, LIGHT_GRAY, MAGENTA, NONE, ORANGE, PINK, RED, WHITE, YELLOW
 
Constructor Summary
DefaultFill(java.awt.Color color)
          Creates a DefaultFill that paints the entire region with the specified color.
DefaultFill(java.awt.Color[] colors, double[] offsets, boolean[] absoluteOffsets, int direction)
          Create a DefaultFill representing a linear gradient through the specified colors at the specified offsets, in the specified direction.
DefaultFill(java.awt.Color startColor, java.awt.Color stopColor, int direction)
          Create a DefaultFill representing a linear gradient starting with startColor and ending with stopColor in the direction given by direction.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if this fill is equivalent to the specified object.
 java.awt.Color getColor(int index)
          Returns the fill color at the specified index.
 int getColorCount()
          Returns the number of colors this fill uses.
 int getDirection()
          Returns the direction of this fill.
 double getOffset(int index)
          Returns the offset at the specified index.
 int hashCode()
          Returns a hash code value for this fill.
 boolean isAbsolute(int index)
          Returns false if the offset at the specified index should be interpreted relative to the previous offset.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFill

public DefaultFill(java.awt.Color color)
Creates a DefaultFill that paints the entire region with the specified color.

Parameters:
color - color to paint the region
Throws:
java.lang.NullPointerException - if color is null

DefaultFill

public DefaultFill(java.awt.Color startColor,
                   java.awt.Color stopColor,
                   int direction)
Create a DefaultFill representing a linear gradient starting with startColor and ending with stopColor in the direction given by direction.

Parameters:
startColor - starting color
stopColor - ending color
direction - the direction of the fill
Throws:
java.lang.IllegalArgumentException - if direction is not one of SwingConstants.EAST, SwingConstants.SOUTH, SwingConstants.SOUTH_EAST, SwingConstants.NORTH_EAST
java.lang.NullPointerException - if startColor or stopColor is null

DefaultFill

public DefaultFill(java.awt.Color[] colors,
                   double[] offsets,
                   boolean[] absoluteOffsets,
                   int direction)
Create a DefaultFill representing a linear gradient through the specified colors at the specified offsets, in the specified direction.

Parameters:
colors - the fill's colors
offsets - the starting positions of the fill's colors
absoluteOffsets - false for index i if offsets[i] should be treated as relative to the previous offset
direction - the direction of the fill
Throws:
java.lang.IllegalArgumentException - if direction is not one of SwingConstants.EAST, SwingConstants.SOUTH, SwingConstants.SOUTH_EAST, SwingConstants.NORTH_EAST, or if the arrays are not the same length
java.lang.NullPointerException - if colors, offsets, or any element of colors is null
Method Detail

equals

public boolean equals(java.lang.Object obj)
Returns true if this fill is equivalent to the specified object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - object to test for equivalence
Returns:
true if this fill equals obj

getColorCount

public int getColorCount()
Description copied from interface: Fill
Returns the number of colors this fill uses.

Specified by:
getColorCount in interface Fill
Returns:
the number of fill colors

getDirection

public int getDirection()
Description copied from interface: Fill
Returns the direction of this fill.

Specified by:
getDirection in interface Fill
Returns:
this fill's direction (one of SwingConstants.EAST, SwingConstants.SOUTH, SwingConstants.SOUTH_EAST, and SwingConstants.NORTH_EAST)

getColor

public java.awt.Color getColor(int index)
Description copied from interface: Fill
Returns the fill color at the specified index.

Specified by:
getColor in interface Fill
Parameters:
index - index of the color to retrieve
Returns:
this fill's color at index

getOffset

public double getOffset(int index)
Description copied from interface: Fill
Returns the offset at the specified index.

Specified by:
getOffset in interface Fill
Parameters:
index - index of the offset to retrieve
Returns:
this fill's offset at index

hashCode

public int hashCode()
Returns a hash code value for this fill.

Overrides:
hashCode in class java.lang.Object
Returns:
this fill's hash code

isAbsolute

public boolean isAbsolute(int index)
Description copied from interface: Fill
Returns false if the offset at the specified index should be interpreted relative to the previous offset.

Specified by:
isAbsolute in interface Fill
Parameters:
index - index of the offset in consideration
Returns:
true if the offset at index is a percentage of the entire fill area


Copyright 2003, 2004 Side of Software (SOS). All rights reserved.