Examples of AttributeList


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

      throws IOException
  {
    if (expression instanceof FormulaExpression)
    {
      final FormulaExpression fe = (FormulaExpression) expression;
      final AttributeList properties = new AttributeList();
      properties.setAttribute(ExtParserModule.NAMESPACE, "style-key", styleKey.getName());
      properties.setAttribute(ExtParserModule.NAMESPACE, "formula", fe.getFormula());
      if (expression.getDependencyLevel() > 0)
      {
        properties.setAttribute(ExtParserModule.NAMESPACE, "deplevel", String.valueOf(
            expression.getDependencyLevel()));
      }
      getXmlWriter().writeTag(ExtParserModule.NAMESPACE, FunctionsWriter.STYLE_EXPRESSION_TAG, properties,
          XmlWriterSupport.CLOSE);
      return;
    }

    if (expression instanceof FormulaFunction)
    {
      final FormulaFunction fe = (FormulaFunction) expression;
      final AttributeList properties = new AttributeList();
      properties.setAttribute(ExtParserModule.NAMESPACE, "style-key", styleKey.getName());
      properties.setAttribute(ExtParserModule.NAMESPACE, "formula", fe.getFormula());
      properties.setAttribute(ExtParserModule.NAMESPACE, "initial", fe.getInitial());
      if (expression.getDependencyLevel() > 0)
      {
        properties.setAttribute(ExtParserModule.NAMESPACE, "deplevel", String.valueOf(
            expression.getDependencyLevel()));
      }
      getXmlWriter().writeTag(ExtParserModule.NAMESPACE, FunctionsWriter.STYLE_EXPRESSION_TAG, properties,
          XmlWriterSupport.CLOSE);
      return;
    }

    try
    {
      final BeanUtility bu = new BeanUtility(expression);
      final String[] propertyNames = bu.getProperties();
      if (propertyNames.length == 0)
      {
        final AttributeList properties = new AttributeList();
        properties.setAttribute(ExtParserModule.NAMESPACE, "style-key", styleKey.getName());
        properties.setAttribute(ExtParserModule.NAMESPACE, "class", expression.getClass().getName());
        if (expression.getDependencyLevel() > 0)
        {
          properties.setAttribute(ExtParserModule.NAMESPACE, "deplevel", String.valueOf(
              expression.getDependencyLevel()));
        }
        getXmlWriter().writeTag(ExtParserModule.NAMESPACE, FunctionsWriter.STYLE_EXPRESSION_TAG, properties,
            XmlWriterSupport.CLOSE);
      }
      else
      {
        final AttributeList properties = new AttributeList();
        properties.setAttribute(ExtParserModule.NAMESPACE, "style-key", styleKey.getName());
        properties.setAttribute(ExtParserModule.NAMESPACE, "class", expression.getClass().getName());
        if (expression.getDependencyLevel() > 0)
        {
          properties.setAttribute(ExtParserModule.NAMESPACE, "deplevel", String.valueOf(
              expression.getDependencyLevel()));
        }
        getXmlWriter().writeTag(ExtParserModule.NAMESPACE, FunctionsWriter.STYLE_EXPRESSION_TAG, properties,
            XmlWriterSupport.OPEN);
View Full Code Here

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

      final Object property = beanUtility.getProperty(key);
      final Class propertyType = beanUtility.getPropertyType(key);
      final String value = beanUtility.getPropertyAsString(key);
      if (value != null && property != null)
      {
        final AttributeList attList = new AttributeList();
        attList.setAttribute(ExtParserModule.NAMESPACE, "name", key);
        if (BeanUtility.isSameType(propertyType, property.getClass()) == false)
        {
          attList.setAttribute(ExtParserModule.NAMESPACE, "class", property.getClass().getName());
        }
        writer.writeTag(ExtParserModule.NAMESPACE, "property", attList, XmlWriterSupport.OPEN);
        writer.writeTextNormalized(value, false);
        writer.writeCloseTag();
      }
View Full Code Here

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

          writer.writeTag(ExtParserModule.NAMESPACE, FunctionsWriter.PROPERTY_REF_TAG, "name", name,
              XmlWriterSupport.CLOSE);
        }
        else
        {
          final AttributeList properties = new AttributeList();
          properties.setAttribute(ExtParserModule.NAMESPACE, "name", name);
          properties.setAttribute(ExtParserModule.NAMESPACE, "class", value.getClass().getName());

          writer.writeTag(ExtParserModule.NAMESPACE, FunctionsWriter.PROPERTY_REF_TAG, properties,
              XmlWriterSupport.OPEN);
          writer.writeTextNormalized(svalue, false);
          writer.writeCloseTag();
View Full Code Here

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

  }

  protected AttributeList createMainAttributes(final Element element,
                                               final XmlWriter writer)
  {
    return createMainAttributes(element, writer, new AttributeList());
  }
View Full Code Here

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

          continue;
        }

        if ("Resource".equals(attrMeta.getValueRole()))
        {
          final AttributeList attList = new AttributeList();
          if (attList.isNamespaceUriDefined(namespace) == false &&
              writer.isNamespaceDefined(namespace) == false)
          {
            attList.addNamespaceDeclaration("autoGenNS", namespace);
          }

          if (value instanceof URL)
          {
            attList.setAttribute(AttributeNames.Core.NAMESPACE, "resource-type", "url");
            writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
            writer.writeTextNormalized(String.valueOf(value), true);
            writer.writeCloseTag();
          }
          else if (value instanceof ResourceKey)
          {
            try
            {
              final ResourceKey key = (ResourceKey) value;
              final ResourceManager resourceManager = bundle.getResourceManager();
              final ResourceKey bundleKey = bundle.getBundleKey().getParent();
              final String serializedKey = resourceManager.serialize(bundleKey, key);
              attList.setAttribute(AttributeNames.Core.NAMESPACE, "resource-type", "resource-key");
              writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
              writer.writeTextNormalized(serializedKey, true);
              writer.writeCloseTag();
            }
            catch (ResourceException re)
            {
              logger.error("Could not serialize the ResourceKey: " + re.getMessage(), re);
              throw new IOException("Could not serialize the ResourceKey: " + re.getMessage());
            }
          }
          else if (value instanceof File)
          {
            attList.setAttribute(AttributeNames.Core.NAMESPACE, "resource-type", "file");
            writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
            writer.writeTextNormalized(String.valueOf(value), true);
            writer.writeCloseTag();
          }
          else if (value instanceof String)
          {
            attList.setAttribute(AttributeNames.Core.NAMESPACE, "resource-type", "local-ref");
            writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
            writer.writeTextNormalized(String.valueOf(value), true);
            writer.writeCloseTag();
          }
          else
          {
            logger.warn("Unknown value-type in resource-attribute " + namespace + ":" + name);
          }

          continue;
        }

        if ("Expression".equals(attrMeta.getValueRole()) && value instanceof Expression)
        {
          // write attribute-expressions.
          final AttributeList attList = new AttributeList();
          attList.setAttribute(BundleNamespaces.LAYOUT, "attribute-namespace", namespace);
          attList.setAttribute(BundleNamespaces.LAYOUT, "attribute-name", name);
          ExpressionWriterUtility.writeExpressionCore
              (bundle, state, (Expression) value, writer, BundleNamespaces.LAYOUT, "expression", attList);
          continue;
        }

        try
        {
          final PropertyEditor propertyEditor = attrMeta.getEditor();
          if (propertyEditor != null)
          {

            propertyEditor.setValue(value);
            final String text = propertyEditor.getAsText();

            final AttributeList attList = new AttributeList();
            if (attList.isNamespaceUriDefined(namespace) == false &&
                writer.isNamespaceDefined(namespace) == false)
            {
              attList.addNamespaceDeclaration("autoGenNS", namespace);
            }
            writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
            writer.writeTextNormalized(text, true);
            writer.writeCloseTag();
          }
          else
          {
            final String attrValue = ConverterRegistry.toAttributeValue(value);
            final AttributeList attList = new AttributeList();
            if (attList.isNamespaceUriDefined(namespace) == false &&
                writer.isNamespaceDefined(namespace) == false)
            {
              attList.addNamespaceDeclaration("autoGenNS", namespace);
            }
            writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
            writer.writeTextNormalized(attrValue, true);
            writer.writeCloseTag();
          }
View Full Code Here

Examples of org.xml.sax.AttributeList

  public void parse(final Reader in) throws SAXException, IOException {
  final Vector attributeNames = new Vector();
  final Vector attributeValues = new Vector();

  final AttributeList attrs = new AttributeList() {
    public int getLength() {
      return attributeNames.size();
    }

    public String getName(final int i) {
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.