com.jfimagine.jfgraph.shape.union
Class JFLayer

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

public class JFLayer
extends AbstractObject

JFLayer class. A layer is a cad layer, for multi-views of a cad graph design.

Version:
$Revision: 1.1 $
Author:
CookieMaker

Field Summary
static java.lang.String LAYER_NAME_DEFAULT
           
static java.lang.String XML_LAYER
          A XML string tag represents a Layer
static java.lang.String XML_NAME
          A XML string tag represents name of this layer.
static java.lang.String XML_VISIBLE
          A XML string tag represents if this layer is visible
 
Fields inherited from class com.jfimagine.jfgraph.shape.base.AbstractObject
m_lastError, XML_OBJECTID, XML_OBJECTTYPE
 
Constructor Summary
JFLayer()
          Constructor for Layer
 
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 attachRealPort()
          A loadFromStream method should only load an parentId-objectId list of ports attached, So here we use an attachRealPort to ACTUALLY attach some ports to the ports in list.
 void bringToFront(java.util.List objList)
          Send a sub-collection of this object list to front.
 void clearAccessTimes()
          Clear access times, Clear all objects access times.
 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, boolean isXorMode)
          Draw current object on graphic canvas.
 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.
 boolean finishLoadingImages(java.awt.Component canvas)
          for loading an image, we need to call this finish loading image method to completely create a new image.
 Rect getBounds()
          Get the bounds of this layer.
 java.lang.String getName()
          Get name of this layer.
 ObjectList getShapeList()
          Get the shape list.
 boolean getVisible()
          Get if this layer is visible or invisible.
 AbstractObject groupShapes(java.util.List objList, boolean showDesign)
          Group a selection to one JFGroup object.
 int hashCode()
          Returns the hashcode for this Object.
 void loadFromStream(JFReader stream, boolean skipHead, JFVersion version)
          Load object data from a binary stream
 AbstractObject pickBy(java.awt.Graphics g, JFPoint pnt)
          pick up shape object by a position point.
 ObjectList pickBy(java.awt.Graphics g, Rect rect)
          pick up shape object by a rectangle.
 Port portIntersects(JFPoint pnt, AbstractObject avoidParent)
          Get which port of current shape that intersects with point pnt.
 java.util.List portIntersectsList(JFPoint pnt)
          Get a ports list of alls hapes that intersects with point pnt.
 void saveToStream(JFWriter stream, JFVersion version)
          Save this object to a binary stream
 void sendToBack(java.util.List objList)
          Send a sub-collection of this object list to back.
 void setName(java.lang.String name)
          Set name of this layer.
 void setShowDesign(boolean showDesign)
          set if show or hide current object's design info
 void setVisible(boolean visible)
          Set if this layer is visible or invisible.
 void setZoomScale(double zoomScale)
          set zoom scale
 java.lang.String toString()
          Convert this object to String
 java.util.List ungroupShapes(java.util.List objList)
          Ungroup a selection to individual objects.
 
Methods inherited from class com.jfimagine.jfgraph.shape.base.AbstractObject
fromDOM, getLastError, getMaxObjectId, getObjectId, getObjectType, getXMLTag, getZoomScale, isShowDesign, setLastError, setObjectId, setObjectType, setValue, setXMLTag, toDOM
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LAYER_NAME_DEFAULT

public static final java.lang.String LAYER_NAME_DEFAULT

XML_LAYER

public static final java.lang.String XML_LAYER
A XML string tag represents a Layer

See Also:
Constant Field Values

XML_VISIBLE

public static final java.lang.String XML_VISIBLE
A XML string tag represents if this layer is visible

See Also:
Constant Field Values

XML_NAME

public static final java.lang.String XML_NAME
A XML string tag represents name of this layer.

See Also:
Constant Field Values
Constructor Detail

JFLayer

public JFLayer()
Constructor for Layer

Method Detail

getVisible

public boolean getVisible()
Get if this layer is visible or invisible.


setVisible

public void setVisible(boolean visible)
Set if this layer is visible or invisible.


getName

public java.lang.String getName()
Get name of this layer.


setName

public void setName(java.lang.String name)
Set name of this layer.


getShapeList

public ObjectList getShapeList()
Get the shape list.

Returns:
The shape list.

getBounds

public Rect getBounds()
Get the bounds of this layer.

Returns:
The bounds rectangle.

draw

public void draw(java.awt.Graphics g,
                 boolean isXorMode)
Draw current object on graphic canvas.

Parameters:
g - A graphic canvas.
isXorMode - If is in xor mode now.

setShowDesign

public void setShowDesign(boolean showDesign)
set if show or hide current object's design info

Overrides:
setShowDesign in class AbstractObject

pickBy

public AbstractObject pickBy(java.awt.Graphics g,
                             JFPoint pnt)
pick up shape object by a position point.

Parameters:
g - A graphics context used to pick some graphics sensitive shapes(e.g. label)
pnt - A JFPoint that intersect or contained in an AbstractObject.

pickBy

public ObjectList pickBy(java.awt.Graphics g,
                         Rect rect)
pick up shape object by a rectangle.

Parameters:
g - A graphics context used to pick some graphics sensitive shapes(e.g. label)
rect - A Rect that intersects or contains one or move AbstractObjects.

portIntersects

public Port portIntersects(JFPoint pnt,
                           AbstractObject avoidParent)
Get which port of current shape that intersects with point pnt.

Parameters:
pnt - A JFPoint used to test intersection.
avoidParent - A specified avoided parent to avoid connected to self.
Returns:
A port of current shape.

portIntersectsList

public java.util.List portIntersectsList(JFPoint pnt)
Get a ports list of alls hapes that intersects with point pnt.

Parameters:
pnt - A JFPoint used to test intersection.
Returns:
A port list.

clearAccessTimes

public void clearAccessTimes()
Clear access times, Clear all objects access times.


setZoomScale

public void setZoomScale(double zoomScale)
set zoom scale

Overrides:
setZoomScale in class AbstractObject
Parameters:
zoomScale - A new zoom scale.

groupShapes

public AbstractObject groupShapes(java.util.List objList,
                                  boolean showDesign)
Group a selection to one JFGroup object.

Parameters:
objList - a sub collection of this object list.
Returns:
A group object.

ungroupShapes

public java.util.List ungroupShapes(java.util.List objList)
Ungroup a selection to individual objects.

Parameters:
objList - a collection of grouped objects.
Returns:
An individual objects list.

sendToBack

public void sendToBack(java.util.List objList)
Send a sub-collection of this object list to back.


bringToFront

public void bringToFront(java.util.List objList)
Send a sub-collection of this object list to front.


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

finishLoadingImages

public boolean finishLoadingImages(java.awt.Component canvas)
for loading an image, we need to call this finish loading image method to completely create a new image.

Parameters:
canvas - A component for creating an image object.

attachRealPort

public void attachRealPort()
A loadFromStream method should only load an parentId-objectId list of ports attached, So here we use an attachRealPort to ACTUALLY attach some ports to the ports in list.



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