public class Text extends GraphicalPrimitive1D
Text
element from the SBML render extension. Is used to represent text render information.
The Text
class represents text to be rendered in the context of a style.
The Text
class inherits all attributes and methods from its base class GraphicalPrimitive1D
.
The text also holds a string for the actual text that is to be rendered for the Text
object.
Additional attributes specify how the text is to be rendered, e.g. which font family is to be used and how the text is to be aligned within the viewport.
Modifier and Type | Field and Description |
---|---|
static int |
ANCHOR_BOTTOM   |
static int |
ANCHOR_END   |
static int |
ANCHOR_MIDDLE   |
static int |
ANCHOR_START   |
static int |
ANCHOR_TOP   |
static int |
ANCHOR_UNSET   |
static int |
STYLE_ITALIC   |
static int |
STYLE_NORMAL   |
static int |
STYLE_UNSET   |
static int |
WEIGHT_BOLD   |
static int |
WEIGHT_NORMAL   |
static int |
WEIGHT_UNSET   |
Constructor and Description |
---|
Text()
Creates a new
Text object with the given SBML level
and SBML version. |
Text(long level)
Creates a new
Text object with the given SBML level
and SBML version. |
Text(long level,
long version)
Creates a new
Text object with the given SBML level
and SBML version. |
Text(long level,
long version,
long pkgVersion)
Creates a new
Text object with the given SBML level
and SBML version. |
Text(RenderPkgNamespaces renderns)
Creates a new
Text object with the given SBMLNamespaces . |
Text(RenderPkgNamespaces renderns,
String id)
Instantiates a new
Text object with the given id and position offset. |
Text(RenderPkgNamespaces renderns,
String id,
RelAbsVector x)
Instantiates a new
Text object with the given id and position offset. |
Text(RenderPkgNamespaces renderns,
String id,
RelAbsVector x,
RelAbsVector y)
Instantiates a new
Text object with the given id and position offset. |
Text(RenderPkgNamespaces renderns,
String id,
RelAbsVector x,
RelAbsVector y,
RelAbsVector z)
Instantiates a new
Text object with the given id and position offset. |
Text(XMLNode node)
|
Text(XMLNode node,
long l2version)
|
Modifier and Type | Method and Description |
---|---|
Text |
cloneObject()
Creates and returns a deep copy of this
SBase object. |
void |
delete()
Explicitly deletes the underlying native object.
|
String |
getFontFamily()
Returns the font family.
|
RelAbsVector |
getFontSize()
Returns the font size as a reference.
|
int |
getFontStyle()
Returns the font style.
|
int |
getFontWeight()
Returns the font weight.
|
String |
getText()
Returns the text for the
Text object. |
int |
getTextAnchor()
Returns the text anchor.
|
int |
getTypeCode()
Returns the libSBML type code for this object.
|
int |
getVTextAnchor()
Returns the vertical text anchor.
|
RelAbsVector |
getX()
Returns the x position offset as a reference.
|
RelAbsVector |
getY()
Returns the y position offset as a reference.
|
RelAbsVector |
getZ()
Returns the z position offset as a reference.
|
boolean |
isSetFontFamily()
Returns true if the font family has been set or false otherwise.
|
boolean |
isSetFontSize()
Returns true if the font size has been set or false otherwise.
|
boolean |
isSetFontStyle()
Returns true if the font style has been set or false otherwise.
|
boolean |
isSetFontWeight()
Returns true if the font weight has been set or false otherwise.
|
boolean |
isSetText()
Returns true if the text is set to something else than the empty string.
|
boolean |
isSetTextAnchor()
Returns true if the horizonal alignment attribute has been set.
|
boolean |
isSetVTextAnchor()
Returns true if the vertical alignment attribute has been set.
|
void |
setCoordinates(RelAbsVector x,
RelAbsVector y)
Sets the position of the text within the viewport.
|
void |
setCoordinates(RelAbsVector x,
RelAbsVector y,
RelAbsVector z)
Sets the position of the text within the viewport.
|
void |
setFontFamily(String family)
Sets the font family.
|
void |
setFontSize(RelAbsVector size)
Sets the font size.
|
void |
setFontStyle(int style)
Sets the font style.
|
void |
setFontWeight(int weight)
Sets the font weight.
|
void |
setText(String text)
Sets the text for the text element.
|
void |
setTextAnchor(int anchor)
Sets the text anchor.
|
void |
setVTextAnchor(int anchor)
Sets the vertical text anchor.
|
void |
setX(RelAbsVector x)
Sets the x position of the text within the viewport.
|
void |
setY(RelAbsVector y)
Sets the y position of the text within the viewport.
|
void |
setZ(RelAbsVector z)
Sets the z position of the text within the viewport.
|
XMLNode |
toXML()
Creates an
XMLNode object from this GraphicalPrimitive1D object. |
addDash, clearDashes, getDashByIndex, getId, getNumDashes, getStroke, getStrokeWidth, insertDash, isSetDashArray, isSetId, isSetStroke, isSetStrokeWidth, removeDash, setDashByIndex, setId, setStroke, setStrokeWidth, unsetId
getIdentityMatrix2D, getMatrix2D, setMatrix, setMatrix2D
getIdentityMatrix, getMatrix, isSetMatrix
addCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, connectToChild, deleteDisabledPlugins, deleteDisabledPlugins, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getDisabledPlugin, getElementByMetaId, getElementBySId, getElementName, getLevel, getLine, getListOfAllElements, getListOfAllElements, getListOfAllElementsFromPlugins, getListOfAllElementsFromPlugins, getMetaId, getModel, getModelHistory, getNamespaces, getNotes, getNotesString, getNumCVTerms, getNumDisabledPlugins, getNumPlugins, getPackageName, getPackageVersion, getParentSBMLObject, getPlugin, getPlugin, getPrefix, getResourceBiologicalQualifier, getResourceModelQualifier, getSBMLDocument, getSBOTerm, getSBOTermAsURL, getSBOTermID, getURI, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, isSetUserData, matchesRequiredSBMLNamespacesForAddition, matchesSBMLNamespaces, removeFromParentAndDelete, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, renameMetaIdRefs, renameSIdRefs, renameUnitSIdRefs, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, toXMLNode, unsetAnnotation, unsetCVTerms, unsetMetaId, unsetModelHistory, unsetName, unsetNotes, unsetSBOTerm, unsetUserData
public static final int WEIGHT_UNSET
public static final int WEIGHT_NORMAL
public static final int WEIGHT_BOLD
public static final int STYLE_UNSET
public static final int STYLE_NORMAL
public static final int STYLE_ITALIC
public static final int ANCHOR_UNSET
public static final int ANCHOR_START
public static final int ANCHOR_MIDDLE
public static final int ANCHOR_END
public static final int ANCHOR_TOP
public static final int ANCHOR_BOTTOM
public Text(long level, long version, long pkgVersion) throws SBMLConstructorException
Text
object with the given SBML level
and SBML version.
level
- SBML level of the new objectlevel
- SBML version of the new objectSBMLConstructorException
public Text(long level, long version) throws SBMLConstructorException
Text
object with the given SBML level
and SBML version.
level
- SBML level of the new objectlevel
- SBML version of the new objectSBMLConstructorException
public Text(long level) throws SBMLConstructorException
Text
object with the given SBML level
and SBML version.
level
- SBML level of the new objectlevel
- SBML version of the new objectSBMLConstructorException
public Text() throws SBMLConstructorException
Text
object with the given SBML level
and SBML version.
level
- SBML level of the new objectlevel
- SBML version of the new objectSBMLConstructorException
public Text(RenderPkgNamespaces renderns) throws SBMLConstructorException
Text
object with the given SBMLNamespaces
.
sbmlns
- The SBML namespace for the object.SBMLConstructorException
public Text(XMLNode node, long l2version) throws SBMLConstructorException
Text
object from the given XMLNode
object.
The XMLNode
object has to contain a valid XML representation of a
Text
object as defined in the render extension specification.
This method is normally called when render information is read from a file and
should normally not have to be called explicitly.
node
- the XMLNode
object reference that describes the Text
object to be instantiated.SBMLConstructorException
public Text(XMLNode node) throws SBMLConstructorException
Text
object from the given XMLNode
object.
The XMLNode
object has to contain a valid XML representation of a
Text
object as defined in the render extension specification.
This method is normally called when render information is read from a file and
should normally not have to be called explicitly.
node
- the XMLNode
object reference that describes the Text
object to be instantiated.SBMLConstructorException
public Text(RenderPkgNamespaces renderns, String id, RelAbsVector x, RelAbsVector y, RelAbsVector z) throws SBMLConstructorException
Text
object with the given id
and position offset.
The position offset coordinates can be omitted and will be set to 0 in
that case.
All attributes are set as described for the default constructor
of GraphicalPrimitive1D
.
All the font rendering attributes as well
as the text to be rendered are unset.
id
- id string for the Text
objectx
- x coordinate of the position offsety
- y coordinate of the position offsetz
- z coordinate of the position offset
This constructor is deprecated. The new libsbml API only has
constructors which take the SBML level and version or one that takes
an SBMLNamespaces
object.
SBMLConstructorException
public Text(RenderPkgNamespaces renderns, String id, RelAbsVector x, RelAbsVector y) throws SBMLConstructorException
Text
object with the given id
and position offset.
The position offset coordinates can be omitted and will be set to 0 in
that case.
All attributes are set as described for the default constructor
of GraphicalPrimitive1D
.
All the font rendering attributes as well
as the text to be rendered are unset.
id
- id string for the Text
objectx
- x coordinate of the position offsety
- y coordinate of the position offsetz
- z coordinate of the position offset
This constructor is deprecated. The new libsbml API only has
constructors which take the SBML level and version or one that takes
an SBMLNamespaces
object.
SBMLConstructorException
public Text(RenderPkgNamespaces renderns, String id, RelAbsVector x) throws SBMLConstructorException
Text
object with the given id
and position offset.
The position offset coordinates can be omitted and will be set to 0 in
that case.
All attributes are set as described for the default constructor
of GraphicalPrimitive1D
.
All the font rendering attributes as well
as the text to be rendered are unset.
id
- id string for the Text
objectx
- x coordinate of the position offsety
- y coordinate of the position offsetz
- z coordinate of the position offset
This constructor is deprecated. The new libsbml API only has
constructors which take the SBML level and version or one that takes
an SBMLNamespaces
object.
SBMLConstructorException
public Text(RenderPkgNamespaces renderns, String id) throws SBMLConstructorException
Text
object with the given id
and position offset.
The position offset coordinates can be omitted and will be set to 0 in
that case.
All attributes are set as described for the default constructor
of GraphicalPrimitive1D
.
All the font rendering attributes as well
as the text to be rendered are unset.
id
- id string for the Text
objectx
- x coordinate of the position offsety
- y coordinate of the position offsetz
- z coordinate of the position offset
This constructor is deprecated. The new libsbml API only has
constructors which take the SBML level and version or one that takes
an SBMLNamespaces
object.
SBMLConstructorException
public void delete()
In general, application software will not need to call this method directly. The Java language binding for libSBML is implemented as a language wrapper that provides a Java interface to libSBML's underlying C++/C code. Some of the Java methods return objects that are linked to objects created not by Java code, but by C++ code. The Java objects wrapped around them will be deleted when the garbage collector invokes the corresponding C++ finalize()
methods for the objects. The finalize()
methods in turn call the Text.delete()
method on the libSBML object.
This method is exposed in case calling programs want to ensure that the underlying object is freed immediately, and not at some arbitrary time determined by the Java garbage collector. In normal usage, callers do not need to invoke Text.delete()
themselves.
delete
 in class GraphicalPrimitive1D
