Package org.pathvisio.libgpml.model
Class Group
java.lang.Object
org.pathvisio.libgpml.model.PathwayObject
org.pathvisio.libgpml.model.PathwayElement
org.pathvisio.libgpml.model.ShapedElement
org.pathvisio.libgpml.model.Group
- All Implemented Interfaces:
java.lang.Cloneable
,Drawable
,GraphLink.LinkableTo
,Groupable
,Referenceable
,Referenceable.Annotatable
,Referenceable.Citable
,Referenceable.Evidenceable
,Xrefable
public class Group extends ShapedElement implements Xrefable
This class stores all information relevant to a Group pathway element.
- Author:
- finterly
-
Nested Class Summary
Nested classes/interfaces inherited from class org.pathvisio.libgpml.model.PathwayElement
PathwayElement.AnnotationRef, PathwayElement.CitationRef, PathwayElement.Comment, PathwayElement.EvidenceRef, PathwayElement.InfoRef
Nested classes/interfaces inherited from interface org.pathvisio.libgpml.model.Referenceable
Referenceable.Annotatable, Referenceable.Citable, Referenceable.Evidenceable
-
Field Summary
Fields Modifier and Type Field Description static double
COMPLEX_M_MARGIN
static double
DEFAULT_M_MARGIN
Default margins for group bounding-box in GPML2013a.private java.util.List<Groupable>
pathwayElements
private java.lang.String
textLabel
private GroupType
type
private org.bridgedb.Xref
xref
Fields inherited from class org.pathvisio.libgpml.model.PathwayObject
noFire, pathwayModel
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description DataNode
addAlias(java.lang.String textLabel)
Creates and returns an Alias data node for this group.void
addPathwayElement(Groupable pathwayElement)
Adds the given pathway element to pathwayElements list of this group.void
addPathwayElements(java.util.List<? extends Groupable> pathwayElements)
Adds the given list of pathway elements to pathwayElements list of this group.CopyElement
copy()
Copies this pathway element.void
copyValuesFrom(Group src)
Copies values from the given source pathway element.java.awt.geom.Rectangle2D
getBounds()
Iterates over all group elements to find the TOTAL rectangular bounds.double
getMargin()
Returns margin for group bounding-box around contained elements depending on group type, as specified in GPML2013a.java.awt.geom.Rectangle2D
getMinBounds(boolean rotated)
Iterates over all group elements to find the MINIMAL total rectangular bounds.ObjectType
getObjectType()
Returns the object type of this pathway element.java.util.List<Groupable>
getPathwayElements()
Returns the list of pathway element members of the group.java.awt.geom.Rectangle2D
getRotatedBounds()
Iterates over all group elements to find the TOTAL rectangular bounds, taking into account rotation of the nested elements.java.lang.Object
getStaticProperty(StaticProperty key)
Returns static property value for given key.java.util.Set<StaticProperty>
getStaticPropertyKeys()
Returns all static properties for this pathway object.java.lang.String
getTextLabel()
Returns the text of of this group.GroupType
getType()
Returns GroupType.org.bridgedb.Xref
getXref()
Returns the Xref for the group.boolean
hasPathwayElement(Groupable pathwayElement)
Checks whether pathwayElements has the given pathwayElement.void
removePathwayElement(Groupable pathwayElement)
Removes the given pathway element from pathwayElements list of the group.void
removePathwayElements()
Removes all pathway elements from the pathwayElements list.void
setRotation(java.lang.Double v)
Rotation is not allowed for Groups and will always be set to 0 (default).void
setStaticProperty(StaticProperty key, java.lang.Object value)
This works so that o.setNotes(x) is the equivalent of o.setProperty("Notes", x); Value may be null in some cases, e.g.void
setTextLabel(java.lang.String v)
Sets the text of this shaped pathway element.void
setType(GroupType v)
Sets GroupType to the given groupType.void
setXref(org.bridgedb.Xref v)
Sets the Xref for this group.protected void
terminate()
Terminates this group and removes all references and links.java.lang.String
toString()
Writes this group out as a string.void
updateDimensions()
Updates Group centerX, centerY, width, and height.Methods inherited from class org.pathvisio.libgpml.model.ShapedElement
copyValuesFrom, getBorderColor, getBorderStyle, getBorderWidth, getCenterX, getCenterY, getFillColor, getFontDecoration, getFontName, getFontSize, getFontStrikethru, getFontStyle, getFontWeight, getGroupRef, getHAlign, getHeight, getLeft, getLinkableFroms, getRotation, getShapeType, getTextColor, getTop, getVAlign, getWidth, getZOrder, hasGroupRef, setBorderColor, setBorderStyle, setBorderWidth, setCenterX, setCenterY, setFillColor, setFontDecoration, setFontName, setFontSize, setFontStrikethru, setFontStyle, setFontWeight, setGroupRefTo, setHAlign, setHeight, setLeft, setShapeType, setTextColor, setTop, setVAlign, setWidth, setZOrder, toAbsoluteCoordinate, toRelativeCoordinate, unsetAllLinkableFroms, unsetGroupRef
Methods inherited from class org.pathvisio.libgpml.model.PathwayElement
addAnnotation, addAnnotation, addAnnotation, addCitation, addCitation, addCitation, addComment, addComment, addEvidence, addEvidence, addEvidence, copyReferencesFrom, copyValuesFrom, findComment, getAnnotationRefs, getCitationRefs, getComments, getDynamicProperties, getDynamicProperty, getDynamicPropertyKeys, getEvidenceRefs, getPropertyEx, getPropertyKeys, hasAnnotationRef, hasCitationRef, hasEvidenceRef, removeAnnotationRef, removeAnnotationRefs, removeCitationRef, removeCitationRefs, removeComment, removeEvidenceRef, removeEvidenceRefs, setComments, setDynamicProperty, setPropertyEx
Methods inherited from class org.pathvisio.libgpml.model.PathwayObject
addListener, dontFireEvents, fireObjectModifiedEvent, getElementId, getListeners, getPathwayModel, hasPathwayModel, removeListener, setElementId, setGeneratedElementId, setPathwayModel, setPathwayModelTo, unsetPathwayModel
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.pathvisio.libgpml.model.Drawable
getPathwayModel
Methods inherited from interface org.pathvisio.libgpml.model.GraphLink.LinkableTo
getElementId
-
Field Details
-
type
-
textLabel
private java.lang.String textLabel -
xref
private org.bridgedb.Xref xref -
pathwayElements
-
DEFAULT_M_MARGIN
public static final double DEFAULT_M_MARGINDefault margins for group bounding-box in GPML2013a. Makes the bounds slightly larger than the summed bounds of the containing elements.- See Also:
- Constant Field Values
-
COMPLEX_M_MARGIN
public static final double COMPLEX_M_MARGIN- See Also:
- Constant Field Values
-
-
Constructor Details
-
Group
Instantiates a Group given all required parameters and xref.- Parameters:
type
- the type of the group.xref
- the group Xref.
-
Group
Instantiates a Group given all required parameters.
-
-
Method Details
-
getObjectType
Returns the object type of this pathway element.- Specified by:
getObjectType
in interfaceDrawable
- Specified by:
getObjectType
in interfaceGraphLink.LinkableTo
- Specified by:
getObjectType
in classPathwayObject
- Returns:
- the object type.
-
getPathwayElements
Returns the list of pathway element members of the group.- Returns:
- pathwayElements the list of pathway elements belonging to the group.
-
hasPathwayElement
Checks whether pathwayElements has the given pathwayElement.- Parameters:
pathwayElement
- the pathway element to look for.- Returns:
- true if has pathwayElement, false otherwise.
-
addPathwayElement
Adds the given pathway element to pathwayElements list of this group. Checks if pathway element is valid. Sets groupRef of pathway element to this group if necessary. NB: States are not added to group pathway elements lists. States appear outside of groups in the view.- Parameters:
pathwayElement
- the given pathwayElement to add.
-
updateDimensions
public void updateDimensions()Updates Group centerX, centerY, width, and height.NB:
- Generally called after
addPathwayElement(org.pathvisio.libgpml.model.Groupable)
or setGroupRefTo Methods, when pathway elements are added to group. - Called after reading methods in
GPMLFormatAbstract.updateGroups(org.pathvisio.libgpml.model.PathwayModel)
. - Also called in copy and paste methods.
- Generally called after
-
removePathwayElement
Removes the given pathway element from pathwayElements list of the group. Checks if pathway element is valid. Unsets groupRef of pathway element from this group if necessary.- Parameters:
pathwayElement
- the given pathwayElement to remove.
-
addPathwayElements
Adds the given list of pathway elements to pathwayElements list of this group.- Parameters:
pathwayElements
- the given list of pathwayElement to add.
-
removePathwayElements
public void removePathwayElements()Removes all pathway elements from the pathwayElements list. -
getType
Returns GroupType. GroupType is GROUP by default.- Returns:
- type the type of group, e.g. complex.
-
setType
Sets GroupType to the given groupType.- Parameters:
v
- the type to set for this group, e.g. complex.
-
getTextLabel
public java.lang.String getTextLabel()Returns the text of of this group.- Specified by:
getTextLabel
in classShapedElement
- Returns:
- textLabel the text of of this group.
-
setTextLabel
public void setTextLabel(java.lang.String v)Sets the text of this shaped pathway element.- Specified by:
setTextLabel
in classShapedElement
- Parameters:
v
- the text to set.
-
getXref
public org.bridgedb.Xref getXref()Returns the Xref for the group. -
setXref
public void setXref(org.bridgedb.Xref v)Sets the Xref for this group. -
addAlias
Creates and returns an Alias data node for this group. -
terminate
protected void terminate()Terminates this group and removes all references and links. NB: MustLineElement.LinePoint.unlink()
before removing pathway element members, so that line points stays in the same position when the group disappears. If you remove pathway elements first, the group bounds changes before you can unlink(), effecting the position of line points.- Overrides:
terminate
in classShapedElement
-
setRotation
public void setRotation(java.lang.Double v)Rotation is not allowed for Groups and will always be set to 0 (default).- Overrides:
setRotation
in classShapedElement
- Parameters:
v
-
-
getMargin
public double getMargin()Returns margin for group bounding-box around contained elements depending on group type, as specified in GPML2013a.- Returns:
- the margin for group.
-
getRotatedBounds
public java.awt.geom.Rectangle2D getRotatedBounds()Iterates over all group elements to find the TOTAL rectangular bounds, taking into account rotation of the nested elements. NB: For now, groups should never be rotated.- Specified by:
getRotatedBounds
in interfaceGroupable
- Overrides:
getRotatedBounds
in classShapedElement
- Returns:
- the rectangular bounds for this group with rotation taken into account.
-
getBounds
public java.awt.geom.Rectangle2D getBounds()Iterates over all group elements to find the TOTAL rectangular bounds.- Specified by:
getBounds
in interfaceGroupable
- Overrides:
getBounds
in classShapedElement
- Returns:
- the rectangular bounds for this group.
-
getMinBounds
public java.awt.geom.Rectangle2D getMinBounds(boolean rotated)Iterates over all group elements to find the MINIMAL total rectangular bounds.- Parameters:
rotated
- if true, take into account rotation.- Returns:
- the rectangular bounds for this group.
-
copyValuesFrom
Copies values from the given source pathway element.- Parameters:
src
- the source pathway element.
-
copy
Copies this pathway element.- Specified by:
copy
in classPathwayElement
- Returns:
- the copyElement for the new pathway element and this source pathway element.
-
getStaticPropertyKeys
Returns all static properties for this pathway object.- Overrides:
getStaticPropertyKeys
in classShapedElement
- Returns:
- result the set of static property for this pathway object.
-
getStaticProperty
Returns static property value for given key.- Overrides:
getStaticProperty
in classShapedElement
- Parameters:
key
- the key.- Returns:
- the static property value.
-
setStaticProperty
This works so that o.setNotes(x) is the equivalent of o.setProperty("Notes", x); Value may be null in some cases, e.g. graphRef- Overrides:
setStaticProperty
in classShapedElement
- Parameters:
key
- the key.value
- the static property value.
-
toString
public java.lang.String toString()Writes this group out as a string.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representing this group.
-