com.jfimagine.jfgraph.shape.decorate
Class CanvasFormat

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

public class CanvasFormat
extends AbstractObject

Canvas format used to assign a canvas' drawing area.

Version:
$Revision: 1.1 $
Author:
CookieMaker

Field Summary
static int CANVASSIZE_DEFAULT_CM
          default canvas width in centimeters
static int CANVASSIZE_DEFAULT_INCH
          default canvas width in inches
static int CANVASSIZE_DEFAULT_UNIT
          default canvas width unit : inch
static int CANVASSIZE_MAXIMUM
          maximum canvas width in inch or centimeter
static int CANVASSIZE_MINIMUM
          minimum canvas width in inch or centimeter
static java.lang.String XML_CANVASFORMAT
          A XML string tag represents a canvas format.
static java.lang.String XML_HEIGHT
          A XML string tag represents the canvas height
static java.lang.String XML_HEIGHTUNIT
          A XML string tag represents the unit of canvas height
static java.lang.String XML_WIDTH
          A XML string tag represents the canvas width.
static java.lang.String XML_WIDTHUNIT
          A XML string tag represents the unit of canvas width.
 
Fields inherited from class com.jfimagine.jfgraph.shape.base.AbstractObject
m_lastError, XML_OBJECTID, XML_OBJECTTYPE
 
Constructor Summary
CanvasFormat()
          Constructor for CanvasFormat
 
Method Summary
protected  void appendChildToDOM(Element element, JFVersion version)
          Append necessary xml child for current element, this method will be called internally by toDOM.
 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.
 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 CanvasFormat getDefaultCanvasFormat()
          get global default canvas format
 double getHeight()
           
 int getHeightUnit()
           
 double getScreenHeight()
          canvas height in pixels.
 double getScreenWidth()
          canvas width in pixels.
 double getWidth()
           
 int getWidthUnit()
           
 int hashCode()
          Returns the hashcode for this Object.
 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 setDefaultCanvasFormat(CanvasFormat canvasFormat)
          set global default canvas format
 void setHeight(double height)
           
 void setHeightUnit(int heightUnit)
           
 void setIsMetric(boolean isMetric)
           
 void setValue(CanvasFormat canvasFormat)
          Set new value for this canvasFormat.
 void setWidth(double width)
           
 void setWidthUnit(int widthUnit)
           
 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_CANVASFORMAT

public static final java.lang.String XML_CANVASFORMAT
A XML string tag represents a canvas format.

See Also:
Constant Field Values

XML_WIDTH

public static final java.lang.String XML_WIDTH
A XML string tag represents the canvas width.

See Also:
Constant Field Values

XML_WIDTHUNIT

public static final java.lang.String XML_WIDTHUNIT
A XML string tag represents the unit of canvas width.

See Also:
Constant Field Values

XML_HEIGHT

public static final java.lang.String XML_HEIGHT
A XML string tag represents the canvas height

See Also:
Constant Field Values

XML_HEIGHTUNIT

public static final java.lang.String XML_HEIGHTUNIT
A XML string tag represents the unit of canvas height

See Also:
Constant Field Values

CANVASSIZE_DEFAULT_INCH

public static final int CANVASSIZE_DEFAULT_INCH
default canvas width in inches

See Also:
Constant Field Values

CANVASSIZE_DEFAULT_UNIT

public static final int CANVASSIZE_DEFAULT_UNIT
default canvas width unit : inch

See Also:
Constant Field Values

CANVASSIZE_DEFAULT_CM

public static final int CANVASSIZE_DEFAULT_CM
default canvas width in centimeters

See Also:
Constant Field Values

CANVASSIZE_MINIMUM

public static final int CANVASSIZE_MINIMUM
minimum canvas width in inch or centimeter

See Also:
Constant Field Values

CANVASSIZE_MAXIMUM

public static final int CANVASSIZE_MAXIMUM
maximum canvas width in inch or centimeter

See Also:
Constant Field Values
Constructor Detail

CanvasFormat

public CanvasFormat()
Constructor for CanvasFormat

Method Detail

setDefaultCanvasFormat

public static void setDefaultCanvasFormat(CanvasFormat canvasFormat)
set global default canvas format

Parameters:
canvasFormat - A new canvas format

getDefaultCanvasFormat

public static CanvasFormat getDefaultCanvasFormat()
get global default canvas format

Returns:
The global default canvas format

getWidth

public double getWidth()

setWidth

public void setWidth(double width)

getWidthUnit

public int getWidthUnit()

setWidthUnit

public void setWidthUnit(int widthUnit)

getScreenWidth

public double getScreenWidth()
canvas width in pixels.


getHeight

public double getHeight()

setHeight

public void setHeight(double height)

getHeightUnit

public int getHeightUnit()

setHeightUnit

public void setHeightUnit(int heightUnit)

getScreenHeight

public double getScreenHeight()
canvas height in pixels.


setIsMetric

public void setIsMetric(boolean isMetric)

setValue

public void setValue(CanvasFormat canvasFormat)
Set new value for this canvasFormat.

Parameters:
canvasFormat - A new canvas format.

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.