Package org.pentaho.reporting.libraries.xmlns.common

Examples of org.pentaho.reporting.libraries.xmlns.common.AttributeList


    if (element == null)
    {
      throw new NullPointerException();
    }

    final AttributeList attList = createMainAttributes(element, xmlWriter);
    xmlWriter.writeTag(BundleNamespaces.LAYOUT, "crosstab-summary-footer", attList, XmlWriterSupport.OPEN);
    writeElementBody(bundle, state, element, xmlWriter);
    writeChildElements(bundle, state, xmlWriter, (Band) element);
    xmlWriter.writeCloseTag();
View Full Code Here


    final XmlWriter xmlWriter = getXmlWriter();
    final PageDefinition pageDefinition = getReport().getPageDefinition();
    if (pageDefinition instanceof SimplePageDefinition)
    {
      final SimplePageDefinition spdef = (SimplePageDefinition) pageDefinition;
      final AttributeList attr = new AttributeList();
      attr.setAttribute(ExtParserModule.NAMESPACE, "width",
          String.valueOf(spdef.getPageCountHorizontal()));
      attr.setAttribute(ExtParserModule.NAMESPACE, "height",
          String.valueOf(spdef.getPageCountVertical()));
      xmlWriter.writeTag(ExtParserModule.NAMESPACE,
          ReportConfigWriter.SIMPLE_PAGE_DEFINITION_TAG, attr, XmlWriterSupport.OPEN);

      final AttributeList attributes = buildPageFormatProperties(spdef.getPageFormat(0));
      xmlWriter.writeTag(ExtParserModule.NAMESPACE,
          ReportConfigWriter.PAGE_TAG, attributes, XmlWriterSupport.CLOSE);
      xmlWriter.writeCloseTag();
    }
    else
    {
      xmlWriter.writeTag(ExtParserModule.NAMESPACE,
          ReportConfigWriter.PAGE_DEFINITION_TAG, XmlWriterSupport.OPEN);

      final int max = pageDefinition.getPageCount();
      for (int i = 0; i < max; i++)
      {
        final PageFormat fmt = pageDefinition.getPageFormat(i);

        final AttributeList attributes = buildPageFormatProperties(fmt);
        xmlWriter.writeTag(ExtParserModule.NAMESPACE, ReportConfigWriter.PAGE_TAG,
            attributes, XmlWriterSupport.CLOSE);
      }
      xmlWriter.writeCloseTag();
    }
View Full Code Here

   *
   * @return The properties.
   */
  private AttributeList buildPageFormatProperties(final PageFormat fmt)
  {
    final AttributeList retval = new AttributeList();
    final int[] borders = getBorders(fmt.getPaper());

    if (fmt.getOrientation() == PageFormat.LANDSCAPE)
    {
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.ORIENTATION_ATT, ReportConfigWriter.ORIENTATION_LANDSCAPE_VAL);
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.TOPMARGIN_ATT, String.valueOf(borders[ReportConfigWriter.RIGHT_BORDER]));
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.LEFTMARGIN_ATT, String.valueOf(borders[ReportConfigWriter.TOP_BORDER]));
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.BOTTOMMARGIN_ATT, String.valueOf(borders[ReportConfigWriter.LEFT_BORDER]));
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.RIGHTMARGIN_ATT, String.valueOf(borders[ReportConfigWriter.BOTTOM_BORDER]));
    }
    else if (fmt.getOrientation() == PageFormat.PORTRAIT)
    {
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.ORIENTATION_ATT, ReportConfigWriter.ORIENTATION_PORTRAIT_VAL);
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.TOPMARGIN_ATT, String.valueOf(borders[ReportConfigWriter.TOP_BORDER]));
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.LEFTMARGIN_ATT, String.valueOf(borders[ReportConfigWriter.LEFT_BORDER]));
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.BOTTOMMARGIN_ATT, String.valueOf(borders[ReportConfigWriter.BOTTOM_BORDER]));
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.RIGHTMARGIN_ATT, String.valueOf(borders[ReportConfigWriter.RIGHT_BORDER]));
    }
    else
    {
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.ORIENTATION_ATT, ReportConfigWriter.ORIENTATION_REVERSE_LANDSCAPE_VAL);
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.TOPMARGIN_ATT, String.valueOf(borders[ReportConfigWriter.LEFT_BORDER]));
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.LEFTMARGIN_ATT, String.valueOf(borders[ReportConfigWriter.BOTTOM_BORDER]));
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.BOTTOMMARGIN_ATT, String.valueOf(borders[ReportConfigWriter.RIGHT_BORDER]));
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.RIGHTMARGIN_ATT, String.valueOf(borders[ReportConfigWriter.TOP_BORDER]));
    }

    final int w = (int) fmt.getPaper().getWidth();
    final int h = (int) fmt.getPaper().getHeight();

    final String pageDefinition = PageFormatFactory.getInstance().getPageFormatName(w, h);
    if (pageDefinition != null)
    {
      retval.setAttribute(ExtParserModule.NAMESPACE,
          ReportConfigWriter.PAGEFORMAT_ATT, pageDefinition);
    }
    else
    {
      retval.setAttribute(ExtParserModule.NAMESPACE,
          AbstractXMLDefinitionWriter.WIDTH_ATT, String.valueOf(w));
      retval.setAttribute(ExtParserModule.NAMESPACE,
          AbstractXMLDefinitionWriter.HEIGHT_ATT, String.valueOf(h));
    }
    return retval;
  }
