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, connectToChild, deleteDisabledPlugins, deleteDisabledPlugins, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getDisabledPlugin, getElementByMetaId, getElementBySId, 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, unsetUserDatapublic 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 objectSBMLConstructorExceptionpublic 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 objectSBMLConstructorExceptionpublic 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 objectSBMLConstructorExceptionpublic 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 objectSBMLConstructorExceptionpublic ColorDefinition(RenderPkgNamespaces renderns) throws SBMLConstructorException
ColorDefinition object with the given SBMLNamespaces.
sbmlns - The SBML namespace for the object.SBMLConstructorExceptionpublic 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 explicitly.
(FOR BACKWARD COMPATIBILITY)
node - the XMLNode object reference that describes the ColorDefinition
object to be instantiated.SBMLConstructorExceptionpublic 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 explicitly.
(FOR BACKWARD COMPATIBILITY)
node - the XMLNode object reference that describes the ColorDefinition
object to be instantiated.SBMLConstructorExceptionpublic 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.
SBMLConstructorExceptionpublic 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.
SBMLConstructorExceptionpublic 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.
SBMLConstructorExceptionpublic 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.
SBMLConstructorExceptionpublic 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.
SBMLConstructorExceptionpublic 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 getRed()
ColorDefinition.public short getGreen()
ColorDefinition.public short getBlue()
ColorDefinition.public short getAlpha()
ColorDefinition.public void setRed(short c)
c - the new red component value for the color definition.public void setGreen(short c)
c - the new green component value for the color definition.public void setBlue(short c)
c - the new blue component value for the color definition.public void setAlpha(short c)
c - the new alpha component value for the color definition.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 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 boolean setColorValue(java.lang.String valueString)
valueString - A reference to a string that represents a valid color value,
e.g. '#FFFFFFFF' for fully opaque white.
public java.lang.String createValueString()
public ColorDefinition cloneObject()
ColorDefinition object.
cloneObject in class SBaseColorDefinition objectpublic 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 SBasepublic 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 SBaseSBML_UNKNOWN (default).
ColorDefinition.getElementName()public XMLNode toXML()
XMLNode object from this ColorDefinition object.
XMLNode with the XML representation for the
ColorDefinition object.public java.lang.String getId()
ColorDefinition.
getId in class SBaseColorDefinitionpublic boolean isSetId()
true or false depending on whether this
GraphicalPrimitive's 'id' attribute has been set.
public int setId(java.lang.String id)
public int unsetId()
ColorDefinition.