public void setCoordinates(RelAbsVector x, RelAbsVector y, RelAbsVector z)
x
- x coordinate of the position offsety
- y coordinate of the position offsetz
- z coordinate of the position offsetpublic void setCoordinates(RelAbsVector x, RelAbsVector y)
x
- x coordinate of the position offsety
- y coordinate of the position offsetz
- z coordinate of the position offsetpublic void setX(RelAbsVector x)
x
- x coordinate of the position offsetpublic void setY(RelAbsVector y)
y
- y coordinate of the position offsetpublic void setZ(RelAbsVector z)
z
- z coordinate of the position offsetpublic RelAbsVector getX()
public RelAbsVector getY()
public RelAbsVector getZ()
public void setFontFamily(String family)
family
- The name of the font family, e.g. Helveticapublic void setFontSize(RelAbsVector size)
size
- the new font size.public void setFontWeight(int weight)
weight
- The new text weight to be set.public void setFontStyle(int style)
style
- The new font style to be set.public void setTextAnchor(int anchor)
anchor
- The new horizontal alignment flag.public void setVTextAnchor(int anchor)
anchor
- The new vertical alignment flag.public String getFontFamily()
public RelAbsVector getFontSize()
public int getFontWeight()
public int getFontStyle()
public int getTextAnchor()
public int getVTextAnchor()
public boolean isSetTextAnchor()
public boolean isSetVTextAnchor()
public String getText()
Text
object.
Text
object.public void setText(String text)
text
- The text to be rendered for the Text
object.public boolean isSetText()
public Text cloneObject()
SBase
object.
cloneObject
 in class SBase
