public class ColorDefinition extends SBase
A ColorDefinition specifies an id for a certain RGBA value which can then be referenced by this id in other render extension constructs. The use of ids like e.g. 'lightyellow' might be more descriptive than the corresponding RGBA value.
A ColorDefinition
has two mandatory attributes which are the id for the
color definition and the corresponding RGBA value. The RGBA value has the
same notation as in HTML files or CSS style sheets. It starts with the '#'
character followed by 8 digit hexadecimal string. Optionally the alpha part
can be omited in which case it defaults to FF.
Valid value string are e.g. '#000000' or '#000000FF' for fully opaque black or '#FF000010' for an almost completly transparent red.
Internally the RGBA components are stored as integer values in the range of 0 to 255 and most methods use integer values instead of the hexadecimal value string.
Constructor and Description |
---|
ColorDefinition()
Creates a new
ColorDefinition object with the given SBML level
and SBML version. |
ColorDefinition(long level)
Creates a new
ColorDefinition object with the given SBML level
and SBML version. |
ColorDefinition(long level,
long version)
Creates a new
ColorDefinition object with the given SBML level
and SBML version. |
ColorDefinition(long level,
long version,
long pkgVersion)
Creates a new
ColorDefinition object with the given SBML level
and SBML version. |
ColorDefinition(RenderPkgNamespaces renderns)
Creates a new
ColorDefinition object with the given SBMLNamespaces . |
ColorDefinition(RenderPkgNamespaces renderns,
short r,
short g,
short b)
Constructor which sets the
ColorDefinition to the given RGBA values. |
ColorDefinition(RenderPkgNamespaces renderns,
short r,
short g,
short b,
short a)
Constructor which sets the
ColorDefinition to the given RGBA values. |
ColorDefinition(RenderPkgNamespaces renderns,
java.lang.String id)
Constructor which sets the
ColorDefinition to completely opaque
black and sets the id to the given string. |
ColorDefinition(RenderPkgNamespaces renderns,
java.lang.String id,
short r,
short g,
short b)
Constructor which sets the
ColorDefinition to the given RGBA values
and sets the id. |
ColorDefinition(RenderPkgNamespaces renderns,
java.lang.String id,
short r,
short g,
short b,
short a)
Constructor which sets the
ColorDefinition to the given RGBA values
and sets the id. |
ColorDefinition(XMLNode node)
Creates a new
ColorDefinition object from the given XMLNode object. |
ColorDefinition(XMLNode node,
long l2version)
Creates a new
ColorDefinition object from the given XMLNode object. |
Modifier and Type | Method and Description |
---|---|
ColorDefinition |
cloneObject()
Creates and returns a deep copy of this
ColorDefinition object. |
java.lang.String |
createValueString()
Creates a string the represents the current color value.
|
void |
delete()
Explicitly deletes the underlying native object.
|
short |
getAlpha()
Returns the alpha color component.
|
short |
getBlue()
Returns the blue color component.
|
java.lang.String |
getElementName()
Returns the XML element name of this object.
|
short |
getGreen()
Returns the green color component.
|
java.lang.String |
getId()
Returns the value of the 'id' attribute of this
ColorDefinition . |
short |
getRed()
Returns the red color component.
|
int |
getTypeCode()
Returns the libSBML type code for this SBML object.
|
boolean |
isSetId()
Predicate returning
true or false depending on whether this
GraphicalPrimitive's 'id' attribute has been set. |
void |
setAlpha(short c)
Sets alpha red color component.
|
void |
setBlue(short c)
Sets the blue color component.
|
boolean |
setColorValue(java.lang.String valueString)
Sets the color value from a given value string.
|
void |
setGreen(short c)
Sets the green color component.
|
int |
setId(java.lang.String id)
Sets the value of the 'id' attribute of this GraphicalPrimitive.
|
void |
setRed(short c)
Sets the red color component.
|
void |
setRGBA(short r,
short g,
short b)
Sets the red green, blue and alpha color component.
|
void |
setRGBA(short r,
short g,
short b,
short a)
Sets the red green, blue and alpha color component.
|
XMLNode |
toXML()
Creates an
XMLNode object from this ColorDefinition object. |
int |
unsetId()
Unsets the value of the 'id' attribute of this
ColorDefinition . |
addCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getElementByMetaId, getElementBySId, getLevel, getLine, getListOfAllElements, getListOfAllElements, getListOfAllElementsFromPlugins, getListOfAllElementsFromPlugins, getMetaId, getModel, getModelHistory, getNamespaces, getNotes, getNotesString, getNumCVTerms, getNumPlugins, getPackageName, getPackageVersion, getParentSBMLObject, getPlugin, getPlugin, getPrefix, getResourceBiologicalQualifier, getResourceModelQualifier, getSBMLDocument, getSBOTerm, getSBOTermAsURL, getSBOTermID, getURI, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isSetAnnotation, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, 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
public ColorDefinition() throws SBMLConstructorException
ColorDefinition
object with the given SBML level
and SBML version.
level
- SBML level of the new objectlevel
- SBML version of the new objectSBMLConstructorException
public ColorDefinition(long level) throws SBMLConstructorException
ColorDefinition
object with the given SBML level
and SBML version.
level
- SBML level of the new objectlevel
- SBML version of the new objectSBMLConstructorException
public ColorDefinition(long level, long version) throws SBMLConstructorException
ColorDefinition
object with the given SBML level
and SBML version.
level
- SBML level of the new objectlevel
- SBML version of the new objectSBMLConstructorException
public ColorDefinition(long level, long version, long pkgVersion) throws SBMLConstructorException
ColorDefinition
object with the given SBML level
and SBML version.
level
- SBML level of the new objectlevel
- SBML version of the new objectSBMLConstructorException
public ColorDefinition(RenderPkgNamespaces renderns) throws SBMLConstructorException
ColorDefinition
object with the given SBMLNamespaces
.
sbmlns
- The SBML namespace for the object.SBMLConstructorException
public ColorDefinition(RenderPkgNamespaces renderns, short r, short g, short b) throws SBMLConstructorException
ColorDefinition
to the given RGBA values.
r
- Red component value. Has to be in the range of 0 to 255.g
- Green component value. Has to be in the range of 0 to 255.b
- Blue component value. Has to be in the range of 0 to 255.a
- Alpha component value. Has to be in the range of 0 to 255.
The alpha component can be omitted. In that case it has a default value of 255.
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 ColorDefinition(RenderPkgNamespaces renderns, short r, short g, short b, short a) throws SBMLConstructorException
ColorDefinition
to the given RGBA values.
r
- Red component value. Has to be in the range of 0 to 255.g
- Green component value. Has to be in the range of 0 to 255.b
- Blue component value. Has to be in the range of 0 to 255.a
- Alpha component value. Has to be in the range of 0 to 255.
The alpha component can be omitted. In that case it has a default value of 255.
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 ColorDefinition(RenderPkgNamespaces renderns, java.lang.String id) throws SBMLConstructorException
ColorDefinition
to completely opaque
black and sets the id to the given string.
id
- the id of the color definition. The user has to make sure
that the id is unique within the given set of color definitions.
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 ColorDefinition(RenderPkgNamespaces renderns, java.lang.String id, short r, short g, short b) throws SBMLConstructorException
ColorDefinition
to the given RGBA values
and sets the id.
id
- the id of the color definition. The user has to make sure
that the id is unique within the given set of color definitions.r
- Red component value. Has to be in the range of 0 to 255.g
- Green component value. Has to be in the range of 0 to 255.b
- Blue component value. Has to be in the range of 0 to 255.a
- Alpha component value. Has to be in the range of 0 to 255.
The alpha component can be omitted. In that case it has a default value of 255.
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 ColorDefinition(RenderPkgNamespaces renderns, java.lang.String id, short r, short g, short b, short a) throws SBMLConstructorException
ColorDefinition
to the given RGBA values
and sets the id.
id
- the id of the color definition. The user has to make sure
that the id is unique within the given set of color definitions.r
- Red component value. Has to be in the range of 0 to 255.g
- Green component value. Has to be in the range of 0 to 255.b
- Blue component value. Has to be in the range of 0 to 255.a
- Alpha component value. Has to be in the range of 0 to 255.
The alpha component can be omitted. In that case it has a default value of 255.
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 ColorDefinition(XMLNode node) throws SBMLConstructorException
ColorDefinition
object from the given XMLNode
object.
The XMLNode
object has to contain a valid XML representation of a
ColorDefinition
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 explicitely.
(FOR BACKWARD COMPATIBILITY)
node
- the XMLNode
object reference that describes the ColorDefinition
object to be instantiated.SBMLConstructorException
public ColorDefinition(XMLNode node, long l2version) throws SBMLConstructorException
ColorDefinition
object from the given XMLNode
object.
The XMLNode
object has to contain a valid XML representation of a
ColorDefinition
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 explicitely.
(FOR BACKWARD COMPATIBILITY)
node
- the XMLNode
object reference that describes the ColorDefinition
object to be instantiated.SBMLConstructorException
public ColorDefinition cloneObject()
ColorDefinition
object.
cloneObject
 in class SBase
