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

Examples of org.pentaho.reporting.engine.classic.core.style.StyleKey


    }
    catch (ObjectFactoryException e)
    {
      throw new ReportWriterException("Unable to fill the parameters for key: " + key.getName(), e);
    }
    final StyleKey keyFromFactory = getReportWriter().getStyleKeyFactoryCollector()
        .getStyleKey(key.getName());
    if (keyFromFactory == null)
    {
      throw new ReportWriterException
          ("The stylekey " + key.getName() +
View Full Code Here


    if (styleExpressions.isEmpty() == false)
    {
      final FunctionsWriter fnWriter = new FunctionsWriter(getReportWriter(), writer);
      for (final Map.Entry<StyleKey, Expression> entry : styleExpressions.entrySet())
      {
        final StyleKey key = entry.getKey();
        final Expression ex = entry.getValue();
        fnWriter.writeStyleExpression(ex, key);
      }
    }
  }
View Full Code Here

    boolean retval = false;
    final ElementStyleSheet style = e.getStyle();
    for (final Map.Entry<StyleKey, Expression> entry : styleExpressions.entrySet())
    {
      final StyleKey key = entry.getKey();
      final Expression ex = entry.getValue();
      if (ex == null)
      {
        continue;
      }
      retval = true;
      ex.setRuntime(getRuntime());
      try
      {
        final Object value = evaluate(ex);
        if (value == null)
        {
          style.setStyleProperty(key, null);
        }
        else if (key.getValueType().isInstance(value))
        {
          style.setStyleProperty(key, value);
        }
        else if (value instanceof ErrorValue)
        {
          if (failOnErrors)
          {
            throw new InvalidReportStateException(String.format
                ("Failed to evaluate style-expression for key %s on element [%s]",// NON-NLS
                    key.getName(),
                    FunctionUtilities.computeElementLocation(e)));
          }
          style.setStyleProperty(key, null);
        }
        else
        {
          final ValueConverter valueConverter = ConverterRegistry.getInstance().getValueConverter(key.getValueType());
          if (valueConverter != null)
          {
            // try to convert it ..
            final Object o = ConverterRegistry.toPropertyValue(String.valueOf(value), key.getValueType());
            style.setStyleProperty(key, o);
          }
          else
          {
            style.setStyleProperty(key, null);
          }
        }
      }
      catch (InvalidReportStateException exception)
      {
        throw exception;
      }
      catch (Exception exception)
      {
        if (logger.isDebugEnabled())
        {
          logger.debug(String.format
              ("Failed to evaluate style expression for element '%s', style-key %s", // NON-NLS
                  e, key), exception);
        }
        if (failOnErrors)
        {
          throw new InvalidReportStateException(String.format
              ("Failed to evaluate style-expression for key %s on element [%s]",// NON-NLS
                  key.getName(),
                  FunctionUtilities.computeElementLocation(e)), exception);
        }
        // ignored, but we clear the style as we have no valid value anymore.
        style.setStyleProperty(key, null);
      }
View Full Code Here

   * @throws SAXException if there is a parsing error.
   */
  protected void doneParsing() throws SAXException {
    for (int i = 0; i < styleExpressions.size(); i++) {
      final StyleExpressionHandler handler = styleExpressions.get(i);
      final StyleKey key = handler.getKey();
      if (handler.getKey() != null) {
        final Expression expression = handler.getExpression();
        element.setStyleExpression(key, expression);
      }
    }
View Full Code Here

    handleInheritedStyle(styleClass);

    for (int i = 0; i < styleExpressionHandlers.size(); i++)
    {
      final StyleExpressionHandler handler = styleExpressionHandlers.get(i);
      final StyleKey key = handler.getKey();
      if (handler.getKey() != null)
      {
        final Expression expression = handler.getExpression();
        element.setStyleExpression(key, expression);
      }
View Full Code Here

    // write style expressions.
    final Map<StyleKey, Expression> styleExpressions = element.getStyleExpressions();
    for (final Map.Entry<StyleKey, Expression> entry : styleExpressions.entrySet())
    {
      final StyleKey key = entry.getKey();
      final Expression ex = entry.getValue();
      ExpressionWriterUtility.writeStyleExpression(bundle, state, ex, writer, key, BundleNamespaces.LAYOUT,
          "style-expression");
    }
  }
View Full Code Here

  public StyleKey getStyleKey(final String name)
  {
    for (int i = 0; i < factories.size(); i++)
    {
      final StyleKeyFactory fact = (StyleKeyFactory) factories.get(i);
      final StyleKey o = fact.getStyleKey(name);
      if (o != null)
      {
        return o;
      }
    }
View Full Code Here

   * @param name the parameter name.
   * @return The value.
   */
  public Object getParameter(final String name)
  {
    final StyleKey key = keyfactory.getStyleKey(name);
    if (key == null)
    {
      throw new IllegalArgumentException("There is no handler for the stylekey: " + name);
    }
    return styleSheet.getStyleProperty(key);
View Full Code Here

        "preferred-size".equals(name))
    {
      return Dimension2D.class;
    }
   
    final StyleKey key = keyfactory.getStyleKey(name);
    if (key == null)
    {
      throw new IllegalArgumentException("There is no handler for the stylekey: " + name);
    }
    return key.getValueType();
  }
View Full Code Here

      styleSheet.setStyleProperty(ElementStyleKeys.WIDTH, new Float(d.getWidth()));
      styleSheet.setStyleProperty(ElementStyleKeys.HEIGHT, new Float(d.getHeight()));
      return;
    }

    final StyleKey key = keyfactory.getStyleKey(name);
    if (key == null)
    {
      throw new IllegalArgumentException("There is no handler for the stylekey: " + name);
    }
    styleSheet.setStyleProperty(key, value);
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.style.StyleKey

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.