Package org.pentaho.reporting.engine.classic.core

Examples of org.pentaho.reporting.engine.classic.core.Element


    {
      final Element[] elements = detailsFooter.getElementArray();
      boolean footerEmpty = true;
      for (int i = 0; i < elements.length; i++)
      {
        final Element element = elements[i];
        if ("label".equals(element.getElementTypeName()) == false)
        {
          footerEmpty = false;
          break;
        }
      }
View Full Code Here


    if (StringUtils.isEmpty(field.getField()))
    {
      return;
    }

    final Element detailElement =
        AutoGeneratorUtility.generateDetailsElement(field.getField(), computeElementType(field));
    setupDefaultGrid(itemBand, detailElement);

    final String id = "wizard::details-" + field.getField();
    detailElement.setName(id);
    detailElement.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(width));
    if (Boolean.TRUE.equals
        (detailElement.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_STYLING)))
    {
      detailElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFormatData", field);
    }
    if (Boolean.TRUE.equals
        (detailElement.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES)))
    {
      detailElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFieldData", field);
    }
    itemBand.addElement(detailElement);

    if (Boolean.TRUE.equals(field.getOnlyShowChangingValues()))
    {
      detailElement.setAttribute
          (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ONLY_SHOW_CHANGING_VALUES, Boolean.TRUE);
    }

    if (detailsHeader != null)
    {
      final Element headerElement = AutoGeneratorUtility.generateHeaderElement(field.getField());
      setupDefaultGrid(detailsHeader, headerElement);
      headerElement.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(width));
      if (Boolean.TRUE.equals
          (headerElement.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_STYLING)))
      {
        headerElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFormatData", field);
      }
      if (Boolean.TRUE.equals
          (headerElement.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES)))
      {
        headerElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFieldData", field);
      }
      headerElement.setAttribute(AttributeNames.Wizard.NAMESPACE,
          MetaAttributeNames.Style.HORIZONTAL_ALIGNMENT, field.getHorizontalAlignment());

      detailsHeader.addElement(headerElement);
    }

    if (detailsFooter != null)
    {
      final Class aggFunctionClass = field.getAggregationFunction();
      final Element footerElement = AutoGeneratorUtility.generateFooterElement
          (aggFunctionClass, computeElementType(field), null, field.getField());

      setupDefaultGrid(detailsFooter, footerElement);

      footerElement.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(width));
      if (Boolean.TRUE.equals
          (footerElement.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_STYLING)))
      {
        footerElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFormatData", field);
      }
      if (Boolean.TRUE.equals
          (footerElement.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES)))
      {
        footerElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFieldData", field);
      }

      detailsFooter.addElement(footerElement);
    }
  }
View Full Code Here

    super(s);
  }

  public void testElementCreate()
  {
    final Element e = new Element();
    assertNotNull(e.getDataSource());
    assertNotNull(e.getStyle());
    assertNotNull(e.getName());
    assertTrue(e.isVisible());
    assertNull(e.getParent());
  }
View Full Code Here

      if (content == null)
      {
        return;
      }

      final Element headerElement = AutoGeneratorUtility.generateDetailsElement
          (groupDefinition.getField(), computeElementType(groupDefinition));
      final Length length = groupDefinition.getWidth();
      if (length != null)
      {
        headerElement.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, length.getNormalizedValue());
      }
      headerElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFormatData", headerDefinition);
      headerElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFieldData", groupDefinition);

      content.clear();
      content.addElement(headerElement);
    }
  }
View Full Code Here

  public void testElementClone()
          throws CloneNotSupportedException
  {
    final Band band = new Band();
    final Element e = new Element();
    band.addElement(e);
    assertNotNull(e.getParent());
    assertNotNull(e.getDataSource());
    assertNotNull(e.getStyle());
    assertNotNull(e.getName());
    assertTrue(e.isVisible());

    final Element clone = (Element) e.clone();
    assertNull(clone.getParent());
    assertNotNull(clone.getDataSource());
    assertNotNull(clone.getStyle());
    assertNotNull(clone.getName());
    assertTrue(clone.isVisible());

    final Band clonedBand = (Band) band.clone();
    assertNull(clonedBand.getParent());
    assertNotNull(clonedBand.getDataSource());
    assertNotNull(clonedBand.getStyle());
    assertNotNull(clonedBand.getName());
    assertTrue(clonedBand.isVisible());

    final Element clientElement = (Element) clonedBand.getElement(0);
    assertNotNull(clientElement.getParent());
    assertNotNull(clientElement.getDataSource());
    assertNotNull(clientElement.getStyle());
    assertNotNull(clientElement.getName());
    assertTrue(clientElement.isVisible());
    assertEquals(clonedBand, clientElement.getParent());

    clonedBand.getStyle().setStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE);
    assertTrue(clientElement.isDynamicContent());
    assertFalse(e.isDynamicContent());
  }
