com.mindfusion.diagramming
Class Group

java.lang.Object
  extended by com.mindfusion.diagramming.Group
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class Group
extends java.lang.Object
implements java.io.Externalizable

Represents an hierarchical group of items. One of the items is considered the master item, the rest are subordinated items that follow the master one when it is modified.

See Also:
Serialized Form

Constructor Summary
Group()
          Used internally to implement serialization.
Group(Group prototype)
          Initializes a new instance of the Group class.
 
Method Summary
 boolean attachProportional(DiagramNode node, float left, float top, float right, float bottom)
          Adds a node to the group.
 boolean attachToCorner(DiagramNode node, int corner)
          Adds a node to the group.
 boolean attachToLinkPoint(DiagramNode node, int point)
          Adds a node to the group.
 boolean attachToLinkSegment(DiagramNode node, int segment)
          Adds a node to the group.
 boolean attachToLongestHSegment(DiagramNode node)
          Adds a node to the group, maintaining its relative positions to master arrow's longest horizontal segment
 boolean attachToSideMiddle(DiagramNode node, int side)
          Attaches a node to the group, so that it will follow the middle point of another node's side.
 boolean detach(DiagramNode node)
          Removes a node from the group.
 DiagramNodeList getAttachedNodes()
          Gets a list of the subordinated items in this group.
 boolean getAutoDeleteItems()
          Gets a value indicating whether the subordinated items in this group will be deleted automatically when the group is destroyed.
 boolean getExpandable()
          Gets a value indicating whether expansion of a tree branch that contains the master item of a group will propagate through its attached items.
 boolean getFollowMasterContainment()
           
 boolean getFollowMasterRotation()
          Gets a value indicating whether the attached items in a group follow the rotation of the group's master item.
 DiagramLinkList getLinksToMove()
           
 DiagramItem getMainItem()
          Gets the master item of this group.
 java.lang.Object getTag()
          Gets the custom data object assigned to this group.
 boolean getVisible()
          Gets a value indicating whether this group is visible.
 void readExternal(java.io.ObjectInput in)
          Implements Externalizable.
 void setAutoDeleteItems(boolean value)
          Sets a value indicating whether the subordinated items in this group should be deleted automatically when the group is destroyed.
 void setExpandable(boolean value)
          Sets a value indicating whether expansion of a tree branch that contains the master item of a group should propagate through its attached items.
 void setFollowMasterContainment(boolean value)
           
 void setFollowMasterRotation(boolean value)
          Sets a value indicating whether the attached items in a group should follow the rotation of the group's master item.
 void setTag(java.lang.Object value)
          Assigns a custom data object to this group.
 void setVisible(boolean value)
          Shows or hides all items in the group.
 void writeExternal(java.io.ObjectOutput out)
          Implements Externalizable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Group

public Group()
Used internally to implement serialization.


Group

public Group(Group prototype)
Initializes a new instance of the Group class.

Parameters:
prototype - A Group instance whose attributes are copied to this group.
Method Detail

attachToLinkPoint

public boolean attachToLinkPoint(DiagramNode node,
                                 int point)
Adds a node to the group.

Parameters:
node - The DiagramNode to attach.
point - Index of the arrow control point to attach to.
Returns:
true if the node is attached successfully, otherwise false.

attachToLinkSegment

public boolean attachToLinkSegment(DiagramNode node,
                                   int segment)
Adds a node to the group.

Parameters:
node - The DiagramNode to attach.
segment - The arrow segment to attach to.
Returns:
true if the node is attached successfully, otherwise false.

attachToLongestHSegment

public boolean attachToLongestHSegment(DiagramNode node)
Adds a node to the group, maintaining its relative positions to master arrow's longest horizontal segment

Parameters:
node - The DiagramNode to attach.
Returns:
true if the node is attached successfully, otherwise false.

attachToCorner

public boolean attachToCorner(DiagramNode node,
                              int corner)
