Package org.apache.poi.hssf.model

Examples of org.apache.poi.hssf.model.FormulaParser$Node


       dvRecord.setStringField( DVRecord.STRING_ERROR_TITLE, obj_validation.getErrorBoxTitle());
       dvRecord.setStringField( DVRecord.STRING_ERROR_TEXT, obj_validation.getErrorBoxText());

       //formula fields ( size and data )
       String str_formula = obj_validation.getFirstFormula();
       FormulaParser fp = new FormulaParser(str_formula+";",book);
       fp.parse();
       Stack ptg_arr = new Stack();
       Ptg[] ptg  = fp.getRPNPtg();
       int size = 0;
       for (int k = 0; k < ptg.length; k++)
       {
           if ( ptg[k] instanceof org.apache.poi.hssf.record.formula.AreaPtg )
           {
              //we should set ptgClass to Ptg.CLASS_REF and explicit formula string to false
              ptg[k].setClass(Ptg.CLASS_REF);
              obj_validation.setExplicitListFormula(false);
           }
           size += ptg[k].getSize();
           ptg_arr.push(ptg[k]);
       }
       dvRecord.setFirstFormulaRPN(ptg_arr);
       dvRecord.setFirstFormulaSize((short)size);

       dvRecord.setListExplicitFormula(obj_validation.getExplicitListFormula());

       if ( obj_validation.getSecondFormula() != null )
       {
         str_formula = obj_validation.getSecondFormula();
         fp = new FormulaParser(str_formula+";",book);
         fp.parse();
         ptg_arr = new Stack();
         ptg  = fp.getRPNPtg();
         size = 0;
         for (int k = 0; k < ptg.length; k++)
         {
             size += ptg[k].getSize();
             ptg_arr.push(ptg[k]);
View Full Code Here


            HSSFCell c = (HSSFCell)ci.next();
            if(c.getCellType() == HSSFCell.CELL_TYPE_FORMULA) {
              // Since it's a formula cell, process the
              //  formula string, and look to see if
              //  it contains any references
              FormulaParser fp = new FormulaParser(c.getCellFormula(), workbook.getWorkbook());
              fp.parse();
             
              // Look for references, and update if needed
              Ptg[] ptgs = fp.getRPNPtg();
              boolean changed = false;
              for(int i=0; i<ptgs.length; i++) {
                if(ptgs[i] instanceof ReferencePtg) {
                  ReferencePtg rptg = (ReferencePtg)ptgs[i];
                  if(startRow <= rptg.getRowAsInt() &&
                      rptg.getRowAsInt() <= endRow) {
                    // References a row that moved
                    rptg.setRow(rptg.getRowAsInt() + n);
                    changed = true;
                  }
                }
              }
              // If any references were changed, then
              //  re-create the formula string
              if(changed) {
                c.setCellFormula(
                    fp.toFormulaString(ptgs)
                );
              }
            }
          }
        }
View Full Code Here

                if (domainURI.equals(node.getDomainName())) {
                    currentDomain = node.getDomainName();
                    return true;
                }
            }
            Node node = factory.createNode(domainURI);
            currentDomain = node.getDomainName();
            nodes.put(currentDomain, node);
        }
        return true;
    }
View Full Code Here

        }
        return true;
    }

    boolean load(final String configXmlUrl) throws ContributionReadException, ActivationException, ValidationException {
        Node node = factory.createNodeFromXML(configXmlUrl);
        currentDomain = node.getDomainName();
        nodes.put(currentDomain, node);
        return true;
    }
View Full Code Here

            getNode().removeFromDomainLevelComposite(curi, toks.get(2));
        } else {
            if (standaloneNodes.containsKey(curi)) {
                standaloneNodes.remove(curi).stop();
            } else if (nodes.containsKey(curi)) {
                Node n = nodes.remove(curi);
                n.stop();
                if (n.getDomainName().equals(currentDomain)) {
                    currentDomain = "";
                }
            } else {
                for (String compositeURI : getNode().getDeployedComposites(curi)) {
                    getNode().removeFromDomainLevelComposite(curi, compositeURI);
View Full Code Here

        return true;
    }

    boolean start(String nodeName, String compositeURI, String contributionURL, String... dependentContributionURLs)
        throws ActivationException, ValidationException {
        Node node = NodeFactory.newStandaloneNode(compositeURI, contributionURL, dependentContributionURLs);
        standaloneNodes.put(nodeName, node);
        return true;
    }
View Full Code Here

    boolean status(final List<String> toks) {
        if (standaloneNodes.size() > 0) {
            out.println("Standalone Nodes:");
            for (String nodeName : standaloneNodes.keySet()) {
                Node node = standaloneNodes.get(nodeName);
                for (String curi : node.getInstalledContributions()) {
                    for (String dc : node.getDeployedComposites(curi)) {
                        out.println("   " + nodeName + " " + dc);
                    }
                }
            }
            out.println();
        }
        if (nodes.size() > 0) {
            for (Node node : nodes.values()) {
                out.println("Domain: " + node.getDomainName());
                List<String> ics;
                if (toks.size() > 1) {
                    ics = new ArrayList<String>();
                    ics.add(toks.get(1));
                } else {
                    ics = node.getInstalledContributions();
                }

                for (String curi : ics) {
                    Contribution c = node.getInstalledContribution(curi);
                    List<String> dcs = node.getDeployedComposites(curi);
                    if (toks.size() > 2) {
                        dcs = new ArrayList<String>();
                        dcs.add(toks.get(2));
                    } else {
                        dcs = node.getDeployedComposites(curi);
                    }
                    for (String compositeUri : dcs) {
                        for (Artifact a : c.getArtifacts()) {
                            if (compositeUri.equals(a.getURI())) {
                                out.println("   " + curi
View Full Code Here

    for (Way way : waysById.values()) {
     
      List<WayNode> origWayNodes = way.getWayNodes();
      List<OSMNode> wayNodes = new ArrayList<OSMNode>(origWayNodes.size());
      for (WayNode origWayNode : origWayNodes) {
        Node origNode = nodesById.get(origWayNode.getNodeId());
        if (origNode != null) {
          wayNodes.add(nodeMap.get(origNode));
        }
      }
     
View Full Code Here

    for (Way way : waysById.values()) {
     
      List<WayNode> origWayNodes = way.getWayNodes();
      List<OwnNode> wayNodes = new ArrayList<OwnNode>(origWayNodes.size());
      for (WayNode origWayNode : origWayNodes) {
        Node origNode = nodesById.get(origWayNode.getNodeId());
        wayNodes.add(nodeMap.get(origNode));
      }
     
      OwnWay ownWay = new OwnWay(tagGroupForEntity(way), wayNodes);
     
View Full Code Here

            }
          }
          continue;
        }

        Node node = (Node)inode;
        if(node.getIndex() != index) continue;
        Attribute [] attrs = inode.getAttributes();
        if(attrs == null || attrs.length < 1) {
          list.add(item);
        } else {
          String data = (String)item.getData();
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.model.FormulaParser$Node

Copyright © 2018 www.massapicom. 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.