View Full Code Here

      if (content == null)
      {
        return;
      }

      final Element headerLabelElement = new Element();
      headerLabelElement.setElementType(new LabelType());
      if (groupDefinition.getDisplayName() != null)
      {
        headerLabelElement.setAttribute
            (AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, groupDefinition.getDisplayName());
      }
      else
      {
        headerLabelElement.setAttribute
            (AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, groupDefinition.getField());
        headerLabelElement.setAttribute
            (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR, groupDefinition.getField());
        headerLabelElement.setAttribute(AttributeNames.Wizard.NAMESPACE,
          AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES, Boolean.TRUE);
      }

      final Element headerValueElement =
          AutoGeneratorUtility.generateDetailsElement(groupDefinition.getField(), computeElementType(groupDefinition));
      headerValueElement.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NULL_VALUE, "-");
     
      final Band headerElement = new Band();
      headerElement.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, "inline");
      headerElement.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(-100));
      headerElement.getStyle().setStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE);
View Full Code Here

    {
      return;
    }

    final Class aggFunctionClass = groupDefinition.getAggregationFunction();
    final Element footerValueElement = AutoGeneratorUtility.generateFooterElement
        (aggFunctionClass, computeElementType(groupDefinition),
            groupDefinition.getGroupName(), groupDefinition.getField());

    final Element footerLabelElement = new Element();
    footerLabelElement.setElementType(new LabelType());
    if (groupDefinition.getGroupTotalsLabel() != null)
    {
      footerLabelElement.setAttribute
          (AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, groupDefinition.getGroupTotalsLabel());
    }
    else
    {
      footerLabelElement.setAttribute
          (AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, groupDefinition.getField());
      footerLabelElement.setAttribute
          (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR, groupDefinition.getField());
      footerLabelElement.setAttribute(AttributeNames.Wizard.NAMESPACE,
        AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES, Boolean.TRUE);
    }

    final Band footerElement = new Band();
    footerElement.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, "inline");
View Full Code Here

    assertFalse(e.isDynamicContent());
  }

  public void testElementMethods()
  {
    final Element e = new Element();
    assertTrue(e.isVisible());
    e.setVisible(false);
    assertTrue(e.isVisible() == false);
    e.setVisible(true);
    assertTrue(e.isVisible());

    try
    {
      e.setDataSource(null);
      fail();
    }
    catch (NullPointerException npe)
    {
      // expected, ignored
    }
    e.toString();
  }
View Full Code Here

    {
      return;
    }

    final Class aggFunctionClass = groupDefinition.getAggregationFunction();
    final Element footerValueElement = AutoGeneratorUtility.generateFooterElement
        (aggFunctionClass, computeElementType(groupDefinition),
            groupDefinition.getGroupName(), groupDefinition.getField());
    footerValueElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFormatData", footer);
    footerValueElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFieldData", groupDefinition);

    content.clear();
    content.addElement(footerValueElement);

  }
View Full Code Here

      return;
    }

    content.clear();

    final Element watermarkImage = new Element();
    watermarkImage.setElementType(new ContentType());
    watermarkImage.setAttribute
        (AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, watermarkDefinition.getSource());
    final ElementStyleSheet watermarkStyle = watermarkImage.getStyle();
    watermarkStyle.setStyleProperty(ElementStyleKeys.POS_X, convertLength(watermarkDefinition.getX()));
    watermarkStyle.setStyleProperty(ElementStyleKeys.POS_Y, convertLength(watermarkDefinition.getY()));
    watermarkStyle.setStyleProperty(ElementStyleKeys.MIN_WIDTH, convertLength(watermarkDefinition.getWidth()));
    watermarkStyle.setStyleProperty(ElementStyleKeys.MIN_HEIGHT, convertLength(watermarkDefinition.getHeight()));
    watermarkStyle.setStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO, watermarkDefinition.getKeepAspectRatio());
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.Element

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.