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 * implementation of the {@link GlobalStyle} concept of the SBML render extension. 013 <p> 014 * Global styles are the style information objects used in {@link GlobalRenderInformation} (@see GlobalRenderInformation). 015 * Global styles can be associated with layout objects by role and type, but not by id, otherwise global 016 * styles and local styles are equivalent. 017 @see Style) 018 */ 019 020public class GlobalStyle extends Style { 021 private long swigCPtr; 022 023 protected GlobalStyle(long cPtr, boolean cMemoryOwn) 024 { 025 super(libsbmlJNI.GlobalStyle_SWIGUpcast(cPtr), cMemoryOwn); 026 swigCPtr = cPtr; 027 } 028 029 protected static long getCPtr(GlobalStyle obj) 030 { 031 return (obj == null) ? 0 : obj.swigCPtr; 032 } 033 034 protected static long getCPtrAndDisown (GlobalStyle obj) 035 { 036 long ptr = 0; 037 038 if (obj != null) 039 { 040 ptr = obj.swigCPtr; 041 obj.swigCMemOwn = false; 042 } 043 044 return ptr; 045 } 046 047 protected void finalize() { 048 delete(); 049 } 050 051 public synchronized void delete() { 052 if (swigCPtr != 0) { 053 if (swigCMemOwn) { 054 swigCMemOwn = false; 055 libsbmlJNI.delete_GlobalStyle(swigCPtr); 056 } 057 swigCPtr = 0; 058 } 059 super.delete(); 060 } 061 062 063/** 064 * Creates a new {@link GlobalStyle} object with the given SBML level 065 * and SBML version. 066 <p> 067 * @param level SBML level of the new object 068 * @param level SBML version of the new object 069 */ public 070 GlobalStyle(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 071 this(libsbmlJNI.new_GlobalStyle__SWIG_0(level, version, pkgVersion), true); 072 } 073 074 075/** 076 * Creates a new {@link GlobalStyle} object with the given SBML level 077 * and SBML version. 078 <p> 079 * @param level SBML level of the new object 080 * @param level SBML version of the new object 081 */ public 082 GlobalStyle(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 083 this(libsbmlJNI.new_GlobalStyle__SWIG_1(level, version), true); 084 } 085 086 087/** 088 * Creates a new {@link GlobalStyle} object with the given SBML level 089 * and SBML version. 090 <p> 091 * @param level SBML level of the new object 092 * @param level SBML version of the new object 093 */ public 094 GlobalStyle(long level) throws org.sbml.libsbml.SBMLConstructorException { 095 this(libsbmlJNI.new_GlobalStyle__SWIG_2(level), true); 096 } 097 098 099/** 100 * Creates a new {@link GlobalStyle} object with the given SBML level 101 * and SBML version. 102 <p> 103 * @param level SBML level of the new object 104 * @param level SBML version of the new object 105 */ public 106 GlobalStyle() throws org.sbml.libsbml.SBMLConstructorException { 107 this(libsbmlJNI.new_GlobalStyle__SWIG_3(), true); 108 } 109 110 111/** 112 * Creates a new {@link GlobalStyle} object with the given {@link SBMLNamespaces}. 113 <p> 114 * @param sbmlns The SBML namespace for the object. 115 */ public 116 GlobalStyle(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException { 117 this(libsbmlJNI.new_GlobalStyle__SWIG_4(RenderPkgNamespaces.getCPtr(renderns), renderns), true); 118 } 119 120 121/** 122 * Creates a new {@link GlobalStyle} object from the given {@link XMLNode} object. 123 * The {@link XMLNode} object has to contain a valid XML representation of a 124 * {@link GlobalStyle} object as defined in the render extension specification. 125 * This method is normally called when render information is read from a file and 126 * should normally not have to be called explicitely. 127 <p> 128 * @param node the {@link XMLNode} object reference that describes the {@link GlobalStyle} 129 * object to be instantiated. 130 */ public 131 GlobalStyle(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException { 132 this(libsbmlJNI.new_GlobalStyle__SWIG_5(XMLNode.getCPtr(node), node, l2version), true); 133 } 134 135 136/** 137 * Creates a new {@link GlobalStyle} object from the given {@link XMLNode} object. 138 * The {@link XMLNode} object has to contain a valid XML representation of a 139 * {@link GlobalStyle} object as defined in the render extension specification. 140 * This method is normally called when render information is read from a file and 141 * should normally not have to be called explicitely. 142 <p> 143 * @param node the {@link XMLNode} object reference that describes the {@link GlobalStyle} 144 * object to be instantiated. 145 */ public 146 GlobalStyle(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException { 147 this(libsbmlJNI.new_GlobalStyle__SWIG_6(XMLNode.getCPtr(node), node), true); 148 } 149 150 151/** 152 * Constructor which creates a {@link GlobalStyle} with the given <code>id</code> 153 * and all lists empty. 154 <p> 155 * @param id the new id for the {@link GlobalStyle}. 156 <p> 157 * This constructor is deprecated. The new libsbml API only has 158 * constructors which take the SBML level and version or one that takes 159 * an {@link SBMLNamespaces} object. 160 */ public 161 GlobalStyle(RenderPkgNamespaces renderns, String id) throws org.sbml.libsbml.SBMLConstructorException { 162 this(libsbmlJNI.new_GlobalStyle__SWIG_7(RenderPkgNamespaces.getCPtr(renderns), renderns, id), true); 163 } 164 165 166/** 167 * Returns the libSBML type code for this SBML object. 168 <p> 169 * LibSBML attaches an 170 * identifying code to every kind of SBML object. These are known as 171 * <em>SBML type codes</em>. In other languages, the set of type codes 172 * is stored in an enumeration; in the Java language interface for 173 * libSBML, the type codes are defined as static integer constants in 174 * interface class {@link libsbmlConstants}. The names of the type codes 175 * all begin with the characters <code>SBML_.</code> 176 <p> 177 * @return the SBML type code for this object, or <code>SBML_UNKNOWN</code> (default). 178 <p> 179 * This method is purely abstract and has to be implemented by derived 180 * classes. 181 <p> 182 * @see #getElementName() 183 */ public 184 int getTypeCode() { 185 return libsbmlJNI.GlobalStyle_getTypeCode(swigCPtr, this); 186 } 187 188 189/** 190 * Returns the XML element name of this object, which for 191 * {@link GlobalStyle}, is always <code>'renderInformation'.</code> 192 <p> 193 * @return the name of this element, i.e., <code>'renderInformation'.</code> 194 */ public 195 String getElementName() { 196 return libsbmlJNI.GlobalStyle_getElementName(swigCPtr, this); 197 } 198 199 200/** 201 * Creates and returns a deep copy of this {@link GlobalStyle} object. 202 <p> 203 * @return a (deep) copy of this {@link GlobalStyle}. 204 */ public 205 GlobalStyle cloneObject() { 206 long cPtr = libsbmlJNI.GlobalStyle_cloneObject(swigCPtr, this); 207 return (cPtr == 0) ? null : new GlobalStyle(cPtr, true); 208 } 209 210}