Examples of StyleKey


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

        group = data.getGrouping(locale);
        System.out.println();
        System.out.println("h2. " + group);
        System.out.println("||Name (Internal-Name)||Value-Type||Description||");
      }
      final StyleKey key = data.getStyleKey();
      if (data.isPreferred())
      {
        System.out.print("|*" + data.getDisplayName(locale) + "* (" + key.getName() + ") |");
      }
      else if (data.isDeprecated())
      {
        System.out.print("|-" + data.getDisplayName(locale) + "-|");
      }
View Full Code Here

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

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

    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

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

    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

Examples of org.pentaho.reporting.libraries.css.model.StyleKey

    {
      for (int i = 0; i < entries.length; i++)
      {
        Map.Entry entry = entries[i];
        CSSValueReadHandler valueReadHandler = (CSSValueReadHandler) entry.getValue();
        StyleKey key = (StyleKey) entry.getKey();
        CSSValue value = valueReadHandler.createValue(key, unit);
        if (value != null)
        {
          map.put(key, value);
          break;
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.model.StyleKey

    }

    StyleKey[] keys = handler.getAffectedKeys();
    for (int i = 0; i < keys.length; i++)
    {
      StyleKey key = keys[i];
      rule.setPropertyValue(key, CSSInheritValue.getInstance(), important);
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.model.StyleKey

    }

    StyleKey[] keys = handler.getAffectedKeys();
    for (int i = 0; i < keys.length; i++)
    {
      StyleKey key = keys[i];
      final CSSCompoundAttrFunction cattr = new CSSCompoundAttrFunction
          (name, attr.getNamespace(), attr.getName(), attr.getValueType());
      rule.setPropertyValue(key, cattr, important);
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.model.StyleKey

    {
      throw new NullPointerException("Rule given is null.");
    }

    final String normalizedName = name.toLowerCase();
    final StyleKey key = registry.findKeyByName(normalizedName);
    if (value.getLexicalUnitType() == LexicalUnit.SAC_INHERIT)
    {
      if (key == null)
      {
        setCompundInheritValue(normalizedName, rule, important);
        return;
      }
      rule.setPropertyValue(key, CSSInheritValue.getInstance(), important);
      return;
    }

    if (value.getLexicalUnitType() == LexicalUnit.SAC_ATTR)
    {
      final CSSAttrFunction attrFn = parseAttrFunction(value);
      // ATTR function.
      if (attrFn != null)
      {
        if (key == null)
        {
          // Log.warn("Got no key for attribute-function " + normalizedName);
          setCompundAttrValue(normalizedName, attrFn, rule, important);
          return;
        }
        rule.setPropertyValue(key, attrFn, important);
      }
      return;
    }
    else if (isFunctionValue(value) && "attr".equals(value.getFunctionName()))
    {
      // ATTR function (extended version).
      if (key == null)
      {
        logger.warn("Got no key for attribute-function " + normalizedName);
        return;
      }
      final CSSAttrFunction attrFn = parseComplexAttrFn(value.getParameters());
      if (attrFn != null)
      {
        rule.setPropertyValue(key, attrFn, important);
      }
      return;
    }

    if (key != null)
    {
      CSSValue cssValue = createValue(key, value);
      if (cssValue != null)
      {
        rule.setPropertyValue(key, cssValue, important);
        //Log.debug ("Got value " + key.getName() + " = " + cssValue + "(" + cssValue.getClass() + ") - (important = " + important + ")");
        return;
      }
    }

    final CSSCompoundValueReadHandler module =
        (CSSCompoundValueReadHandler) compoundHandlers.get(normalizedName);
    if (module == null)
    {
      if (key == null)
      {
        logger.info("Unknown style-key: Neither compound handlers nor single-value handers are registered for " + normalizedName);
        return;
      }

      logger.warn("Unparsable value: Got no valid result for " + normalizedName + " (" + value + ')');
      return; // ignore this rule ..
    }

    Map map = module.createValues(value);
    if (map == null)
    {
      return;
    }
    Iterator iterator = map.entrySet().iterator();
    while (iterator.hasNext())
    {
      Map.Entry entry = (Map.Entry) iterator.next();
      StyleKey entryKey = (StyleKey) entry.getKey();
      CSSValue mapCssValue = (CSSValue) entry.getValue();

      rule.setPropertyValue(entryKey, mapCssValue, important);
      //Log.debug ("Got value " + entryKey.getName() + " = " + mapCssValue + "(" + mapCssValue.getClass() + ") - (important = " + important + ")");
    }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.model.StyleKey

    if (style.copyFrom(initialStyle) == false)
    {
      // manually copy all styles from the initial style-set..
      for (int i = 0; i < keys.length; i++)
      {
        final StyleKey key = keys[i];
        style.setValue(key, initialStyle.getValue(key));
      }
    }

    // Stage 1a: Add the parent styles (but only the one marked as inheritable).

    // If our element has a parent, get the parent's style information
    // so we can "inherit" the styles that support that kind of thing
    if (parent != null)
    {
      final LayoutStyle parentStyle;
      parentStyle = parent.getLayoutStyle();
      final StyleKey[] inheritedKeys = getInheritedKeys();
      for (int i = 0; i < inheritedKeys.length; i++)
      {
        final StyleKey key = inheritedKeys[i];
        style.setValue(key, parentStyle.getValue(key));
      }
    }

    // At this point, the parentStyle contains the "foundation" from which
    // the current element's style information will come....

    // Stage 1b: Find all matching stylesheet styles for the given element.
    performSelectionStep(element, style);

    // Stage 1c: Add the contents of the style attribute, if there is one ..
    // the libLayout style is always added: This is a computed style and the hook
    // for a element neutral user defined tweaking ..

    final Object libLayoutStyleValue = element.getAttribute(Namespaces.LIBLAYOUT_NAMESPACE, "style");
    // You cannot override element specific styles with that. So an HTML-style
    // attribute has more value than a LibLayout-style attribute.
    addStyleFromAttribute(element, libLayoutStyleValue);

    if (strictStyleMode)
    {
      performStrictStyleAttr(element);
    }
    else
    {
      performCompleteStyleAttr(element);
    }

    // Stage 2: Compute the 'specified' set of values.
    // Find all explicitly inherited styles and add them from the parent.
    final CSSInheritValue inheritInstance = CSSInheritValue.getInstance();
    if (parent == null)
    {
      for (int i = 0; i < keys.length; i++)
      {
        final StyleKey key = keys[i];
        final Object value = style.getValue(key);
        if (inheritInstance.equals(value))
        {
          style.setValue(key, initialStyle.getValue(key));
        }
      }
    }
    else
    {
      final LayoutStyle parentStyle = parent.getLayoutStyle();
      for (int i = 0; i < keys.length; i++)
      {
        final StyleKey key = keys[i];
        final Object value = style.getValue(key);
        if (inheritInstance.equals(value))
        {
          final CSSValue parentValue = parentStyle.getValue(key);
          if (parentValue == null)
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.model.StyleKey

    {
      final StyleKey[] keys = getKeys();
      final ArrayList inheritedKeysList = new ArrayList();
      for (int i = 0; i < keys.length; i++)
      {
        final StyleKey key = keys[i];
        if (key.isInherited())
        {
          inheritedKeysList.add(key);
        }
      }
      inheritedKeys = (StyleKey[])
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.