SBase
object.public int getTypeCode()
LibSBML attaches an identifying code to every kind of SBML object. These
are integer constants known as SBML type codes. The names of all
the codes begin with the characters SBML_
.
In the Java language interface for libSBML, the
type codes are defined as static integer constants in the interface class
libsbmlConstants
. Note that different Level 3
package plug-ins may use overlapping type codes to identify the package
to which a given object belongs, call the getPackageName()
method on the object.
Here follow some additional general information about libSBML type codes:
SBase
subclass (e.g. SBMLLayoutTypeCode_t
for the SBML Level 3
Layout extension, SBMLFbcTypeCode_t
for the SBML Level 3 Flux
Balance Constraints extension, etc.).
SBase.getTypeCode()
and SBase.getPackageName()
must be
checked. This is particularly important for functions that take an SBML
type code as an argument, such as
SBase.getAncestorOfType(int, String)
, which by
default assumes you are handing it a core type, and will return null
if
the value you give it is actually from a package.
The following example code illustrates the combined use of
SBase.getPackageName()
and SBase.getTypeCode()
:
void example (SBase sb) { String pkgName = sb.getPackageName() if (pkgName.equals('core')) { switch (sb.getTypeCode()) { case libsbml.SBML_MODEL: .... break case libsbml.SBML_REACTION: .... } } else if (pkgName.equals('layout')) { switch (sb.getTypeCode()) { case libsbml.SBML_LAYOUT_LAYOUT: .... break case libsbml.SBML_LAYOUT_REACTIONGLYPH: .... } } ... }
getTypeCode
 in class SBase
SBML_UNKNOWN
(the default). The latter is possible because
subclasses of SBase
are not required to implement this method to return
a type code.
SBase.getPackageName()
,
Text.getElementName()
public boolean isSetFontFamily()
public boolean isSetFontSize()
RelAbsVector
specifying the font size does not
contain NaN either as the absolute or the relative value.public boolean isSetFontWeight()
public boolean isSetFontStyle()
public XMLNode toXML()
XMLNode
object from this GraphicalPrimitive1D
object.
toXML
 in class GraphicalPrimitive1D
XMLNode
with the XML representation for the
GraphicalPrimitive1D
object.
This method is purely virtual and has to be implemented by subclasses.