ColorDefinition
objectpublic java.lang.String createValueString()
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 ColorDefinition.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 ColorDefinition.delete()
themselves.
public short getAlpha()
ColorDefinition
.public short getBlue()
ColorDefinition
.public java.lang.String getElementName()
This is overridden by subclasses to return a string appropriate to the
SBML component. For example, Model
defines it as returning 'model',
CompartmentType
defines it as returning 'compartmentType', etc.
getElementName
 in class SBase
public short getGreen()
ColorDefinition
.public java.lang.String getId()
ColorDefinition
.
getId
 in class SBase
ColorDefinition
public short getRed()
ColorDefinition
.public int getTypeCode()
LibSBML attaches an
identifying code to every kind of SBML object. These are known as
SBML type codes. In other languages, the set of type codes
is stored in an enumeration in the Java language interface for
libSBML, the type codes are defined as static integer constants in
interface class libsbmlConstants
. The names of the type codes
all begin with the characters SBML_.
getTypeCode
 in class SBase
SBML_UNKNOWN
(default).
ColorDefinition.getElementName()
public boolean isSetId()
true
or false
depending on whether this
GraphicalPrimitive's 'id' attribute has been set.
public void setAlpha(short c)
c
- the new alpha component value for the color definition.public void setBlue(short c)
c
- the new blue component value for the color definition.public boolean setColorValue(java.lang.String valueString)
valueString
- A const reference to a string that represents a valid color value,
e.g. '#FFFFFFFF' for fully opaque white.
public void setGreen(short c)
c
- the new green component value for the color definition.public int setId(java.lang.String id)
public void setRed(short c)
c
- the new red component value for the color definition.public void setRGBA(short r, short g, short b)
r
- Red component value. Has to be in the range of 0 to 255.g
- Green component value. Has to be in the range of 0 to 255.b
- Blue component value. Has to be in the range of 0 to 255.a
- Alpha component value. Has to be in the range of 0 to 255.
The alpha component can be omitted. In that case it has a default value of 255.public void setRGBA(short r, short g, short b, short a)
r
- Red component value. Has to be in the range of 0 to 255.g
- Green component value. Has to be in the range of 0 to 255.b
- Blue component value. Has to be in the range of 0 to 255.a
- Alpha component value. Has to be in the range of 0 to 255.
The alpha component can be omitted. In that case it has a default value of 255.public XMLNode toXML()
XMLNode
object from this ColorDefinition
object.
XMLNode
with the XML representation for the
ColorDefinition
object.public int unsetId()
ColorDefinition
.