|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.jfimagine.jfgraph.shape.base.AbstractObject
|
+--com.jfimagine.jfgraph.shape.base.Port
Port Class. A port is used for connecting other ports of shapes.
| Field Summary | |
static java.lang.String |
KEY_SEPARATOR
A char seperating each parentId-index pair |
protected AbstractObject |
m_parent
A parent object of this port. |
protected JFPoint |
m_portPoint
A point for x,y coordinates. |
static java.lang.String |
PAIR_SEPARATOR
A char seperating all the parentId-index pairs in the string list |
static int |
PORTTYPE_CUSTOM
Arbitrary port. |
static int |
PORTTYPE_DEFAULT
A default port of a specified shape. |
static java.lang.String |
XML_CONNECTEDLIST
A XML string tag represents the ports list attached to this port |
static java.lang.String |
XML_FIRSTPOINTX
A XML string tag represents the x coordinates of first reference point. |
static java.lang.String |
XML_FIRSTPOINTY
A XML string tag represents the y coordinates of first reference point. |
static java.lang.String |
XML_PARENTID
A XML string tag represents the parent id of this port |
static java.lang.String |
XML_PERCENTPOS
A XML string tag represents the percent position of this port. |
static java.lang.String |
XML_PORT
A XML string tag represents a jfport |
static java.lang.String |
XML_PORTTYPE
A XML string tag represents current type of this port |
static java.lang.String |
XML_SECONDPOINTX
A XML string tag represents the x coordinates of second reference point. |
static java.lang.String |
XML_SECONDPOINTY
A XML string tag represents the y coordinates of second reference point. |
static java.lang.String |
XML_XOFFSET
A XML string tag represents the x coordinates of this port |
static java.lang.String |
XML_YOFFSET
A XML string tag represents the y coordinates of this port |
| Fields inherited from class com.jfimagine.jfgraph.shape.base.AbstractObject |
m_lastError, XML_OBJECTID, XML_OBJECTTYPE |
| Constructor Summary | |
Port()
Constructor for Port |
|
Port(AbstractObject parent,
int portType,
JFPoint firstPoint,
JFPoint secondPoint,
JFPoint portPoint)
Constructor for Port. |
|
| Method Summary | |
protected void |
appendChildToDOM(Element element,
JFVersion version)
Append necessary xml child for current element, this method will be called internally by toDOM. |
boolean |
attachPort(Port port)
Attach this port to a specified port of other shape. |
void |
attachRealPort(ObjectList shapeList)
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 this port |
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 |
collectAttachedList()
Collect all the port in the attachedList to a string, actually the method should generate a new parentId-index pair list string, each pair seperated by PAIR_SEPARATOR, and pair itself seperated by KEY_SEPARATOR |
void |
detachAll()
Detach all relational ports of this port. |
boolean |
detachPort(Port port)
Detach this port to a specified port of other shape. |
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. |
void |
finishMoving()
Finish moving port. |
void |
flipBy(double baseY)
Reverse this object by a y coordinate. |
java.util.List |
getAttachedList()
Get attached port list. |
java.lang.String |
getAttachedListStr()
Get attached port list str. |
Port |
getAttachedPortByIndex(int index)
Get a attached port of current port by index. |
int |
getAttachedPortIndex(int parentId,
int objectId)
Get the index of an attached port in the attached port list.. |
int |
getAttachedPortIndex(Port port)
Get the index of an attached port in the attached port list.. |
int |
getAttachedSize()
Get the quantity of attached ports. |
JFPoint |
getFirstPoint()
Get the first reference point of this port. |
AbstractObject |
getParent()
Get parent object of this port. |
int |
getParentId()
Get the key of parent shape of this port |
double |
getPercentPos()
Get the percent position of this port. |
JFPoint |
getPortPoint()
Get the port point of current port. |
int |
getPortType()
Get the Type of current port. |
JFPoint |
getSecondPoint()
Get the second reference point of this port. |
double |
getXOffset()
Get the x offset of current port. |
double |
getYOffset()
Get the y offset of current port. |
int |
hashCode()
Returns the hashcode for this Object. |
boolean |
intersects(JFPoint pnt)
Test if current object intersects with a specified point. |
void |
loadFromStream(JFReader stream,
boolean skipHead,
JFVersion version)
Load port data from a binary stream |
void |
mirrorBy(double baseX)
Mirror this object by a x coordinate. |
void |
moveBy(double x,
double y)
Move current object by an x and y offset. |
void |
moveRelationalPorts(ObjectList movedList,
boolean isMovePorts)
move relational ports. |
void |
rotateBy(double baseX,
double baseY,
double theta)
Rotate current object by a specified point and an angle theta. |
void |
saveToStream(JFWriter stream,
JFVersion version)
Save this Port to a binary stream |
void |
scaleBy(double baseX,
double baseY,
double scale)
Scale this port by a point, and specified scale. |
void |
scaleBy(double baseX,
double baseY,
double xScale,
double yScale)
Scale this port by a point, and specified scale. |
void |
setAttachedList(java.util.List attachedList)
Set attached port list. |
void |
setAttachedListStr(java.lang.String attachedListStr)
Set attached port list str. |
void |
setFirstPoint(double x,
double y)
Set the first reference point of this port. |
void |
setFirstPoint(JFPoint pnt)
Set the first reference point of this port. |
void |
setParent(AbstractObject obj)
Set parent object of this port. |
void |
setParentId(int parentId)
Set the key of parent shape of this port |
void |
setPercentPos(double percentPos)
Set the percent position of this port. |
void |
setPortPoint(double x,
double y)
Set the port point of current port. |
void |
setPortPoint(JFPoint pnt)
Set the port point of current port. |
void |
setPortType(int portType)
Set the Type of current port. |
void |
setSecondPoint(double x,
double y)
Set the second reference point of this port. |
void |
setSecondPoint(JFPoint pnt)
Set the second reference point of this port. |
void |
setXOffset(double xOffset)
Set the x offset of current port. |
void |
setYOffset(double yOffset)
Set the y offset of current port. |
java.lang.String |
toString()
Convert this port to String |
void |
unboundBrokenPorts()
unbound broken ports. |
| 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 |
public static final java.lang.String XML_PORT
public static final java.lang.String XML_PORTTYPE
public static final java.lang.String XML_PARENTID
public static final java.lang.String XML_XOFFSET
public static final java.lang.String XML_YOFFSET
public static final java.lang.String XML_FIRSTPOINTX
public static final java.lang.String XML_FIRSTPOINTY
public static final java.lang.String XML_SECONDPOINTX
public static final java.lang.String XML_SECONDPOINTY
public static final java.lang.String XML_PERCENTPOS
public static final java.lang.String XML_CONNECTEDLIST
public static final int PORTTYPE_DEFAULT
public static final int PORTTYPE_CUSTOM
public static final java.lang.String PAIR_SEPARATOR
public static final java.lang.String KEY_SEPARATOR
protected JFPoint m_portPoint
protected AbstractObject m_parent
| Constructor Detail |
public Port()
public Port(AbstractObject parent,
int portType,
JFPoint firstPoint,
JFPoint secondPoint,
JFPoint portPoint)
parent - parent object of this port.portType - The type of a port.firstPoint - The first reference end point of a port.secondPoint - The second reference end point of a port.portPoint - The port point of a port.| Method Detail |
public int getPortType()
public void setPortType(int portType)
portType - The Type of current port
public int getParentId()
public void setParentId(int parentId)
parentId - The parent shape's key.
public AbstractObject getParent()
public void setParent(AbstractObject obj)
public double getXOffset()
public void setXOffset(double xOffset)
xOffset - The x offset of current port.
public double getYOffset()
public void setYOffset(double yOffset)
yOffset - The y offset of current port.
public JFPoint getPortPoint()
public void setPortPoint(JFPoint pnt)
pnt - The port point.
public void setPortPoint(double x,
double y)
public JFPoint getFirstPoint()
public void setFirstPoint(JFPoint pnt)
pnt - A new first reference point.
public void setFirstPoint(double x,
double y)
public JFPoint getSecondPoint()
public void setSecondPoint(JFPoint pnt)
pnt - A new second reference point.
public void setSecondPoint(double x,
double y)
public void finishMoving()
public double getPercentPos()
public void setPercentPos(double percentPos)
percentPos - A new percent position.public java.util.List getAttachedList()
public void setAttachedList(java.util.List attachedList)
attachedList - The list of ports attached to current port.public java.lang.String getAttachedListStr()
public void setAttachedListStr(java.lang.String attachedListStr)
attachedListStr - The string of the ports list attached to current port.public int getAttachedSize()
public boolean attachPort(Port port)
port - A new port of other shape.public boolean detachPort(Port port)
port - A port of other shape.public void detachAll()
public void moveRelationalPorts(ObjectList movedList,
boolean isMovePorts)
movedList - An object list that has already processed, so don't change them further.isMovePorts - Move ports or move ports' parent objects.True move ports, false otherwise.public void unboundBrokenPorts()
public int getAttachedPortIndex(Port port)
port - An attached port.
public int getAttachedPortIndex(int parentId,
int objectId)
parentId - The parent id of a new port.objectId - The object id of a new port.
public Port getAttachedPortByIndex(int index)
index - An index in the list.
public void collectAttachedList()
public void attachRealPort(ObjectList shapeList)
throws ListException
shapeList - A shapeList used to pick out their ports for this port's attached list
ListException
public void draw(java.awt.Graphics g,
boolean isXorMode)
g - A graphic canvas.isXorMode - If is in xor mode now.public boolean intersects(JFPoint pnt)
pnt - A JFPoint used to test intersection.
public void scaleBy(double baseX,
double baseY,
double scale)
scale - A scale value.
public void scaleBy(double baseX,
double baseY,
double xScale,
double yScale)
xScale - A scale value in x coordinate.yScale - A scale value in y coordinate.
public void moveBy(double x,
double y)
public void rotateBy(double baseX,
double baseY,
double theta)
theta - A rotate angle.public void mirrorBy(double baseX)
baseX - A mirror base x coordinate.public void flipBy(double baseY)
baseY - A flip base y coordinate.public java.lang.String toString()
toString in class AbstractObject
protected AbstractObject cloneMe()
throws java.lang.CloneNotSupportedException
cloneMe in class AbstractObjectjava.lang.CloneNotSupportedException
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class AbstractObjectjava.lang.CloneNotSupportedExceptionpublic int hashCode()
hashCode in class AbstractObjectpublic boolean equals(java.lang.Object obj)
equals in class AbstractObjectobj - an object to be compared with this object
protected void appendChildToDOM(Element element,
JFVersion version)
appendChildToDOM in class AbstractObjectelement - A XML element to append child xml nodesversion - A file version notification so this object can obey the rules to save data.
protected void extractChildFromDOM(Element element,
JFVersion version)
extractChildFromDOM in class AbstractObjectelement - An element used to extract needed xml childversion - A file version notification so this object can obey the rules to fetch data.
public void saveToStream(JFWriter stream,
JFVersion version)
throws java.io.IOException
saveToStream in class AbstractObjectstream - An binary output streamversion - A file version notification so this object can obey the rules to fetch data.
java.io.IOException
public void loadFromStream(JFReader stream,
boolean skipHead,
JFVersion version)
throws java.io.IOException
loadFromStream in class AbstractObjectstream - An binary input streamskipHead - 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.
java.io.IOException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||