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.InfoRefNested 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 doubleCOMPLEX_M_MARGINstatic doubleDEFAULT_M_MARGINDefault margins for group bounding-box in GPML2013a.private java.util.List<Groupable>pathwayElementsprivate java.lang.StringtextLabelprivate GroupTypetypeprivate org.bridgedb.XrefxrefFields inherited from class org.pathvisio.libgpml.model.PathwayObject
noFire, pathwayModel -
Constructor Summary
-
Method Summary
Modifier and Type Method Description DataNodeaddAlias(java.lang.String textLabel)Creates and returns an Alias data node for this group.voidaddPathwayElement(Groupable pathwayElement)Adds the given pathway element to pathwayElements list of this group.voidaddPathwayElements(java.util.List<? extends Groupable> pathwayElements)Adds the given list of pathway elements to pathwayElements list of this group.CopyElementcopy()Copies this pathway element.voidcopyValuesFrom(Group src)Copies values from the given source pathway element.java.awt.geom.Rectangle2DgetBounds()Iterates over all group elements to find the TOTAL rectangular bounds.doublegetMargin()Returns margin for group bounding-box around contained elements depending on group type, as specified in GPML2013a.java.awt.geom.Rectangle2DgetMinBounds(boolean rotated)Iterates over all group elements to find the MINIMAL total rectangular bounds.ObjectTypegetObjectType()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.Rectangle2DgetRotatedBounds()Iterates over all group elements to find the TOTAL rectangular bounds, taking into account rotation of the nested elements.java.lang.ObjectgetStaticProperty(StaticProperty key)Returns static property value for given key.java.util.Set<StaticProperty>getStaticPropertyKeys()Returns all static properties for this pathway object.java.lang.StringgetTextLabel()Returns the text of of this group.GroupTypegetType()Returns GroupType.org.bridgedb.XrefgetXref()Returns the Xref for the group.booleanhasPathwayElement(Groupable pathwayElement)Checks whether pathwayElements has the given pathwayElement.voidremovePathwayElement(Groupable pathwayElement)Removes the given pathway element from pathwayElements list of the group.voidremovePathwayElements()Removes all pathway elements from the pathwayElements list.voidsetRotation(java.lang.Double v)Rotation is not allowed for Groups and will always be set to 0 (default).voidsetStaticProperty(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.voidsetTextLabel(java.lang.String v)Sets the text of this shaped pathway element.voidsetType(GroupType v)Sets GroupType to the given groupType.voidsetXref(org.bridgedb.Xref v)Sets the Xref for this group.protected voidterminate()Terminates this group and removes all references and links.java.lang.StringtoString()Writes this group out as a string.voidupdateDimensions()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, unsetGroupRefMethods 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, setPropertyExMethods inherited from class org.pathvisio.libgpml.model.PathwayObject
addListener, dontFireEvents, fireObjectModifiedEvent, getElementId, getListeners, getPathwayModel, hasPathwayModel, removeListener, setElementId, setGeneratedElementId, setPathwayModel, setPathwayModelTo, unsetPathwayModelMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.pathvisio.libgpml.model.Drawable
getPathwayModelMethods 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:
getObjectTypein interfaceDrawable- Specified by:
getObjectTypein interfaceGraphLink.LinkableTo- Specified by:
getObjectTypein 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:
getTextLabelin 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:
setTextLabelin 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:
terminatein classShapedElement
-
setRotation
public void setRotation(java.lang.Double v)Rotation is not allowed for Groups and will always be set to 0 (default).- Overrides:
setRotationin 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:
getRotatedBoundsin interfaceGroupable- Overrides:
getRotatedBoundsin 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:
getBoundsin interfaceGroupable- Overrides:
getBoundsin 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:
copyin classPathwayElement- Returns:
- the copyElement for the new pathway element and this source pathway element.
-
getStaticPropertyKeys
Returns all static properties for this pathway object.- Overrides:
getStaticPropertyKeysin classShapedElement- Returns:
- result the set of static property for this pathway object.
-
getStaticProperty
Returns static property value for given key.- Overrides:
getStaticPropertyin 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:
setStaticPropertyin classShapedElement- Parameters:
key- the key.value- the static property value.
-
toString
public java.lang.String toString()Writes this group out as a string.- Overrides:
toStringin classjava.lang.Object- Returns:
- the string representing this group.
-