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

Examples of org.pentaho.reporting.engine.classic.core.util.beans.ConverterRegistry


          propertyEditor.setAsText(attributeValue);
          element.setAttribute(namespace, name, propertyEditor.getValue());
        }
        else
        {
          final ConverterRegistry instance = ConverterRegistry.getInstance();
          final ValueConverter valueConverter = instance.getValueConverter(type);
          if (valueConverter != null)
          {
            final Object o = ConverterRegistry.toPropertyValue(attributeValue, type);
            element.setAttribute(namespace, name, o);
          }
View Full Code Here


    if (namespaces.length == 0)
    {
      return false;
    }

    final ConverterRegistry instance = ConverterRegistry.getInstance();
    final ElementMetaData metaData = e.getMetaData();
    boolean retval = false;

    for (int namespaceIdx = 0; namespaceIdx < namespaces.length; namespaceIdx++)
    {
      final String namespace = namespaces[namespaceIdx];
      final String[] names = e.getAttributeExpressionNames(namespace);
      for (int nameIdx = 0; nameIdx < names.length; nameIdx++)
      {
        final String name = names[nameIdx];
        final Expression ex = e.getAttributeExpression(namespace, name);
        if (ex == null)
        {
          continue;
        }

        final AttributeMetaData attribute = metaData.getAttributeDescription(namespace, name);
        if (attribute != null && attribute.isDesignTimeValue())
        {
          continue;
        }

        retval = true;
        ex.setRuntime(getRuntime());
        try
        {
          final Object value = evaluate(ex);
          if (attribute == null)
          {
            // Not a declared attribute, but maybe one of the output-handlers can work on this one.
            e.setAttribute(namespace, name, value);
          }
          else
          {
            final Class type = attribute.getTargetType();
            if (value == null || type.isAssignableFrom(value.getClass()))
            {
              e.setAttribute(namespace, name, value);
            }
            else if (value instanceof ErrorValue)
            {
              e.setAttribute(namespace, name, null);
            }
            else
            {

              final PropertyEditor propertyEditor = attribute.getEditor();
              if (propertyEditor != null)
              {
                propertyEditor.setAsText(String.valueOf(value));
                e.setAttribute(namespace, name, propertyEditor.getValue());
              }
              else
              {
                try
                {
                  final ValueConverter valueConverter = instance.getValueConverter(type);
                  if (type.isAssignableFrom(String.class))
                  {
                    // the attribute would allow raw-string values, so copy the element ..
                    e.setAttribute(namespace, name, value);
                  }
View Full Code Here

    if (namespaces.length == 0)
    {
      return false;
    }

    final ConverterRegistry instance = ConverterRegistry.getInstance();
    final ElementMetaData metaData = e.getMetaData();
    boolean retval = false;

    for (int namespaceIdx = 0; namespaceIdx < namespaces.length; namespaceIdx++)
    {
      final String namespace = namespaces[namespaceIdx];
      final String[] names = e.getAttributeExpressionNames(namespace);
      for (int nameIdx = 0; nameIdx < names.length; nameIdx++)
      {
        final String name = names[nameIdx];
        final Expression ex = e.getAttributeExpression(namespace, name);
        if (ex == null)
        {
          continue;
        }

        final AttributeMetaData attribute = metaData.getAttributeDescription(namespace, name);
        if (attribute != null && attribute.isDesignTimeValue())
        {
          continue;
        }

        retval = true;
        ex.setRuntime(getRuntime());
        try
        {
          final Object value = evaluate(ex);
          if (attribute == null)
          {
            // Not a declared attribute, but maybe one of the output-handlers can work on this one.
            e.setAttribute(namespace, name, value);
          }
          else
          {
            final Class<?> type = attribute.getTargetType();
            if (value == null || type.isAssignableFrom(value.getClass()))
            {
              e.setAttribute(namespace, name, value);
            }
            else if (value instanceof ErrorValue)
            {
              if (failOnErrors)
              {
                throw new InvalidReportStateException(String.format
                    ("Failed to evaluate attribute-expression for attribute %s:%s on element [%s]", // NON-NLS
                        namespace, name,
                        FunctionUtilities.computeElementLocation(e)));
              }
              e.setAttribute(namespace, name, null);
            }
            else
            {

              final PropertyEditor propertyEditor = attribute.getEditor();
              if (propertyEditor != null)
              {
                propertyEditor.setAsText(String.valueOf(value));
                e.setAttribute(namespace, name, propertyEditor.getValue());
              }
              else
              {
                final ValueConverter valueConverter = instance.getValueConverter(type);
                if (type.isAssignableFrom(String.class))
                {
                  // the attribute would allow raw-string values, so copy the element ..
                  e.setAttribute(namespace, name, value);
                }
View Full Code Here

        final PropertyEditor propertyEditor = attributeMetaData.getEditor();
        if (propertyEditor != null) {
          propertyEditor.setAsText(attributeValue);
          element.setAttribute(namespace, name, propertyEditor.getValue());
        } else {
          final ConverterRegistry instance = ConverterRegistry.getInstance();
          final ValueConverter valueConverter = instance.getValueConverter(type);
          if (valueConverter != null) {
            final Object o = ConverterRegistry.toPropertyValue(attributeValue, type);
            element.setAttribute(namespace, name, o);
          } else if (String.class.isAssignableFrom(type)) {
            // the attribute would allow raw-string values, so copy the element ..
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.util.beans.ConverterRegistry

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.