Package org.odftoolkit.odfdom.dom.element.style

Examples of org.odftoolkit.odfdom.dom.element.style.StyleMapElement


  /**
   * Set <style:map> for negative values to the given style name.
   * @param mapName the style name to map to
   */
  public void setMapNegative(String mapName) {
    StyleMapElement map = new StyleMapElement((OdfFileDom) this.getOwnerDocument());
    map.setStyleApplyStyleNameAttribute(mapName);
    map.setStyleConditionAttribute("value()<0");
    this.appendChild(map);
  }
View Full Code Here


    }
    return result;
  }

  public String getConditionStyleName(double value) {
    StyleMapElement map = OdfElement.findFirstChildNode(StyleMapElement.class, this);
    while (map != null) {
      String condition = map.getStyleConditionAttribute();
      if (isTrue(condition, value)) {
        return map.getStyleApplyStyleNameAttribute();
      }
      map = OdfElement.findNextChildNode(StyleMapElement.class, map);
    }
    return getStyleNameAttribute();
  }
View Full Code Here

  /**
   * Set &lt;style:map&gt; for positive values to the given style .
   * @param mapName the style  to map to
   */
  public void setMapPositive(String mapName) {
    StyleMapElement map = new StyleMapElement((OdfFileDom) this.getOwnerDocument());
    map.setStyleApplyStyleNameAttribute(mapName);
    map.setStyleConditionAttribute("value()>0");
    this.appendChild(map);
  }
View Full Code Here

  /**
   * Set &lt;style:map&gt; for negative values to the given style .
   * @param mapName the style  to map to
   */
  public void setMapNegative(String mapName) {
    StyleMapElement map = new StyleMapElement((OdfFileDom) this.getOwnerDocument());
    map.setStyleApplyStyleNameAttribute(mapName);
    map.setStyleConditionAttribute("value()<0");
    this.appendChild(map);
  }
View Full Code Here

   * Test of setMapPositive method, of class NumberNumberElementNumberStyle.
   */
  @Test
  public void testSetMapPositive() {
    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

   * Test of setMapNegative method, of class NumberNumberElementNumberStyle.
   */
  @Test
  public void testSetMapNegative() {
    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

   * Test of setMapPositive method, of class OdfNumberCurrencyStyle.
   */
  @Test
  public void testSetMapPositive() {
    Node node;
    StyleMapElement mapNode;

    LOG.info("setMapPositive");
    String mapName = "positiveMap";
    OdfNumberCurrencyStyle instance = new OdfNumberCurrencyStyle(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

   * Test of setMapNegative method, of class OdfNumberCurrencyStyle.
   */
  @Test
  public void testSetMapNegative() {
    Node node;
    StyleMapElement mapNode;

    LOG.info("setMapNegative");
    String mapName = "negativeMap";
    OdfNumberCurrencyStyle instance = new OdfNumberCurrencyStyle(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

   * Test of setMapPositive method, of class OdfNumberNumberStyle.
   */
  @Test
  public void testSetMapPositive() {
    Node node;
    StyleMapElement mapNode;

    LOG.info("setMapPositive");
    String mapName = "positiveMap";
    OdfNumberPercentageStyle instance = new OdfNumberPercentageStyle(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

   * Test of setMapNegative method, of class OdfNumberNumberStyle.
   */
  @Test
  public void testSetMapNegative() {
    Node node;
    StyleMapElement mapNode;

    LOG.info("setMapNegative");
    String mapName = "negativeMap";
    OdfNumberPercentageStyle instance = new OdfNumberPercentageStyle(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

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.style.StyleMapElement

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.