jimm.datavision.field
Class BorderEdge

java.lang.Object
  extended by java.util.Observable
      extended by jimm.datavision.field.BorderEdge
All Implemented Interfaces:
java.lang.Cloneable

public class BorderEdge
extends java.util.Observable
implements java.lang.Cloneable

A border edge represents one of the four edges of a Border. It has its own line style, thickness, and number of lines.

Note: line thickness is currently ignored.

Author:
Jim Menard, jimm@io.com

Field Summary
static int DEFAULT_NUMBER
           
static int DEFAULT_STYLE
           
static double DEFAULT_THICKNESS
           
protected  int number
           
protected  int style
           
static int STYLE_DASH
          Draw dashed lines.
static int STYLE_DOT
          Draw dotted lines.
static int STYLE_LINE
          Draw simple lines.
protected  double thickness
           
 
Constructor Summary
BorderEdge()
          Creates a new edge with DEFAULT_NUMBER lines of DEFAULT_STYLE and DEFAULT_THICKNESS.
BorderEdge(int style)
          Creates a new edge with DEFAULT_NUMBER lines of the specified style and DEFAULT_THICKNESS.
BorderEdge(int style, double thickness)
          Creates a new edge with DEFAULT_NUMBER lines of the specified style and thickness.
BorderEdge(int style, double thickness, int number)
          Creates a new edge with number lines of the specified style and thickness.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this border.
 boolean equals(java.lang.Object obj)
           
 int getNumber()
          Returns the number of lines to draw along this border edge.
 int getStyle()
          Returns the edge's style.
 double getThickness()
          Returns the edge's thickness.
 int hashCode()
           
 void setNumber(int newNumber)
          Sets the number of lines to draw along this border edge.
 void setStyle(int newStyle)
          Sets the edge's style.
 void setThickness(double newThickness)
          Sets the edge's thickness.
static int styleFromString(java.lang.String styleStr)
          Returns the integer style constant associated with the specified string.
 java.lang.String toString()
           
 void writeXML(XMLWriter out, java.lang.String location)
          Writes this edge as an XML tag.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

STYLE_LINE

public static final int STYLE_LINE
Draw simple lines. This is the default style.

See Also:
Constant Field Values

STYLE_DASH

public static final int STYLE_DASH
Draw dashed lines.

See Also:
Constant Field Values

STYLE_DOT

public static final int STYLE_DOT
Draw dotted lines.

See Also:
Constant Field Values

DEFAULT_STYLE

public static final int DEFAULT_STYLE
See Also:
Constant Field Values

DEFAULT_NUMBER

public static final int DEFAULT_NUMBER
See Also:
Constant Field Values

DEFAULT_THICKNESS

public static final double DEFAULT_THICKNESS
See Also:
Constant Field Values

style

protected int style

thickness

protected double thickness

number

protected int number
Constructor Detail

BorderEdge

public BorderEdge()
Creates a new edge with DEFAULT_NUMBER lines of DEFAULT_STYLE and DEFAULT_THICKNESS.


BorderEdge

public BorderEdge(int style)
Creates a new edge with DEFAULT_NUMBER lines of the specified style and DEFAULT_THICKNESS.

Parameters:
style - one of the STYLE_ constants

BorderEdge

public BorderEdge(int style,
                  double thickness)
Creates a new edge with DEFAULT_NUMBER lines of the specified style and thickness.

Parameters:
style - one of the STYLE_ constants
thickness - line thickness

BorderEdge

public BorderEdge(int style,
                  double thickness,
                  int number)
Creates a new edge with number lines of the specified style and thickness.

Parameters:
style - one of the STYLE_ constants
thickness - line thickness
number - the number of liens to draw
Method Detail

styleFromString

public static int styleFromString(java.lang.String styleStr)
Returns the integer style constant associated with the specified string. The string must be null, "none", "line", "dash", or "dot" and comes from the XML files that describe reports. If the string is null, then we return the default value of STYLE_LINE;

Parameters:
styleStr - one of null, "none", "line", "dash", or "dot"
Returns:
one of the STYLE_* constants; STYLE_LINE is returned if styleStr is null

clone

public java.lang.Object clone()
Returns a clone of this border. All edges are cloned as well.

Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getStyle

public int getStyle()
Returns the edge's style.

Returns:
one of the STYLE_ constants

setStyle

public void setStyle(int newStyle)
Sets the edge's style.

Parameters:
newStyle - one of the STYLE_ constants

getThickness

public double getThickness()
Returns the edge's thickness.

Returns:
the thickness

setThickness

public void setThickness(double newThickness)
Sets the edge's thickness.

Parameters:
newThickness - line thickness

getNumber

public int getNumber()
Returns the number of lines to draw along this border edge.

Returns:
the number of lines to draw along this border edge

setNumber

public void setNumber(int newNumber)
Sets the number of lines to draw along this border edge.

Parameters:
newNumber - the number of lines to draw

writeXML

public void writeXML(XMLWriter out,
                     java.lang.String location)
Writes this edge as an XML tag.

Parameters:
out - a writer that knows how to write XML
location - from the border; the string "top", "bottom", "left", or "right"

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object