001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.12 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.sbml.libsbml; 010 011/** 012 * <span class="pkg-marker pkg-color-layout"><a href="group__layout.html">layout</a></span> 013 014 The TextGlyph class describes the position and 015 * dimension of text labels in the “layout” package. 016 <p> 017 * It inherits from {@link GraphicalObject} and adds the attributes graphicalObject, 018 * text and originOfText. 019 */ 020 021public class TextGlyph extends GraphicalObject { 022 private long swigCPtr; 023 024 protected TextGlyph(long cPtr, boolean cMemoryOwn) 025 { 026 super(libsbmlJNI.TextGlyph_SWIGUpcast(cPtr), cMemoryOwn); 027 swigCPtr = cPtr; 028 } 029 030 protected static long getCPtr(TextGlyph obj) 031 { 032 return (obj == null) ? 0 : obj.swigCPtr; 033 } 034 035 protected static long getCPtrAndDisown (TextGlyph obj) 036 { 037 long ptr = 0; 038 039 if (obj != null) 040 { 041 ptr = obj.swigCPtr; 042 obj.swigCMemOwn = false; 043 } 044 045 return ptr; 046 } 047 048 protected void finalize() { 049 delete(); 050 } 051 052 public synchronized void delete() { 053 if (swigCPtr != 0) { 054 if (swigCMemOwn) { 055 swigCMemOwn = false; 056 libsbmlJNI.delete_TextGlyph(swigCPtr); 057 } 058 swigCPtr = 0; 059 } 060 super.delete(); 061 } 062 063 064/** 065 * Creates a new {@link TextGlyph} with the given SBML level, versin and package 066 * version. The ids of the associated {@link GraphicalObject} and 067 * the originOfText are set to the empty string. The actual text is set 068 * to the empty string as well. 069 */ public 070 TextGlyph(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 071 this(libsbmlJNI.new_TextGlyph__SWIG_0(level, version, pkgVersion), true); 072 } 073 074 075/** 076 * Creates a new {@link TextGlyph} with the given SBML level, versin and package 077 * version. The ids of the associated {@link GraphicalObject} and 078 * the originOfText are set to the empty string. The actual text is set 079 * to the empty string as well. 080 */ public 081 TextGlyph(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 082 this(libsbmlJNI.new_TextGlyph__SWIG_1(level, version), true); 083 } 084 085 086/** 087 * Creates a new {@link TextGlyph} with the given SBML level, versin and package 088 * version. The ids of the associated {@link GraphicalObject} and 089 * the originOfText are set to the empty string. The actual text is set 090 * to the empty string as well. 091 */ public 092 TextGlyph(long level) throws org.sbml.libsbml.SBMLConstructorException { 093 this(libsbmlJNI.new_TextGlyph__SWIG_2(level), true); 094 } 095 096 097/** 098 * Creates a new {@link TextGlyph} with the given SBML level, versin and package 099 * version. The ids of the associated {@link GraphicalObject} and 100 * the originOfText are set to the empty string. The actual text is set 101 * to the empty string as well. 102 */ public 103 TextGlyph() throws org.sbml.libsbml.SBMLConstructorException { 104 this(libsbmlJNI.new_TextGlyph__SWIG_3(), true); 105 } 106 107 108/** 109 * Ctor. 110 */ public 111 TextGlyph(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException { 112 this(libsbmlJNI.new_TextGlyph__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true); 113 } 114 115 116/** 117 * Creates a new {@link TextGlyph}. The id is given as the first argument. 118 <p> 119 * (FOR BACKWARD COMPATIBILITY) 120 */ public 121 TextGlyph(LayoutPkgNamespaces layoutns, String id) throws org.sbml.libsbml.SBMLConstructorException { 122 this(libsbmlJNI.new_TextGlyph__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id), true); 123 } 124 125 126/** 127 * Creates a new {@link TextGlyph}. The id is given as the first argument, the 128 * text to be displayed as the second. All other attirbutes are set to 129 * the empty string. 130 <p> 131 * (FOR BACKWARD COMPATIBILITY) 132 */ public 133 TextGlyph(LayoutPkgNamespaces layoutns, String id, String text) throws org.sbml.libsbml.SBMLConstructorException { 134 this(libsbmlJNI.new_TextGlyph__SWIG_6(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, text), true); 135 } 136 137 138/** 139 * Creates a new {@link TextGlyph} from the given {@link XMLNode} 140 <p> 141 * (FOR BACKWARD COMPATIBILITY) 142 */ public 143 TextGlyph(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException { 144 this(libsbmlJNI.new_TextGlyph__SWIG_7(XMLNode.getCPtr(node), node, l2version), true); 145 } 146 147 148/** 149 * Creates a new {@link TextGlyph} from the given {@link XMLNode} 150 <p> 151 * (FOR BACKWARD COMPATIBILITY) 152 */ public 153 TextGlyph(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException { 154 this(libsbmlJNI.new_TextGlyph__SWIG_8(XMLNode.getCPtr(node), node), true); 155 } 156 157 158/** 159 * Copy constructor. 160 */ public 161 TextGlyph(TextGlyph source) throws org.sbml.libsbml.SBMLConstructorException { 162 this(libsbmlJNI.new_TextGlyph__SWIG_9(TextGlyph.getCPtr(source), source), true); 163 } 164 165 166/** 167 * Renames all the <code>SIdRef</code> attributes on this element, including any 168 * found in MathML content (if such exists). 169 <p> 170 * This method works by looking at all attributes and (if appropriate) 171 * mathematical formulas, comparing the identifiers to the value of 172 * <code>oldid</code>. If any matches are found, the matching identifiers are replaced 173 * with <code>newid</code>. The method does <em>not</em> descend into child elements. 174 <p> 175 * @param oldid the old identifier 176 * @param newid the new identifier 177 */ public 178 void renameSIdRefs(String oldid, String newid) { 179 libsbmlJNI.TextGlyph_renameSIdRefs(swigCPtr, this, oldid, newid); 180 } 181 182 183/** 184 * Returns the text to be displayed by the text glyph. 185 */ public 186 String getText() { 187 return libsbmlJNI.TextGlyph_getText(swigCPtr, this); 188 } 189 190 191/** 192 * Sets the text to be displayed by the text glyph. 193 */ public 194 void setText(String text) { 195 libsbmlJNI.TextGlyph_setText(swigCPtr, this, text); 196 } 197 198 199/** 200 * Returns the id of the associated graphical object. 201 */ public 202 String getGraphicalObjectId() { 203 return libsbmlJNI.TextGlyph_getGraphicalObjectId(swigCPtr, this); 204 } 205 206 207/** 208 * Sets the id of the associated graphical object. 209 */ public 210 int setGraphicalObjectId(String id) { 211 return libsbmlJNI.TextGlyph_setGraphicalObjectId(swigCPtr, this, id); 212 } 213 214 215/** 216 * Returns the id of the origin of text. 217 */ public 218 String getOriginOfTextId() { 219 return libsbmlJNI.TextGlyph_getOriginOfTextId(swigCPtr, this); 220 } 221 222 223/** 224 * Sets the id of the origin of text. 225 */ public 226 int setOriginOfTextId(String orig) { 227 return libsbmlJNI.TextGlyph_setOriginOfTextId(swigCPtr, this, orig); 228 } 229 230 231/** 232 * Returns true if the text is not the empty string. 233 */ public 234 boolean isSetText() { 235 return libsbmlJNI.TextGlyph_isSetText(swigCPtr, this); 236 } 237 238 239/** 240 * Returns true if the id of the origin of text is not the empty string. 241 */ public 242 boolean isSetOriginOfTextId() { 243 return libsbmlJNI.TextGlyph_isSetOriginOfTextId(swigCPtr, this); 244 } 245 246 247/** 248 * Returns true if the id of the associated graphical object is not the 249 * empty string. 250 */ public 251 boolean isSetGraphicalObjectId() { 252 return libsbmlJNI.TextGlyph_isSetGraphicalObjectId(swigCPtr, this); 253 } 254 255 256/** 257 * Calls initDefaults from {@link GraphicalObject}. 258 */ public 259 void initDefaults() { 260 libsbmlJNI.TextGlyph_initDefaults(swigCPtr, this); 261 } 262 263 264/** 265 * Returns the XML element name of 266 * this SBML object. 267 */ public 268 String getElementName() { 269 return libsbmlJNI.TextGlyph_getElementName(swigCPtr, this); 270 } 271 272 273/** 274 * Creates and returns a deep copy of this {@link TextGlyph}. 275 <p> 276 * @return a (deep) copy of this {@link TextGlyph}. 277 */ public 278 TextGlyph cloneObject() { 279 long cPtr = libsbmlJNI.TextGlyph_cloneObject(swigCPtr, this); 280 return (cPtr == 0) ? null : new TextGlyph(cPtr, true); 281 } 282 283 284/** 285 * Returns the libSBML type code of this object instance. 286 <p> 287 * <p> 288 * LibSBML attaches an identifying code to every kind of SBML object. These 289 * are integer constants known as <em>SBML type codes</em>. The names of all 290 * the codes begin with the characters “<code>SBML_</code>”. 291 * In the Java language interface for libSBML, the 292 * type codes are defined as static integer constants in the interface class 293 * {@link libsbmlConstants}. Note that different Level 3 294 * package plug-ins may use overlapping type codes; to identify the package 295 * to which a given object belongs, call the <code>getPackageName()</code> 296 * method on the object. 297 <p> 298 * @return the SBML type code for this object: 299 * {@link libsbmlConstants#SBML_LAYOUT_TEXTGLYPH SBML_LAYOUT_TEXTGLYPH} 300 <p> 301 * <p> 302 * @warning <span class='warning'>The specific integer values of the possible 303 * type codes may be reused by different Level 3 package plug-ins. 304 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 305 * both getTypeCode() and getPackageName()</strong>.</span> 306 <p> 307 * @see #getElementName() 308 * @see #getPackageName() 309 */ public 310 int getTypeCode() { 311 return libsbmlJNI.TextGlyph_getTypeCode(swigCPtr, this); 312 } 313 314 315/** 316 * Creates an {@link XMLNode} object from this. 317 */ public 318 XMLNode toXML() { 319 return new XMLNode(libsbmlJNI.TextGlyph_toXML(swigCPtr, this), true); 320 } 321 322}