001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.7
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 * {@link GlobalRenderInformation} is the render information stored in the {@link ListOfLayouts}. {@link GlobalRenderInformation} can be
013 *  applied to all layouts.
014 <p>
015 * {@link GlobalRenderInformation} is one of the subclasses of {@link RenderInformationBase}. A global render information object
016 * contains color definitions, gradient definitions and line endings as defined in {@link RenderInformationBase}.
017 * Additionally it has a list of global styles which specifies type and role based render information.
018 * Global render information can not specify id based render information because it does not belong to a certain layout
019 * but it belongs to all layouts.
020 */
021
022public class GlobalRenderInformation extends RenderInformationBase {
023   private long swigCPtr;
024
025   protected GlobalRenderInformation(long cPtr, boolean cMemoryOwn)
026   {
027     super(libsbmlJNI.GlobalRenderInformation_SWIGUpcast(cPtr), cMemoryOwn);
028     swigCPtr = cPtr;
029   }
030
031   protected static long getCPtr(GlobalRenderInformation obj)
032   {
033     return (obj == null) ? 0 : obj.swigCPtr;
034   }
035
036   protected static long getCPtrAndDisown (GlobalRenderInformation obj)
037   {
038     long ptr = 0;
039
040     if (obj != null)
041     {
042       ptr             = obj.swigCPtr;
043       obj.swigCMemOwn = false;
044     }
045
046     return ptr;
047   }
048
049  protected void finalize() {
050    delete();
051  }
052
053  public synchronized void delete() {
054    if (swigCPtr != 0) {
055      if (swigCMemOwn) {
056        swigCMemOwn = false;
057        libsbmlJNI.delete_GlobalRenderInformation(swigCPtr);
058      }
059      swigCPtr = 0;
060    }
061    super.delete();
062  }
063
064  
065/**
066   * Creates a new {@link GlobalRenderInformation} object with the given SBML level
067   * and SBML version.
068   <p>
069   * @param level SBML level of the new object
070   * @param level SBML version of the new object
071   */ public
072 GlobalRenderInformation(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
073    this(libsbmlJNI.new_GlobalRenderInformation__SWIG_0(level, version, pkgVersion), true);
074  }
075
076  
077/**
078   * Creates a new {@link GlobalRenderInformation} object with the given SBML level
079   * and SBML version.
080   <p>
081   * @param level SBML level of the new object
082   * @param level SBML version of the new object
083   */ public
084 GlobalRenderInformation(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
085    this(libsbmlJNI.new_GlobalRenderInformation__SWIG_1(level, version), true);
086  }
087
088  
089/**
090   * Creates a new {@link GlobalRenderInformation} object with the given SBML level
091   * and SBML version.
092   <p>
093   * @param level SBML level of the new object
094   * @param level SBML version of the new object
095   */ public
096 GlobalRenderInformation(long level) throws org.sbml.libsbml.SBMLConstructorException {
097    this(libsbmlJNI.new_GlobalRenderInformation__SWIG_2(level), true);
098  }
099
100  
101/**
102   * Creates a new {@link GlobalRenderInformation} object with the given SBML level
103   * and SBML version.
104   <p>
105   * @param level SBML level of the new object
106   * @param level SBML version of the new object
107   */ public
108 GlobalRenderInformation() throws org.sbml.libsbml.SBMLConstructorException {
109    this(libsbmlJNI.new_GlobalRenderInformation__SWIG_3(), true);
110  }
111
112  
113/**
114   * Creates a new {@link GlobalRenderInformation} object with the given {@link SBMLNamespaces}.
115   <p>
116   * @param sbmlns The SBML namespace for the object.
117   */ public
118 GlobalRenderInformation(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException {
119    this(libsbmlJNI.new_GlobalRenderInformation__SWIG_4(RenderPkgNamespaces.getCPtr(renderns), renderns), true);
120  }
121
122  
123/**
124   * Parses the xml information in the given node and sets the attributes.
125   * This method should never be called by the user. It is only used to read render 
126   * information from annotations.
127   <p>
128   * @param node the {@link XMLNode} object reference that describes the {@link GlobalRenderInformation}
129   * object to be instantiated.
130   */ public
131 void parseXML(XMLNode node) {
132    libsbmlJNI.GlobalRenderInformation_parseXML(swigCPtr, this, XMLNode.getCPtr(node), node);
133  }
134
135  
136/**
137   * Constructor which creates a {@link GlobalRenderInformation} with the given <code>id</code>
138   * and all lists empty.
139   <p>
140   * @param id the new id for the {@link GlobalRenderInformation}.
141   <p>
142   * This constructor is deprecated. The new libsbml API only has
143   * constructors which take the SBML level and version or one that takes
144   * an {@link SBMLNamespaces} object.
145   */ public
146 GlobalRenderInformation(RenderPkgNamespaces renderns, String id) throws org.sbml.libsbml.SBMLConstructorException {
147    this(libsbmlJNI.new_GlobalRenderInformation__SWIG_5(RenderPkgNamespaces.getCPtr(renderns), renderns, id), true);
148  }
149
150  
151/**
152   * Returns the number of styles.
153   <p>
154   * @return the number of global styles in the global render information object
155   */ public
156 long getNumStyles() {
157    return libsbmlJNI.GlobalRenderInformation_getNumStyles(swigCPtr, this);
158  }
159
160  
161/**
162   * Returns a pointer to the {@link ListOfGlobalStyles} object.
163   <p>
164   * @return pointer to the list of global styles.
165   */ public
166 ListOfGlobalStyles getListOfStyles() {
167    long cPtr = libsbmlJNI.GlobalRenderInformation_getListOfStyles__SWIG_0(swigCPtr, this);
168    return (cPtr == 0) ? null : new ListOfGlobalStyles(cPtr, false);
169  }
170
171  
172/**
173   * Returns a pointer to the style with the given index.
174   * If the index is invalid, <code>null</code> is returned.
175   <p>
176   * @param i index of the {@link GlobalStyle} to be returned.
177   <p>
178   * @return pointer to the style with the given index or null
179   */ public
180 GlobalStyle getStyle(long i) {
181    long cPtr = libsbmlJNI.GlobalRenderInformation_getStyle__SWIG_0(swigCPtr, this, i);
182    return (cPtr == 0) ? null : new GlobalStyle(cPtr, false);
183  }
184
185  
186/**
187   * Returns a pointer to the style with the given <code>id</code>.
188   * If the id is invalid, <code>null</code> is returned.
189   <p>
190   * @param id id of the {@link GlobalStyle} to be returned.
191   <p>
192   * @return pointer to the style with the given <code>id</code> or <code>null</code>
193   */ public
194 GlobalStyle getStyle(String id) {
195    long cPtr = libsbmlJNI.GlobalRenderInformation_getStyle__SWIG_2(swigCPtr, this, id);
196    return (cPtr == 0) ? null : new GlobalStyle(cPtr, false);
197  }
198
199  
200/**
201   * Creates a new {@link GlobalStyle} object. The object is added to and owned
202   * by the {@link GlobalRenderInformation} object.
203   <p>
204   * @param id for the new style.
205   <p>
206   * @ return a pointer to the newly created {@link GlobalStyle} object.
207   */ public
208 GlobalStyle createStyle(String id) {
209    long cPtr = libsbmlJNI.GlobalRenderInformation_createStyle(swigCPtr, this, id);
210    return (cPtr == 0) ? null : new GlobalStyle(cPtr, false);
211  }
212
213  
214/**
215   * Adds a copy of a {@link GlobalStyle} to the {@link GlobalRenderInformation} object.
216   * The style is only added if it is valid, i.e. it has to have an id and
217   * a valid group.
218   <p>
219   * @param pointer to the global style object to be added.
220   <p>
221   * @return integer value indicating success/failure of the
222   * function.   The possible values
223   * returned by this function are:
224   * <ul>
225   * <li> LIBSBML_OPERATION_SUCCESS
226   * <li> LIBSBML_LEVEL_MISMATCH
227   * <li> LIBSBML_VERSION_MISMATCH
228   * <li> LIBSBML_OPERATION_FAILED
229   *
230   * </ul> <p>
231   * @note This method should be used with some caution.  The fact that
232   * this method <em>copies</em> the object passed to it means that the caller
233   * will be left holding a physically different object instance than the
234   * one contained in this {@link GlobalRenderInformation}.  Changes made to the original object
235   * instance (such as resetting attribute values) will <em>not affect the
236   * instance in the {@link GlobalRenderInformation}</em>.  In addition, the caller should make
237   * sure to free the original object if it is no longer being used, or
238   * else a memory leak will result.  Please see {@link GlobalRenderInformation#createStyle()}
239   * for a method that does not lead to these issues.
240   <p>
241   * @see #createStyle()
242   */ public
243 int addStyle(GlobalStyle pStyle) {
244    return libsbmlJNI.GlobalRenderInformation_addStyle(swigCPtr, this, GlobalStyle.getCPtr(pStyle), pStyle);
245  }
246
247  
248/**
249   * Returns the XML element name of this object, which for
250   * {@link GlobalRenderInformation}, is always <code>'renderInformation'.</code>
251   <p>
252   * @return the name of this element, i.e., <code>'renderInformation'.</code>
253   */ public
254 String getElementName() {
255    return libsbmlJNI.GlobalRenderInformation_getElementName(swigCPtr, this);
256  }
257
258  
259/**
260   * Creates and returns a deep copy of this {@link GlobalRenderInformation} object.
261   <p>
262   * @return a (deep) copy of this {@link GlobalRenderInformation}.
263   */ public
264 GlobalRenderInformation cloneObject() {
265    long cPtr = libsbmlJNI.GlobalRenderInformation_cloneObject(swigCPtr, this);
266    return (cPtr == 0) ? null : new GlobalRenderInformation(cPtr, true);
267  }
268
269  
270/**
271   * Returns the libSBML type code for this SBML object.
272   <p>
273   * LibSBML attaches an
274   * identifying code to every kind of SBML object.  These are known as
275   * <em>SBML type codes</em>.  In other languages, the set of type codes
276   * is stored in an enumeration; in the Java language interface for
277   * libSBML, the type codes are defined as static integer constants in
278   * interface class {@link libsbmlConstants}.  The names of the type codes
279   * all begin with the characters <code>SBML_.</code> 
280   <p>
281   * @return the SBML type code for this object, or <code>SBML_UNKNOWN</code> (default).
282   <p>
283   * @see #getElementName()
284   */ public
285 int getTypeCode() {
286    return libsbmlJNI.GlobalRenderInformation_getTypeCode(swigCPtr, this);
287  }
288
289  
290/**
291   * Creates an {@link XMLNode} object from this {@link GlobalRenderInformation} object.
292   <p>
293   * @return the {@link XMLNode} with the XML representation for the 
294   * {@link GlobalRenderInformation} object.
295   */ public
296 XMLNode toXML() {
297    return new XMLNode(libsbmlJNI.GlobalRenderInformation_toXML(swigCPtr, this), true);
298  }
299
300  public void connectToChild() {
301    libsbmlJNI.GlobalRenderInformation_connectToChild(swigCPtr, this);
302  }
303
304  
305/** * @internal */ public
306 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
307    libsbmlJNI.GlobalRenderInformation_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
308  }
309
310}