Examples of LayoutModelPlugin


Examples of org.sbml.jsbml.ext.layout.LayoutModelPlugin

      Model model = doc.getModel();
      model.setLevel(level);
      model.setVersion(version);
     
      // Get LayoutModel
      LayoutModelPlugin layoutModel = LayoutExtension.getOrCreateLayoutModel(doc);
      // Add the layout
      Layout layout = createSBMLLayoutForView(view, model);
      layoutModel.add(layout);
    }
    return doc;
  }
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.LayoutModelPlugin

 
  /** Get the extension.
   * Changed in the build. */
  public static boolean existLayoutInSBMLDocument(SBMLDocument doc){
    boolean existLayout = false;
    LayoutModelPlugin layoutModel = (LayoutModelPlugin) doc.getModel().getExtension(LAYOUT_NS);
    if (layoutModel != null){
      existLayout = (layoutModel.getListOfLayouts().size() > 0);
    }
    return existLayout;
  }
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.LayoutModelPlugin

 
  /** Returns the registered layoutModel or registers a new one
   * to the model in the document.
   */
  public static LayoutModelPlugin getOrCreateLayoutModel(SBMLDocument doc){
    LayoutModelPlugin layoutModel = (LayoutModelPlugin) doc.getModel().getExtension(LAYOUT_NS);
    if (layoutModel == null){
      Model model = doc.getModel();
      // model should exist in the document now
      if (model == null){
        System.err.println("Model missing in SBMLDocument.");
        return null;
      }
      layoutModel = new LayoutModelPlugin(model);
      model.addExtension(LAYOUT_NS, layoutModel);
    }
    return layoutModel;
  }
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.LayoutModelPlugin

    return layoutModel;
  }
 
 
  public static ListOf<Layout> getLayoutsInSBMLDocument(SBMLDocument doc){
    LayoutModelPlugin layoutModel = (LayoutModelPlugin) doc.getModel().getExtension(LAYOUT_NS);
    return layoutModel.getListOfLayouts();
 
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.LayoutModelPlugin

  @Override
  public Object processStartElement(String elementName, String uri, String prefix,
    boolean hasAttributes, boolean hasNamespaces, Object contextObject) {
    logger.debug("logger called, " + prefix + ":" + elementName + " in context of: " + contextObject.toString());
    if (contextObject instanceof LayoutModelPlugin) {
      LayoutModelPlugin layoutModel = (LayoutModelPlugin) contextObject;
      // TODO not sure if necessary to check if listOfLayouts != null
      ListOf<Layout> listOfLayouts = layoutModel.getListOfLayouts();
      SBase newElement = null;

      if (elementName.equals(RenderConstants.listOfGlobalRenderInformation)) {
        RenderListOfLayoutsPlugin renderPlugin = new RenderListOfLayoutsPlugin(listOfLayouts);
        listOfLayouts.addExtension(RenderConstants.namespaceURI, renderPlugin);
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.LayoutModelPlugin

    if (contextObject instanceof Model) {
      Model model = (Model) contextObject;

      if (elementName.equals(listOfLayouts)) {

        LayoutModelPlugin layoutModel = new LayoutModelPlugin(model);
        model.addExtension(getNamespaceURI(), layoutModel);

        return layoutModel.getListOfLayouts();
      }
    }
    else if (contextObject instanceof Layout) {
      Layout layout = (Layout) contextObject;
      SBase newElement = null;
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.LayoutModelPlugin

  @Override
  public SBasePlugin createPluginFor(SBase sbase) {

    if (sbase != null) {
      if (sbase instanceof Model) {
        return new LayoutModelPlugin((Model) sbase);
      }
    }

    return null;
  }
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.LayoutModelPlugin

    List<Object> listOfElementsToWrite = new LinkedList<Object>();

    if (sbase instanceof SBMLDocument) {
      // nothing to do
    } else if (sbase instanceof Model) {
      LayoutModelPlugin layoutModel = (LayoutModelPlugin) ((Model) sbase)
          .getExtension(namespaceURI);

      if (layoutModel != null && layoutModel.isSetListOfLayouts()) {
        listOfElementsToWrite.add(layoutModel.getListOfLayouts());
      }

    } else if (sbase instanceof TreeNode) {
      Enumeration<?> children = ((TreeNode) sbase).children();
      while (children.hasMoreElements()) {
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.LayoutModelPlugin

        if (contextObject instanceof Annotation) {
          Annotation annotation = (Annotation) contextObject;

          Model model = (Model) annotation.getParent();
          LayoutModelPlugin layoutModel = null;

          if (model.getExtension(namespaceURI) != null) {
            layoutModel = (LayoutModelPlugin) model
                .getExtension(namespaceURI);
          } else {
            layoutModel = new LayoutModelPlugin(model);
            model.addExtension(namespaceURI, layoutModel);
          }
        }
        if (contextObject instanceof SBase) {
          setLevelAndVersionFor(newContextObject,
            (SBase) contextObject);
        }
        if (contextObject instanceof Annotation) {
          Annotation annotation = (Annotation) contextObject;
          if (elementName.equals("listOfLayouts")) {
            ListOf<Layout> listOfLayouts = (ListOf<Layout>) newContextObject;
            listOfLayouts.setSBaseListType(ListOf.Type.other);
            setNamespace(listOfLayouts, namespaceURI);
            groupList = LayoutList.listOfLayouts;
            Model model = (Model) annotation.getParent();
            LayoutModelPlugin layoutModel = (LayoutModelPlugin) model
                .getExtension(namespaceURI);
            layoutModel.setListOfLayouts(listOfLayouts);
            return listOfLayouts;
          } else {
            log4jLogger.warn(MessageFormat.format(
              "Element {0} not recognized!", elementName));
          }
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.LayoutModelPlugin

  @Override
  public SBasePlugin createPluginFor(SBase sbase) {

    if (sbase != null) {
      if (sbase instanceof Model) {
        LayoutModelPlugin modelPlugin = new LayoutModelPlugin((Model) sbase);
        // set the proper namespace ??
        return modelPlugin;
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.