Class ObjectPosition
- java.lang.Object
-
- org.cytoscape.view.presentation.property.values.ObjectPosition
-
public final class ObjectPosition extends Object
ObjectPosition is the value that is used by Position VisualProperties. It includes information about the anchor point of the object itself, the anchor point of the target, the justification, and an x,y offset.Module:
presentation-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>presentation-api</artifactId> </dependency>
Cytoscape Backwards Compatibility (Final Class): This class is final and therefore can't be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.
-
-
Field Summary
Fields Modifier and Type Field Description static ObjectPosition
DEFAULT_POSITION
-
Constructor Summary
Constructors Constructor Description ObjectPosition()
Creates a new ObjectPosition object.ObjectPosition(ObjectPosition p)
Copy constructorObjectPosition(Position targ, Position lab, Justification just, double x, double y)
Creates a new ObjectPosition object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object lp)
Compare two ObjectPositionsPosition
getAnchor()
Return the anchor of the label (or other object).Justification
getJustify()
Return the justification of the label (or other object).double
getOffsetX()
Return the X offset of the objectdouble
getOffsetY()
Return the Y offset of the objectPosition
getTargetAnchor()
Return the anchor of the target (e.g.static ObjectPosition
parse(String serializableString)
Parse a String that has been written bytoSerializableString()
and create a new ObjectPosition that matches the text descriptionvoid
setAnchor(Position p)
Set the anchor of the label (or other object).void
setJustify(Justification j)
Set the justification of the label (or other object).void
setOffsetX(double d)
Set the X offset of the objectvoid
setOffsetY(double d)
Set the Y offset of the objectvoid
setTargetAnchor(Position p)
Set the anchor of the target object (e.g.String
toSerializableString()
Return a String that represents this ObjectPosition, suitable for recreating the ObjectPosition withparse(java.lang.String)
String
toString()
Return a string representation of this ObjectPosition
-
-
-
Field Detail
-
DEFAULT_POSITION
public static ObjectPosition DEFAULT_POSITION
-
-
Constructor Detail
-
ObjectPosition
public ObjectPosition()
Creates a new ObjectPosition object.
-
ObjectPosition
public ObjectPosition(ObjectPosition p)
Copy constructor- Parameters:
p
- original position.
-
ObjectPosition
public ObjectPosition(Position targ, Position lab, Justification just, double x, double y)
Creates a new ObjectPosition object.- Parameters:
targ
- the anchor Position of the target (e.g. Node)lab
- the anchor Position of the labeljust
- the Justification of the textx
- an x offsety
- a y offset
-
-
Method Detail
-
getAnchor
public Position getAnchor()
Return the anchor of the label (or other object).- Returns:
- object anchor
-
getTargetAnchor
public Position getTargetAnchor()
Return the anchor of the target (e.g. Node)- Returns:
- target anchor
-
getJustify
public Justification getJustify()
Return the justification of the label (or other object).- Returns:
- text justification
-
getOffsetX
public double getOffsetX()
Return the X offset of the object- Returns:
- x offset
-
getOffsetY
public double getOffsetY()
Return the Y offset of the object- Returns:
- Y offset
-
setAnchor
public void setAnchor(Position p)
Set the anchor of the label (or other object).- Parameters:
p
- anchor of the object
-
setTargetAnchor
public void setTargetAnchor(Position p)
Set the anchor of the target object (e.g. Node)
-
setJustify
public void setJustify(Justification j)
Set the justification of the label (or other object).- Parameters:
j
- text justification
-
setOffsetX
public void setOffsetX(double d)
Set the X offset of the object- Parameters:
d
- x offset
-
setOffsetY
public void setOffsetY(double d)
Set the Y offset of the object- Parameters:
d
- y offset
-
equals
public boolean equals(Object lp)
Compare two ObjectPositions
-
toString
public String toString()
Return a string representation of this ObjectPosition
-
toSerializableString
public String toSerializableString()
Return a String that represents this ObjectPosition, suitable for recreating the ObjectPosition withparse(java.lang.String)
- Returns:
- serialized string
-
parse
public static ObjectPosition parse(String serializableString)
Parse a String that has been written bytoSerializableString()
and create a new ObjectPosition that matches the text description- Parameters:
serializableString
-- Returns:
- Never returns null. If invalid, simply returns default.
-
-