org.odftoolkit.simple.style
Class Border

java.lang.Object
  extended by org.odftoolkit.simple.style.Border

public class Border
extends Object

This class represents border style settings, including line style, color, width, inner line width, outer line width and the distance.

Since:
0.3

Field Summary
static Border NONE
          A static variable to represent a border without any lines, which means no border at all.
 
Constructor Summary
protected Border()
          Constructor to create an empty border
  Border(Color aColor, double width, double innerLineWidth, double outerLineWidth, StyleTypeDefinitions.SupportedLinearMeasure linearMeasure)
          Constructor to create a double line border
  Border(Color aColor, double width, StyleTypeDefinitions.SupportedLinearMeasure linearMeasure)
          Constructor to create a single line border
 
Method Summary
protected  Border changeLineMeasure(StyleTypeDefinitions.SupportedLinearMeasure newLineMeasure)
          Return a border which is same but with a different line measurement
 boolean equals(Object o)
           
protected  String getBorderDescription()
          Return the description string of border style.
 Color getColor()
          Return the color of this border
 double getDistance()
          Return the distance between inner line and outer line of border with double lines
protected  String getDoubleLineWidthDescription()
          Return a description string for border widths with double lines.
 double getInnerLineWidth()
          Return the inner line width of border with double lines
 StyleTypeDefinitions.SupportedLinearMeasure getLinearMeasure()
          Return the linear measurement
 StyleTypeDefinitions.LineType getLineStyle()
          Return the line style of the border.
 double getOuterLineWidth()
          Return the outer line width of border with double lines
 double getWidth()
          Return the width of this border
protected  void setBorderByDescription(String borderDesc)
          Set border style by a description string.
 void setColor(Color color)
          Set the color of this border
 void setDistance(double distance)
          Set the distance between inner line and outer line of border with double lines.
protected  void setDoubleLineWidthByDescription(String widthDesc)
          Set the border widths with double lines by a description string.
 void setInnerLineWidth(double innerWidth)
          Set the inner line width of border with double lines If the line style is not double, nothing will happen.
 void setLinearMeasure(StyleTypeDefinitions.SupportedLinearMeasure linearMeasure)
          Set linear measurement
 void setLineStyle(StyleTypeDefinitions.LineType lineStyle)
          Set the line style of the border.
 void setOuterLineWidth(double lineWidth)
          Set the outer line width of border with double lines If the line style is not double, nothing will happen.
 void setWidth(double width)
          Set the width of this border
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static Border NONE
A static variable to represent a border without any lines, which means no border at all.

Constructor Detail

Border

protected Border()
Constructor to create an empty border


Border

public Border(Color aColor,
              double width,
              StyleTypeDefinitions.SupportedLinearMeasure linearMeasure)
Constructor to create a single line border

Parameters:
aColor - - the color of the border
width - - the line width of the border
linearMeasure - - the linear measurement of the border width

Border

public Border(Color aColor,
              double width,
              double innerLineWidth,
              double outerLineWidth,
              StyleTypeDefinitions.SupportedLinearMeasure linearMeasure)
Constructor to create a double line border

Parameters:
aColor - - the color of the border
width - - the line width of the border
innerLineWidth - - the inner line width of the border
outerLineWidth - - the outer line width of the border
linearMeasure - - the linear measurement of the border width
Throws:
IllegalArgumentException - if the width is not bigger than the sum of inner line width and outer line width.
Method Detail

getLineStyle

public StyleTypeDefinitions.LineType getLineStyle()
Return the line style of the border.

The possible return value are "SINGLE","DOUBLE", and "NONE";

Returns:
the line style of the border.

setLineStyle

public void setLineStyle(StyleTypeDefinitions.LineType lineStyle)
Set the line style of the border.

The valid parameter can be "SINGLE","DOUBLE", and "NONE";

Parameters:
lineStyle - - the line style of the border.

setBorderByDescription

protected void setBorderByDescription(String borderDesc)
Set border style by a description string. The description string includes border width, line style and color. For example: "0.0362in double #ff3333" is a valid description string.

Parameters:
borderDesc - - the description of border style

getBorderDescription

protected String getBorderDescription()
Return the description string of border style. The description string includes border width, line style and color. For example, "0.0362in double #ff3333".

Returns:
the description string of border style

getColor

public Color getColor()
Return the color of this border

Returns:
the color of this border

setColor

public void setColor(Color color)
Set the color of this border

Parameters:
color - - the color

getWidth

public double getWidth()
Return the width of this border

Returns:
the width of this border

setWidth

public void setWidth(double width)
Set the width of this border

Parameters:
width - - the width of this border

getDoubleLineWidthDescription

protected String getDoubleLineWidthDescription()
Return a description string for border widths with double lines. The description string includes inner line width, distance, and outline width. For example, "0.0008in 0.0346in 0.0346in".

Returns:
- the description for border widths with double lines

setDoubleLineWidthByDescription

protected void setDoubleLineWidthByDescription(String widthDesc)
Set the border widths with double lines by a description string. The description string includes inner line width, distance, and outline width. For example, "0.0008in 0.0346in 0.0346in".

Parameters:
widthDesc - - the description string

getInnerLineWidth

public double getInnerLineWidth()
Return the inner line width of border with double lines

Returns:
- the inner line width

setInnerLineWidth

public void setInnerLineWidth(double innerWidth)
Set the inner line width of border with double lines If the line style is not double, nothing will happen.

Parameters:
innerWidth - - the inner line width

getDistance

public double getDistance()
Return the distance between inner line and outer line of border with double lines

Returns:
- the distance between inner line and outer line.

setDistance

public void setDistance(double distance)
Set the distance between inner line and outer line of border with double lines. If the line style is not double, nothing will happen.

Parameters:
distance - - the distance between inner line and outer line.

getOuterLineWidth

public double getOuterLineWidth()
Return the outer line width of border with double lines

Returns:
- the outer line width.

setOuterLineWidth

public void setOuterLineWidth(double lineWidth)
Set the outer line width of border with double lines If the line style is not double, nothing will happen.

Parameters:
lineWidth - - the outer line width

changeLineMeasure

protected Border changeLineMeasure(StyleTypeDefinitions.SupportedLinearMeasure newLineMeasure)
Return a border which is same but with a different line measurement

Parameters:
newLineMeasure - - the new measurement
Returns:
the new border

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

getLinearMeasure

public StyleTypeDefinitions.SupportedLinearMeasure getLinearMeasure()
Return the linear measurement

Returns:
the the linear measurement

setLinearMeasure

public void setLinearMeasure(StyleTypeDefinitions.SupportedLinearMeasure linearMeasure)
Set linear measurement

Parameters:
linearMeasure - the linear measurement


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.