Adds a node to the group.

Parameters:
node - The DiagramNode to attach.
corner - The corner to attach to.
Returns:
true if the node is attached successfully, otherwise false.

attachToSideMiddle

public boolean attachToSideMiddle(DiagramNode node,
                                  int side)
Attaches a node to the group, so that it will follow the middle point of another node's side.

Parameters:
node - The DiagramNode to attach.
side - The side to attach to.
Returns:
true if the node is attached successfully, otherwise false.

attachProportional

public boolean attachProportional(DiagramNode node,
                                  float left,
                                  float top,
                                  float right,
                                  float bottom)
Adds a node to the group.

Parameters:
node - The DiagramNode to attach.
left - A float percent value specifying to what X position in the master node to attach the left side of this node.
top - A float percent value specifying to what Y position in the master node to attach the top side of this node.
right - A float percent value specifying to what X position in the master node to attach the right side of this node.
bottom - A float percent value specifying to what Y position in the master node to attach the bottom side of this node.
Returns:
true if the node is attached successfully, otherwise false.

detach

public boolean detach(DiagramNode node)
Removes a node from the group.

Parameters:
node - The DiagramNode that should be detached.
Returns:
true if the node is detached, otherwise false.

getAttachedNodes

public DiagramNodeList getAttachedNodes()
Gets a list of the subordinated items in this group.

Returns:
An DiagramItemList containing the items attached to this group.

getVisible

public boolean getVisible()
Gets a value indicating whether this group is visible.

Returns:
true if the group is visible, otherwise false.

setVisible

public void setVisible(boolean value)
Shows or hides all items in the group.

Parameters:
value - true if the group should be visible, otherwise false.

getAutoDeleteItems

public boolean getAutoDeleteItems()
Gets a value indicating whether the subordinated items in this group will be deleted automatically when the group is destroyed.

Returns:
true if the items will be deleted automatically, otherwise false.

setAutoDeleteItems

public void setAutoDeleteItems(boolean value)
Sets a value indicating whether the subordinated items in this group should be deleted automatically when the group is destroyed.

Parameters:
value - true if the items should be deleted automatically, otherwise false.

getExpandable

public boolean getExpandable()
Gets a value indicating whether expansion of a tree branch that contains the master item of a group will propagate through its attached items.

Returns:
true if tree expansion propagates through this group, otherwise false.

setExpandable

public void setExpandable(boolean value)
Sets a value indicating whether expansion of a tree branch that contains the master item of a group should propagate through its attached items.

Parameters:
value - true if tree expansion should propagate through this group, otherwise false.

getFollowMasterRotation

public boolean getFollowMasterRotation()
Gets a value indicating whether the attached items in a group follow the rotation of the group's master item.

Returns:
true if attached items follow the master rotation, otherwise false.

setFollowMasterRotation

public void setFollowMasterRotation(boolean value)
Sets a value indicating whether the attached items in a group should follow the rotation of the group's master item.

Parameters:
value - true if attached items should follow the master item rotation, otherwise false.

getFollowMasterContainment

public boolean getFollowMasterContainment()

setFollowMasterContainment

public void setFollowMasterContainment(boolean value)

getTag

public java.lang.Object getTag()
Gets the custom data object assigned to this group.

Returns:
A custom data Object assigned to this group.

setTag

public void setTag(java.lang.Object value)
Assigns a custom data object to this group. If the tag object is serializable, it will be automatically saved when serializing the diagram into binary format. When serializing to XML, you can save the tag by handling the DiagramListener.serializeTag(com.mindfusion.diagramming.SerializeTagEvent) event.

Parameters:
value - An Object containing custom data.

getMainItem

public DiagramItem getMainItem()
Gets the master item of this group.

Returns:
A reference to the master DiagramItem.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Implements Externalizable.

Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Implements Externalizable.

Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

getLinksToMove

public DiagramLinkList getLinksToMove()