View Full Code Here

      throw new NullPointerException();
    }

    final SimpleSQLReportDataFactory sqlDataFactory = (SimpleSQLReportDataFactory) dataFactory;

    final AttributeList rootAttrs = new AttributeList();
    if (xmlWriter.isNamespaceDefined(SQLDataFactoryModule.NAMESPACE) == false)
    {
      rootAttrs.addNamespaceDeclaration("data", SQLDataFactoryModule.NAMESPACE);
    }
    xmlWriter.writeTag(SQLDataFactoryModule.NAMESPACE, "direct-sql-datasource", rootAttrs, XmlWriterSupport.OPEN);
    xmlWriter.writeTag(SQLDataFactoryModule.NAMESPACE, "config", "label-mapping",
        String.valueOf(sqlDataFactory.isLabelMapping()), XmlWriterSupport.CLOSE);
View Full Code Here

            // A spanned cell ..
            writer.writeTag(null, "covered-cell", XmlWriter.CLOSE);
            continue;
          }

          final AttributeList attList = new AttributeList();
          final ReportAttributeMap attrs = bg.getAttributes();
          final Object nameAttr = attrs.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME);
          if (nameAttr instanceof String)
          {
            attList.setAttribute(null, "content-idref",
                (String) nameAttr);
          }

          final String[] anchors = bg.getAnchors();
          if (anchors != null)
          {
            final StringBuffer anchor = new StringBuffer(100);
            for (int i = 0; i < anchors.length; i++)
            {
              if (i != 0)
              {
                anchor.append(", ");
              }
              anchor.append(anchors[i]);

            }
            attList.setAttribute(null, "anchor", anchor.toString());
          }
          if (bg.getBackgroundColor() != null)
          {
            attList.setAttribute(null, "background-color", ColorValueConverter.colorToString(bg.getBackgroundColor()));
          }

//          if (bg.getVerticalAlignment() != null)
//          {
//            attList.setAttribute(null, "vertical-alignment", String.valueOf(bg.getVerticalAlignment()));
//          }
//
          final BorderEdge top = bg.getTop();
          if (top != null)
          {
            attList.setAttribute(null, "border-top-color",
                ColorValueConverter.colorToString(top.getColor()));
            attList.setAttribute(null, "border-top-width",
                String.valueOf(StrictGeomUtility.toExternalValue(top.getWidth())));
            attList.setAttribute(null, "border-top-style",
                String.valueOf(top.getBorderStyle()));
          }

          final BorderEdge left = bg.getLeft();
          if (left != null)
          {
            attList.setAttribute(null, "border-left-color",
                ColorValueConverter.colorToString(left.getColor()));
            attList.setAttribute(null, "border-left-width",
                String.valueOf(StrictGeomUtility.toExternalValue(left.getWidth())));
            attList.setAttribute(null, "border-left-style",
                String.valueOf(left.getBorderStyle()));
          }

          final BorderEdge bottom = bg.getBottom();
          if (bottom != null)
          {
            attList.setAttribute(null, "border-bottom-color",
                ColorValueConverter.colorToString(bottom.getColor()));
            attList.setAttribute(null, "border-bottom-width",
                String.valueOf(StrictGeomUtility.toExternalValue(bottom.getWidth())));
            attList.setAttribute(null, "border-bottom-style",
                String.valueOf(bottom.getBorderStyle()));
          }

          final BorderEdge right = bg.getRight();
          if (right != null)
          {
            attList.setAttribute(null, "border-right-color",
                ColorValueConverter.colorToString(right.getColor()));
            attList.setAttribute(null, "border-right-width",
                String.valueOf(StrictGeomUtility.toExternalValue(right.getWidth())));
            attList.setAttribute(null, "border-right-style",
                String.valueOf(right.getBorderStyle()));
          }

          final BorderCorner topLeft = bg.getTopLeft();
          if (topLeft != null)
          {
            attList.setAttribute(null, "border-top-left-x",
                String.valueOf(StrictGeomUtility.toExternalValue(topLeft.getWidth())));
            attList.setAttribute(null, "border-top-left-y",
                String.valueOf(StrictGeomUtility.toExternalValue(topLeft.getHeight())));
          }


          final BorderCorner topRight = bg.getTopRight();
          if (topRight != null)
          {
            attList.setAttribute(null, "border-top-right-x",
                String.valueOf(StrictGeomUtility.toExternalValue(topRight.getWidth())));
            attList.setAttribute(null, "border-top-right-y",
                String.valueOf(StrictGeomUtility.toExternalValue(topRight.getHeight())));
          }


          final BorderCorner bottomLeft = bg.getBottomLeft();
          if (bottomLeft != null)
          {
            attList.setAttribute(null, "border-bottom-left-x",
                String.valueOf(StrictGeomUtility.toExternalValue(bottomLeft.getWidth())));
            attList.setAttribute(null, "border-bottom-left-y",
                String.valueOf(StrictGeomUtility.toExternalValue(bottomLeft.getHeight())));
          }


          final BorderCorner bottomRight = bg.getBottomRight();
          if (bottomRight != null)
          {
            attList.setAttribute(null, "border-bottom-right-x",
                String.valueOf(StrictGeomUtility.toExternalValue(bottomRight.getWidth())));
            attList.setAttribute(null, "border-bottom-right-y",
                String.valueOf(StrictGeomUtility.toExternalValue(bottomRight.getHeight())));
          }
          writer.writeTag(null, "cell", attList, XmlWriter.CLOSE);
        }
        writer.writeCloseTag();
