Package org.pentaho.reporting.libraries.css.model

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


    }

    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

    }

    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

    {
      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

    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

    {
      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

    final StyleKey[] keys = module.getDependentKeys();
    parents.add(module);
    for (int i = 0; i < keys.length; i++)
    {
      final StyleKey key = keys[i];
      if (key.equals(module.getKey()))
      {
        throw new IllegalStateException("module referencing itself as dependency");
      }

      final SortModule child = (SortModule) moduleMap.get(key);
View Full Code Here

    public void addKeys (final StyleKey[] keys)
    {
      boolean haveAdded = false;
      for (int i = 0; i < keys.length; i++)
      {
        final StyleKey styleKey = keys[i];
        if (dependentKeySet.add(styleKey))
        {
          haveAdded = true;
        }
      }
View Full Code Here

    keys.addAll(compHandlers.keySet());
    keys.addAll(percHandlers.keySet());

    for (Iterator iterator = keys.iterator(); iterator.hasNext();)
    {
      final StyleKey key = (StyleKey) iterator.next();
      final ResolveHandler autoHandler = (ResolveHandler) autoHandlers.get(key);
      final ResolveHandler compHandler = (ResolveHandler) compHandlers.get(key);
      final ResolveHandler percHandler = (ResolveHandler) percHandlers.get(key);
      handlerList.add(new ResolveHandlerModule(key, autoHandler, compHandler,
              percHandler));
View Full Code Here

    final int length = configPrefix.length();
    while (sit.hasNext())
    {
      final String configkey = (String) sit.next();
      final String name = configkey.substring(length).toLowerCase();
      final StyleKey key = registry.findKeyByName(name);
      if (key == null)
      {
        logger.warn("Invalid stylekey for resolver: " + name);
        continue;
      }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.css.model.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.