com.jfimagine.jfgraph.shape.decorate
Class FontFormat

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

public class FontFormat
extends AbstractObject

Font format class. All fonts or curves or circlles should use this class for their fonts format.

Version:
$Revision: 1.1 $
Author:
CookieMaker

Field Summary
static java.lang.String FONTNAME_DEFAULT
          A default font name
static int FONTSIZE_DEFAULT
          A default font size
static java.lang.String XML_FONTCOLOR
          A XML string tag represents a font's color
static java.lang.String XML_FONTFORMAT
          A XML string tag represents a font format.
static java.lang.String XML_FONTNAME
          A XML string tag represents a font's name
static java.lang.String XML_FONTSIZE
          A XML string tag represents the font size
static java.lang.String XML_FONTSTYLE
          A XML string tag represents the font style
 
Fields inherited from class com.jfimagine.jfgraph.shape.base.AbstractObject
m_lastError, XML_OBJECTID, XML_OBJECTTYPE
 
Constructor Summary
FontFormat()
          Constructor for FontFormat
 
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.
 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 FontFormat getDefaultFontFormat()
          get global default font format
 java.awt.Font getFont()
          Get current font object.
 java.awt.Color getFontColor()
          Get current font color.
 java.lang.String getFontName()
          Get current font name.
 int getFontSize()
          Get current font size.
 int getFontStyle()
          Get current font style.
 java.awt.Font getZoomedFont()
          Get a zoomed font of current font.
 int hashCode()
          Returns the hashcode for this Object.
 void initFont()
          Initialize the font object.
 boolean isBold()
          Indicates whether or not this Font object's style is BOLD.
 boolean isBoldItalic()
          Indicates whether or not this Font object's style is both BOLD and ITALIC.
 boolean isItalic()
          Indicates whether or not this Font object's style is ITALIC.
 boolean isPlain()
          Indicates whether or not this Font object's style is PLAIN.
 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 setDefaultFontFormat(FontFormat fontFormat)
          set global default font format
 void setFont(java.awt.Font fontObj)
          Set current font object.
 void setFontColor(java.awt.Color fontColor)
          Set current font color.
 void setFontName(java.lang.String fontName)
          Set current font name.
 void setFontSize(int fontSize)
          Set current font size.
 void setFontStyle(int fontStyle)
          Set current font style.
 void setValue(FontFormat fontFormat)
          Set current font object.
 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_FONTFORMAT

public static final java.lang.String XML_FONTFORMAT
A XML string tag represents a font format.

See Also:
Constant Field Values

XML_FONTSTYLE

public static final java.lang.String XML_FONTSTYLE
A XML string tag represents the font style

See Also:
Constant Field Values

XML_FONTSIZE

public static final java.lang.String XML_FONTSIZE
A XML string tag represents the font size

See Also:
Constant Field Values

XML_FONTNAME

public static final java.lang.String XML_FONTNAME
A XML string tag represents a font's name

See Also:
Constant Field Values

XML_FONTCOLOR

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

See Also:
Constant Field Values

FONTNAME_DEFAULT

public static final java.lang.String FONTNAME_DEFAULT
A default font name


FONTSIZE_DEFAULT

public static final int FONTSIZE_DEFAULT
A default font size

See Also:
Constant Field Values
Constructor Detail

FontFormat

public FontFormat()
Constructor for FontFormat

Method Detail

setDefaultFontFormat

public static void setDefaultFontFormat(FontFormat fontFormat)
set global default font format

Parameters:
fontFormat - A new font format

getDefaultFontFormat

public static FontFormat getDefaultFontFormat()
get global default font format

Returns:
The global default font format

clearFormat

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


getFontStyle

public int getFontStyle()
Get current font style.

Returns:
The font style.

setFontStyle

public void setFontStyle(int fontStyle)
Set current font style.

Parameters:
fontStyle - A new font style.

getFontSize

public int getFontSize()
Get current font size.

Returns:
The font size.

setFontSize

public void setFontSize(int fontSize)
Set current font size.

Parameters:
fontSize - A new font size.

getFontName

public java.lang.String getFontName()
Get current font name.

Returns:
The font name.

setFontName

public void setFontName(java.lang.String fontName)
Set current font name.

Parameters:
fontName - A new font name.

getFontColor

public java.awt.Color getFontColor()
Get current font color.

Returns:
The font color.

setFontColor

public void setFontColor(java.awt.Color fontColor)
Set current font color.

Parameters:
fontColor - A new font color.

getFont

public java.awt.Font getFont()
Get current font object.

Returns:
The font object.

getZoomedFont

public java.awt.Font getZoomedFont()
Get a zoomed font of current font.

Returns:
A new zoomed font of current font.

isPlain

public boolean isPlain()
Indicates whether or not this Font object's style is PLAIN.

Returns:
true if this Font object's style is PLAIN; false otherwise.

isBold

public boolean isBold()
Indicates whether or not this Font object's style is BOLD.

Returns:
true if this Font object's style is BOLD; false otherwise.

isItalic

public boolean isItalic()
Indicates whether or not this Font object's style is ITALIC.

Returns:
true if this Font object's style is ITALIC; false otherwise.

isBoldItalic

public boolean isBoldItalic()
Indicates whether or not this Font object's style is both BOLD and ITALIC.

Returns:
true if this Font object's style is both BOLD and ITALIC; false otherwise.

setFont

public void setFont(java.awt.Font fontObj)
Set current font object.

Parameters:
fontObj - A new font object.

setValue

public void setValue(FontFormat fontFormat)
Set current font object.

Parameters:
fontFormat - a new font format object.

initFont

public void initFont()
Initialize the font object.


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.