View Full Code Here

    }

    final DriverConnectionProvider driverProvider =
        (DriverConnectionProvider) connectionProvider;

    final AttributeList rootAttribs = new AttributeList();
    if (xmlWriter.isNamespaceDefined(SQLDataFactoryModule.NAMESPACE) == false)
    {
      rootAttribs.addNamespaceDeclaration("data", SQLDataFactoryModule.NAMESPACE);
    }

    xmlWriter.writeTag
        (SQLDataFactoryModule.NAMESPACE, "connection", rootAttribs, XmlWriterSupport.OPEN);
View Full Code Here

    if (xmlWriter == null)
    {
      throw new NullPointerException();
    }

    final AttributeList rootAttribs = new AttributeList();
    if (xmlWriter.isNamespaceDefined(SQLDataFactoryModule.NAMESPACE) == false)
    {
      rootAttribs.addNamespaceDeclaration("data", SQLDataFactoryModule.NAMESPACE);
    }

    final JndiConnectionProvider driverProvider =
        (JndiConnectionProvider) connectionProvider;
    xmlWriter.writeTag(SQLDataFactoryModule.NAMESPACE, "jndi", rootAttribs, XmlWriterSupport.OPEN);
View Full Code Here

    if (element == null)
    {
      throw new NullPointerException();
    }

    final AttributeList attList = createMainAttributes(element, xmlWriter);
    xmlWriter.writeTag(BundleNamespaces.LAYOUT, "group", attList, XmlWriterSupport.OPEN);
    writeElementBody(bundle, state, element, xmlWriter);

    final RelationalGroup group = (RelationalGroup) element;
    xmlWriter.writeTag(BundleNamespaces.LAYOUT, "fields", XmlWriterSupport.OPEN);
View Full Code Here

      throw new NullPointerException();
    }

    final SQLReportDataFactory sqlDataFactory = (SQLReportDataFactory) dataFactory;

    final AttributeList rootAttrs = new AttributeList();
    if (xmlWriter.isNamespaceDefined(SQLDataFactoryModule.NAMESPACE) == false)
    {
      rootAttrs.addNamespaceDeclaration("data", SQLDataFactoryModule.NAMESPACE);
    }
    xmlWriter.writeTag(SQLDataFactoryModule.NAMESPACE, "sql-datasource", rootAttrs, XmlWriterSupport.OPEN);
    xmlWriter.writeTag(SQLDataFactoryModule.NAMESPACE, "config", "label-mapping",
        String.valueOf(sqlDataFactory.isLabelMapping()), XmlWriterSupport.CLOSE);
View Full Code Here

    if (element == null)
    {
      throw new NullPointerException();
    }

    final AttributeList attList = createMainAttributes(element, xmlWriter);
    xmlWriter.writeTag(BundleNamespaces.LAYOUT, "data-body", attList, XmlWriterSupport.OPEN);
    writeElementBody(bundle, state, element, xmlWriter);
    writeChildElements(bundle, state, xmlWriter, (Section) element);
    xmlWriter.writeCloseTag();
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.xmlns.common.AttributeList

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.