com.jfimagine.jfgraph.shape.decorate
Class LineFormat

java.lang.Object
  |
  +--com.jfimagine.jfgraph.shape.base.AbstractObject
        |
        +--com.jfimagine.jfgraph.shape.decorate.LineFormat
All Implemented Interfaces:
java.lang.Cloneable

public class LineFormat
extends AbstractObject

Line format class. All lines or curves or circlles should use this class for their lines format.

Version:
$Revision: 1.1 $
Author:
CookieMaker

Field Summary
static int LINESTYLE_DASH
          A const value represent DASH line style.
static int LINESTYLE_DASHDOT
          A const value represent DASH DOT line style.
static int LINESTYLE_DASHDOTDOT
          A const value represent DASH DOT DOT line style.
static int LINESTYLE_DOT
          A const value represent DOT line style.
static int LINESTYLE_SOLID
          A const value represent SOLID line style.
static java.lang.String XML_LINECOLOR
          A XML string tag represents a line's color
static java.lang.String XML_LINEFORMAT
          A XML string tag represents a line format.
static java.lang.String XML_LINESTYLE
          A XML string tag represents the line style
static java.lang.String XML_LINEWIDTH
          A XML string tag represents a line's width
 
Fields inherited from class com.jfimagine.jfgraph.shape.base.AbstractObject
m_lastError, XML_OBJECTID, XML_OBJECTTYPE
 
Constructor Summary
LineFormat()
          Constructor for LineFormat
 
Method Summary
protected  void appendChildToDOM(Element element, JFVersion version)
          Append necessary xml child for current element, this method will be called internally by toDOM.
 void clearFormat()
          clear format, then set to default values
 java.lang.Object clone()
          Creates a new object of the same class and with the same contents as this object.
protected  AbstractObject cloneMe()
          Creates a new AbstractObject of the same class and with the same contents as this object.
 void draw(java.awt.Graphics g, java.awt.geom.GeneralPath path)
          Draw a path on specified graphics context.
 boolean equals(java.lang.Object obj)
          Determines whether or not two objects are equal.
protected  void extractChildFromDOM(Element element, JFVersion version)
          Extract needed xml child from current element, this method will be called internally by fromDOM.
static LineFormat getDefaultLineFormat()
          get global default line format
static LineFormat getInvisibleLineFormat()
          get an invisible bounds line format for invisibled shapes.
 java.awt.Color getLineColor()
          Get current line color.
 int getLineStyle()
          Get current line style.
 int getLineWidth()
          Get current line width.
 int hashCode()
          Returns the hashcode for this Object.
static void initGraphics(java.awt.Graphics g)
          Set graphics to a default configuration.
 void loadFromStream(JFReader stream, boolean skipHead, JFVersion version)
          Load object data from a binary stream
 void saveToStream(JFWriter stream, JFVersion version)
          Save this object to a binary stream
static void setDefaultLineFormat(LineFormat lineFormat)
          set global default line format
 void setGraphics(java.awt.Graphics g)
          Set graphics according to current line format.
static void setGraphics(java.awt.Graphics g, int lineWidth, int lineStyle, java.awt.Color lineColor)
          Set graphics according to specified line format.
 void setLineColor(java.awt.Color lineColor)
          Set current line color.
 void setLineStyle(int lineStyle)
          Set current line style.
 void setLineWidth(int lineWidth)
          Set current line width.
 void setValue(LineFormat lineFormat)
          Set new value for this lineFormat.
 java.lang.String toString()
          Convert this object to String
 
Methods inherited from class com.jfimagine.jfgraph.shape.base.AbstractObject
fromDOM, getLastError, getMaxObjectId, getObjectId, getObjectType, getXMLTag, getZoomScale, isShowDesign, setLastError, setObjectId, setObjectType, setShowDesign, setValue, setXMLTag, setZoomScale, toDOM
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

XML_LINEFORMAT

public static final java.lang.String XML_LINEFORMAT
A XML string tag represents a line format.

See Also:
Constant Field Values

XML_LINESTYLE

public static final java.lang.String XML_LINESTYLE
A XML string tag represents the line style

See Also:
Constant Field Values

XML_LINEWIDTH

public static final java.lang.String XML_LINEWIDTH
A XML string tag represents a line's width

See Also:
Constant Field Values

XML_LINECOLOR

public static final java.lang.String XML_LINECOLOR
A XML string tag represents a line's color

See Also:
Constant Field Values

LINESTYLE_SOLID

public static final int LINESTYLE_SOLID
A const value represent SOLID line style.

See Also:
Constant Field Values

LINESTYLE_DOT

public static final int LINESTYLE_DOT
A const value represent DOT line style.

See Also:
Constant Field Values

LINESTYLE_DASH

public static final int LINESTYLE_DASH
A const value represent DASH line style.

See Also:
Constant Field Values

LINESTYLE_DASHDOT

public static final int LINESTYLE_DASHDOT
A const value represent DASH DOT line style.

