Examples of OdfNumberStyle


Examples of org.odftoolkit.odfdom.incubator.doc.number.OdfNumberStyle

      typeValue = OfficeValueTypeAttribute.Value.enumValueOf(type);
    }

    if (typeValue == OfficeValueTypeAttribute.Value.FLOAT) {
      String name = getDataDisplayStyleName();
      OdfNumberStyle style = mCellElement.getAutomaticStyles().getNumberStyle(name);
      if (style == null) {
        style = mDocument.getDocumentStyles().getNumberStyle(name);
      }
      if (style != null) {
        return style.getFormat();
      }
    } else if (typeValue == OfficeValueTypeAttribute.Value.DATE) {
      String name = getDataDisplayStyleName();
      OdfNumberDateStyle style = mCellElement.getAutomaticStyles().getDateStyle(name);
      if (style == null) {
        style = mDocument.getDocumentStyles().getDateStyle(name);
      }
      if (style != null) {
        return style.getFormat();
      }
    } else if (typeValue == OfficeValueTypeAttribute.Value.CURRENCY) {
      String name = getCurrencyDisplayStyleName();
      OdfNumberCurrencyStyle dataStyle = mCellElement.getAutomaticStyles().getCurrencyStyle(name);
      if (dataStyle == null) {
        dataStyle = mDocument.getDocumentStyles().getCurrencyStyle(name);
      }
      if (dataStyle != null) {
        return dataStyle.getFormat();
      }
    } else if (typeValue == OfficeValueTypeAttribute.Value.PERCENTAGE) {
      String name = getDataDisplayStyleName();
      OdfNumberPercentageStyle style = mCellElement.getAutomaticStyles().getPercentageStyle(name);
      if (style == null) {
        style = mDocument.getDocumentStyles().getPercentageStyle(name);
      }
      if (style != null) {
        return style.getFormat();
      }
    }
    return null;
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.number.OdfNumberStyle

        mListStyles = new HashMap<String, OdfTextListStyle>();
      }

      mListStyles.put(listStyle.getStyleNameAttribute(), listStyle);
    } else if (node instanceof OdfNumberStyle) {
      OdfNumberStyle numberStyle = (OdfNumberStyle) node;

      if (mNumberStyles == null) {
        mNumberStyles = new HashMap<String, OdfNumberStyle>();
      }

      mNumberStyles.put(numberStyle.getStyleNameAttribute(), numberStyle);
    } else if (node instanceof OdfNumberDateStyle) {
      OdfNumberDateStyle dateStyle = (OdfNumberDateStyle) node;

      if (mDateStyles == null) {
        mDateStyles = new HashMap<String, OdfNumberDateStyle>();
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.number.OdfNumberStyle

        OdfTextListStyle listStyle = (OdfTextListStyle) node;
        mListStyles.remove(listStyle.getStyleNameAttribute());
      }
    } else if (node instanceof OdfNumberStyle) {
      if (mNumberStyles != null) {
        OdfNumberStyle numberStyle = (OdfNumberStyle) node;
        mNumberStyles.remove(numberStyle.getStyleNameAttribute());
      }
    } else if (node instanceof OdfNumberDateStyle) {
      if (mDateStyles != null) {
        OdfNumberDateStyle dateStyle = (OdfNumberDateStyle) node;
        mDateStyles.remove(dateStyle.getStyleNameAttribute());
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.number.OdfNumberStyle

      { "tbefore:", "n10F" },
      { "n10F", "t:after" },
      { "tbefore:", "n10F", "t:after"},
    };
    LOG.info("buildFromFormat");
    OdfNumberStyle instance = null;
    char expectedType;
        String expectedValue;
    Node node;

    for (int i = 0; i < formatTest.length; i++)
    {
      LOG.info("Number format: " + formatTest[i]);
      instance = new OdfNumberStyle(dom,
        formatTest[i], "fstyle");
      Assert.assertNotNull(instance);

      node = instance.getFirstChild();

      for (int j = 0; j < expected[i].length; j++)
      {
        expectedType = expected[i][j].charAt(0);
        expectedValue = expected[i][j].substring(1);
        switch (expectedType)
        {
          case 't':
            checkNumberText("text", expectedValue, node);
            break;
          case 'n':
            checkNumberFormat(expectedValue, node);
            break;
        }
        node = node.getNextSibling();
        Assert.assertEquals(expectedFormat[i], instance.getFormat());
        NumberNumberElement number = OdfElement.findFirstChildNode(NumberNumberElement.class, instance);
        try {
          Assert.assertEquals(expectedNumberDecimalPlaces[i], number
              .getNumberDecimalPlacesAttribute().intValue());
        } catch (Exception e) {
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.number.OdfNumberStyle

    Node node;
    StyleMapElement mapNode;

    LOG.info("setMapPositive");
    String mapName = "positiveMap";
    OdfNumberStyle instance = new OdfNumberStyle(dom,
        "#0", "fstyle");
    instance.setMapPositive(mapName);
    node = instance.getLastChild();
    Assert.assertNotNull(node);
    Assert.assertTrue(node instanceof StyleMapElement);
    mapNode = (StyleMapElement) node;
    Assert.assertEquals("value()>0", mapNode.getStyleConditionAttribute());
    Assert.assertEquals(mapName, mapNode.getStyleApplyStyleNameAttribute());
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.number.OdfNumberStyle

    Node node;
    StyleMapElement mapNode;

    LOG.info("setMapNegative");
    String mapName = "negativeMap";
    OdfNumberStyle instance = new OdfNumberStyle(dom,
        "#0", "fstyle");
    instance.setMapNegative(mapName);
    node = instance.getLastChild();
    Assert.assertNotNull(node);
    Assert.assertTrue(node instanceof StyleMapElement);
    mapNode = (StyleMapElement) node;
    Assert.assertEquals("value()<0", mapNode.getStyleConditionAttribute());
    Assert.assertEquals(mapName, mapNode.getStyleApplyStyleNameAttribute());
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.number.OdfNumberStyle

      outputDocument = SpreadsheetDocument.newSpreadsheetDocument();
      contentDom = outputDocument.getContentDom();
      contentAutoStyles = contentDom.getOrCreateAutomaticStyles();

      OdfNumberDateStyle dateStyle = new OdfNumberDateStyle(contentDom, "yyyy-MM-dd", "numberDateStyle", null);
      OdfNumberStyle numberStyle = new OdfNumberStyle(contentDom, "#0.00", "numberTemperatureStyle");

      contentAutoStyles.appendChild(dateStyle);
      contentAutoStyles.appendChild(numberStyle);

      style = contentAutoStyles.newStyle(OdfStyleFamily.TableCell);
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.number.OdfNumberStyle

    OfficeValueTypeAttribute.Value typeValue = null;
    msFormatString = formatStr;
    splitRepeatedCells();
    typeValue = OfficeValueTypeAttribute.Value.enumValueOf(type);
    if (typeValue == OfficeValueTypeAttribute.Value.FLOAT) {
      OdfNumberStyle numberStyle = new OdfNumberStyle((OdfFileDom) mCellElement.getOwnerDocument(), formatStr,
          getUniqueNumberStyleName());
      mCellElement.getAutomaticStyles().appendChild(numberStyle);
      setDataDisplayStyleName(numberStyle.getStyleNameAttribute());
      Double value = getDoubleValue();
      if (value != null) {
        setDisplayTextContent((new DecimalFormat(formatStr)).format(value.doubleValue()), null);
      }
    } else if (typeValue == OfficeValueTypeAttribute.Value.DATE) {
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.number.OdfNumberStyle

      typeValue = OfficeValueTypeAttribute.Value.enumValueOf(type);
    }

    if (typeValue == OfficeValueTypeAttribute.Value.FLOAT) {
      String name = getDataDisplayStyleName();
      OdfNumberStyle style = mCellElement.getAutomaticStyles().getNumberStyle(name);
      if (style == null) {
        style = mDocument.getDocumentStyles().getNumberStyle(name);
      }
      if (style != null) {
        return style.getFormat();
      }
    } else if (typeValue == OfficeValueTypeAttribute.Value.DATE) {
      String name = getDataDisplayStyleName();
      OdfNumberDateStyle style = mCellElement.getAutomaticStyles().getDateStyle(name);
      if (style == null) {
        style = mDocument.getDocumentStyles().getDateStyle(name);
      }
      if (style != null) {
        return style.getFormat();
      }
    } else if (typeValue == OfficeValueTypeAttribute.Value.TIME) {
      String name = getDataDisplayStyleName();
      OdfNumberDateStyle style = mCellElement.getAutomaticStyles().getDateStyle(name);
      if (style == null) {
        style = mDocument.getDocumentStyles().getDateStyle(name);
      }
      if (style != null) {
        return style.getFormat();
      }
    } else if (typeValue == OfficeValueTypeAttribute.Value.CURRENCY) {
      String name = getCurrencyDisplayStyleName();
      OdfNumberCurrencyStyle dataStyle = mCellElement.getAutomaticStyles().getCurrencyStyle(name);
      if (dataStyle == null) {
        dataStyle = mDocument.getDocumentStyles().getCurrencyStyle(name);
      }
      if (dataStyle != null) {
        return dataStyle.getFormat();
      }
    } else if (typeValue == OfficeValueTypeAttribute.Value.PERCENTAGE) {
      String name = getDataDisplayStyleName();
      OdfNumberPercentageStyle style = mCellElement.getAutomaticStyles().getPercentageStyle(name);
      if (style == null) {
        style = mDocument.getDocumentStyles().getPercentageStyle(name);
      }
      if (style != null) {
        return style.getFormat();
      }
    }
    return null;
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.number.OdfNumberStyle

      contentDom = outputDocument.getContentDom();
      contentAutoStyles = contentDom.getOrCreateAutomaticStyles();

      OdfNumberDateStyle dateStyle = new OdfNumberDateStyle(contentDom,
          "yyyy-MM-dd", "numberDateStyle", null);
      OdfNumberStyle numberStyle = new OdfNumberStyle(contentDom,
          "#0.00", "numberTemperatureStyle");

      contentAutoStyles.appendChild(dateStyle);
      contentAutoStyles.appendChild(numberStyle);
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.