Package org.pathvisio.libgpml.model
Class DataNode
java.lang.Object
org.pathvisio.libgpml.model.PathwayObject
org.pathvisio.libgpml.model.PathwayElement
org.pathvisio.libgpml.model.ShapedElement
org.pathvisio.libgpml.model.DataNode
- All Implemented Interfaces:
java.lang.Cloneable
,Drawable
,GraphLink.LinkableTo
,Groupable
,Referenceable
,Referenceable.Annotatable
,Referenceable.Citable
,Referenceable.Evidenceable
,Xrefable
public class DataNode extends ShapedElement implements Xrefable
This class stores information for a DataNode pathway element.
- Author:
- finterly
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
DataNode.State
This class stores all information relevant to a State pathway element.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 private Group
aliasRef
private java.util.List<DataNode.State>
states
private java.lang.String
textLabel
private DataNodeType
type
private org.bridgedb.Xref
xref
Fields inherited from class org.pathvisio.libgpml.model.PathwayObject
noFire, pathwayModel
-
Constructor Summary
Constructors Constructor Description DataNode(java.lang.String textLabel, DataNodeType type)
Instantiates a DataNode given all required parameters.DataNode(java.lang.String textLabel, DataNodeType type, org.bridgedb.Xref xref, Group aliasRef)
Instantiates a DataNode given all possible parameters. -
Method Summary
Modifier and Type Method Description DataNode.State
addState(java.lang.String elementId, java.lang.String textLabel, StateType type, double relX, double relY)
Instantiates a state with the given properties including elementId.DataNode.State
addState(java.lang.String textLabel, StateType type, double relX, double relY)
Instantiates a state with the given properties.void
addState(DataNode.State state)
Adds given state to states list.CopyElement
copy()
Copies this pathway element.void
copyReferencesFrom(PathwayElement srcDataNode)
Copies references from the given source data node, including state references.void
copyValuesFrom(DataNode src)
Copies values from the given source pathway element.Group
getAliasRef()
Returns the pathway element to which the data node refers to as an alias.ObjectType
getObjectType()
Returns the object type of this pathway element.java.util.List<DataNode.State>
getStates()
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 this datanode.DataNodeType
getType()
Returns the type of this datanode.org.bridgedb.Xref
getXref()
Returns the Xref for this datanode.boolean
hasState(DataNode.State state)
Checks whether states has the given state.void
removeState(DataNode.State state)
Removes given state from states list.private void
removeStates()
Removes all states from states list.void
setAliasRef(Group v)
Sets the group aliasRef to which this data node refers to as an alias.protected void
setPathwayModelTo(PathwayModel pathwayModel)
Sets the pathway model for this pathway element.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(DataNodeType v)
Sets the type of this datanode, e.g.void
setXref(org.bridgedb.Xref v)
Sets the Xref for this datanode.protected void
terminate()
Terminates this data node and removes all links and references.void
unsetAliasRef()
Unsets the aliasRef, if any, from this data node.Methods inherited from class org.pathvisio.libgpml.model.ShapedElement
copyValuesFrom, getBorderColor, getBorderStyle, getBorderWidth, getBounds, getCenterX, getCenterY, getFillColor, getFontDecoration, getFontName, getFontSize, getFontStrikethru, getFontStyle, getFontWeight, getGroupRef, getHAlign, getHeight, getLeft, getLinkableFroms, getRotatedBounds, getRotation, getShapeType, getTextColor, getTop, getVAlign, getWidth, getZOrder, hasGroupRef, setBorderColor, setBorderStyle, setBorderWidth, setCenterX, setCenterY, setFillColor, setFontDecoration, setFontName, setFontSize, setFontStrikethru, setFontStyle, setFontWeight, setGroupRefTo, setHAlign, setHeight, setLeft, setRotation, 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, 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, unsetPathwayModel
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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
-
textLabel
private java.lang.String textLabel -
type
-
states
-
xref
private org.bridgedb.Xref xref -
aliasRef
-
-
Constructor Details
-
DataNode
public DataNode(java.lang.String textLabel, DataNodeType type, org.bridgedb.Xref xref, Group aliasRef)Instantiates a DataNode given all possible parameters. A DataNode of type Alias can have an aliasRef which refers to aGroup
and/or have a textLabel which points to a group somewhere.- Parameters:
textLabel
- the text or link of this datanode.type
- the type of datanode, e.g. complex.xref
- the data node Xref.aliasRef
- the group this data node alias refers to.
-
DataNode
Instantiates a DataNode given all required parameters.- Parameters:
textLabel
- the datanode text label.type
- the datanode type.
-
-
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.
-
getTextLabel
public java.lang.String getTextLabel()Returns the text of this datanode.- Specified by:
getTextLabel
in classShapedElement
- Returns:
- textLabel the text of this datanode.
-
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.
-
getType
Returns the type of this datanode.- Returns:
- type the type of this datanode, e.g. complex.
-
setType
Sets the type of this datanode, e.g. complex. NB: Cannot change type if this is an alias data node.- Parameters:
v
- the type to set for this datanode.
-
getXref
public org.bridgedb.Xref getXref()Returns the Xref for this datanode. -
setXref
public void setXref(org.bridgedb.Xref v)Sets the Xref for this datanode. -
getStates
-
hasState
Checks whether states has the given state.- Parameters:
state
- the state to look for.- Returns:
- true if has state, false otherwise.
-
addState
Adds given state to states list. Sets datanode for the given state.- Parameters:
state
- the state to be added.
-
addState
public DataNode.State addState(java.lang.String textLabel, StateType type, double relX, double relY)Instantiates a state with the given properties. Adds new state to states list and pathway model.- Parameters:
textLabel
- the text label of the state.type
- the type of the state, e.g. protein modification.relX
- the relative x coordinates.relY
- the relative y coordinates.- Returns:
- state the instantiated state.
-
addState
public DataNode.State addState(java.lang.String elementId, java.lang.String textLabel, StateType type, double relX, double relY)Instantiates a state with the given properties including elementId. Adds new state to states list and pathway model.- Parameters:
elementId
- the elementId to set for the instantiated state.textLabel
- the text label of the state.type
- the type of the state, e.g. protein modification.relX
- the relative x coordinates.relY
- the relative y coordinates.- Returns:
- state the instantiated state.
-
removeState
Removes given state from states list. State ceases to exist and is terminated.- Parameters:
state
- the state to be removed.
-
removeStates
private void removeStates()Removes all states from states list. -
getAliasRef
Returns the pathway element to which the data node refers to as an alias. In GPML, this is aliasRef which refers to the elementId of a pathway element (normally gpml:Group).- Returns:
- aliasRef the pathway element to which the data node refers.
-
setAliasRef
Sets the group aliasRef to which this data node refers to as an alias. In GPML, this is aliasRef which refers to the elementId of gpml:Group.NB:
- This method calls
unsetAliasRef()
to remove any existing links. - This method calls
PathwayModel.linkAlias(org.pathvisio.libgpml.model.Group, org.pathvisio.libgpml.model.DataNode)
to add information to pathway model. - DataNode type must be "Alias".
- Parameters:
v
- the group to which this data node refers.
- This method calls
-
unsetAliasRef
public void unsetAliasRef()Unsets the aliasRef, if any, from this data node. Also removes references in pathway model.- This method calls
unsetAliasRef()
to remove any existing links. - This method calls
PathwayModel.unlinkAlias(org.pathvisio.libgpml.model.Group, org.pathvisio.libgpml.model.DataNode)
to remove information in the pathway model. - This method is also called when this data node alias is
terminate()
.
- This method calls
-
copyValuesFrom
Copies values from the given source pathway element.NB:
- AliasRef value is not copied. References to other PathwayObjects are
stored in
CopyElement
bycopy()
.
- Parameters:
src
- the source pathway element.
- AliasRef value is not copied. References to other PathwayObjects are
stored in
-
copy
Copies this pathway element.- Specified by:
copy
in classPathwayElement
- Returns:
- the copyElement for the new pathway element and this source pathway element.
-
copyReferencesFrom
Copies references from the given source data node, including state references.NB:
- For each state, copies references from the corresponding source state.
- To be called after new data node is added to a pathway model.
- The source data node may be the immediate copy element source of the new data node, or an older source data node.
- Overrides:
copyReferencesFrom
in classPathwayElement
- Parameters:
srcDataNode
- the source element to copy references from.
-
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.
-
setPathwayModelTo
protected void setPathwayModelTo(PathwayModel pathwayModel) throws java.lang.IllegalArgumentException, java.lang.IllegalStateExceptionSets the pathway model for this pathway element. NB: Only set when a pathway model adds this pathway element. This method is not used directly. NB: This method is not used directly. It is called byPathwayModel.addPathwayObject(org.pathvisio.libgpml.model.PathwayObject)
.- Overrides:
setPathwayModelTo
in classPathwayObject
- Parameters:
pathwayModel
- the parent pathway model.- Throws:
java.lang.IllegalArgumentException
java.lang.IllegalStateException
-
terminate
protected void terminate()Terminates this data node and removes all links and references.- Overrides:
terminate
in classShapedElement
-