See Also:
Constant Field Values

LINESTYLE_DASHDOTDOT

public static final int LINESTYLE_DASHDOTDOT
A const value represent DASH DOT DOT line style.

See Also:
Constant Field Values
Constructor Detail

LineFormat

public LineFormat()
Constructor for LineFormat

Method Detail

setDefaultLineFormat

public static void setDefaultLineFormat(LineFormat lineFormat)
set global default line format

Parameters:
lineFormat - A new line format

getDefaultLineFormat

public static LineFormat getDefaultLineFormat()
get global default line format

Returns:
The global default line format

getInvisibleLineFormat

public static LineFormat getInvisibleLineFormat()
get an invisible bounds line format for invisibled shapes.

Returns:
A new invisible line format.

clearFormat

public void clearFormat()
clear format, then set to default values


getLineStyle

public int getLineStyle()
Get current line style.

Returns:
The line style.

setLineStyle

public void setLineStyle(int lineStyle)
Set current line style.

Parameters:
lineStyle - A new line style.

getLineWidth

public int getLineWidth()
Get current line width.

Returns:
The line width.

setLineWidth

public void setLineWidth(int lineWidth)
Set current line width.

Parameters:
lineWidth - A new line width.

getLineColor

public java.awt.Color getLineColor()
Get current line color.

Returns:
The line color.

setLineColor

public void setLineColor(java.awt.Color lineColor)
Set current line color.

Parameters:
lineColor - A new line color.

setValue

public void setValue(LineFormat lineFormat)
Set new value for this lineFormat.

Parameters:
lineFormat - A new line format.

draw

public void draw(java.awt.Graphics g,
                 java.awt.geom.GeneralPath path)
Draw a path on specified graphics context.

Parameters:
g - A specified graphics
path - A general path.

initGraphics

public static void initGraphics(java.awt.Graphics g)
Set graphics to a default configuration.


setGraphics

public void setGraphics(java.awt.Graphics g)
Set graphics according to current line format.


setGraphics

public static void setGraphics(java.awt.Graphics g,
                               int lineWidth,
                               int lineStyle,
                               java.awt.Color lineColor)
Set graphics according to specified line format.

Parameters:
lineWidth - the line width to be drawn.
lineStyle - the line style
lineColor - the line color

toString

public java.lang.String toString()
Convert this object to String

Overrides:
toString in class AbstractObject
Returns:
An string represents the content of the object

cloneMe

protected AbstractObject cloneMe()
                          throws java.lang.CloneNotSupportedException
Creates a new AbstractObject of the same class and with the same contents as this object. This method implements the method defined in AbstractObject.

Specified by:
cloneMe in class AbstractObject
Returns:
A clone of this class.
java.lang.CloneNotSupportedException

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates a new object of the same class and with the same contents as this object.

Overrides:
clone in class AbstractObject
Returns:
A clone of this instance.
java.lang.CloneNotSupportedException

hashCode

public int hashCode()
Returns the hashcode for this Object.

Overrides:
hashCode in class AbstractObject
Returns:
hash code for this Point2D.

equals

public boolean equals(java.lang.Object obj)
Determines whether or not two objects are equal.

Overrides:
equals in class AbstractObject
Parameters:
obj - an object to be compared with this object
Returns:
true if the object to be compared is an instance of Port and has the same values; false otherwise.

appendChildToDOM

protected void appendChildToDOM(Element element,
                                JFVersion version)
Append necessary xml child for current element, this method will be called internally by toDOM.

Overrides:
appendChildToDOM in class AbstractObject
Parameters:
element - A XML element to append child xml nodes
version - A file version notification so this object can obey the rules to save data.

extractChildFromDOM

protected void extractChildFromDOM(Element element,
                                   JFVersion version)
Extract needed xml child from current element, this method will be called internally by fromDOM.

Overrides:
extractChildFromDOM in class AbstractObject
Parameters:
element - An element used to extract needed xml child
version - A file version notification so this object can obey the rules to fetch data.

saveToStream

public void saveToStream(JFWriter stream,
                         JFVersion version)
                  throws java.io.IOException
Save this object to a binary stream

Overrides:
saveToStream in class AbstractObject
Parameters:
stream - An binary output stream
version - A file version notification so this object can obey the rules to save data.
Throws:
java.io.IOException

loadFromStream

public void loadFromStream(JFReader stream,
                           boolean skipHead,
                           JFVersion version)
                    throws java.io.IOException
Load object data from a binary stream

Overrides:
loadFromStream in class AbstractObject
Parameters:
stream - An binary input stream
skipHead - Skip head 'TYPE' check, an shape object should always has its own shape-type stored, if this shape-type has already been readed, this loadFromStream should/could not read the type anymore.
version - A file version notification so this object can obey the rules to fetch data.
Throws:
java.io.IOException


Copyright 2004 ~ 2005 JingFei International Cooperation LTD. All Rights Reserved.