Package org.jfree.layouting.input.style

Examples of org.jfree.layouting.input.style.StyleKey


    }

    final StyleKey[] keys = handler.getAffectedKeys();
    for (int i = 0; i < keys.length; i++)
    {
      final StyleKey key = keys[i];
      final CSSCompoundAttrFunction cattr = new CSSCompoundAttrFunction
              (name, attr.getNamespace(), attr.getName(), attr.getType());
      rule.setPropertyValue(key, cattr);
      rule.setImportant(key, 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());
      rule.setImportant(key, 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);
        rule.setImportant(key, important);
      }
      return;
    }
    else if (isFunctionValue(value) && "attr".equals(value.getFunctionName()))
    {
      // ATTR function (extended version).
      if (key == null)
      {
        Log.warn("Got no key for attribute-function " + normalizedName);
        return;
      }
      final CSSAttrFunction attrFn = parseComplexAttrFn(value.getParameters());
      if (attrFn != null)
      {
        rule.setPropertyValue(key, attrFn);
        rule.setImportant(key, important);
      }
      return;
    }

    if (key != null)
    {
      final CSSValue cssValue = createValue(key, value);
      if (cssValue != null)
      {
        rule.setPropertyValue(key, cssValue);
        rule.setImportant(key, 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)
      {
        Log.info("Unknown style-key: Neither compound handlers nor single-value handers are registered for " + normalizedName);
        return;
      }

      Log.warn("Unparsable value: Got no valid result for " + normalizedName + " (" + value + ')');
      return; // ignore this rule ..
    }
    final Map map = module.createValues(value);
    if (map == null)
    {
      return;
    }
    final Iterator iterator = map.entrySet().iterator();
    while (iterator.hasNext())
    {
      final Map.Entry entry = (Map.Entry) iterator.next();
      final StyleKey entryKey = (StyleKey) entry.getKey();
      final CSSValue mapCssValue = (CSSValue) entry.getValue();

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

  protected CSSValue resolveValue (final LayoutProcess process,
                                   final LayoutElement currentNode,
                                   final StyleKey key)
  {
    final StyleKey borderStyleKey = (StyleKey) keyMapping.get(key);
    if (borderStyleKey == null)
    {
      // invalid
      throw new IllegalArgumentException("This is not a valid key: " + key);
    }
View Full Code Here

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

                                           final CSSDeclarationRule source)
  {
    final Iterator it = source.getPropertyKeys();
    while (it.hasNext())
    {
      final StyleKey key = (StyleKey) it.next();
      final CSSValue value = source.getPropertyCSSValue(key);
      final boolean sourceImportant = source.isImportant(key);
      final boolean targetImportant = target.isImportant(key);
      if (targetImportant)
      {
View Full Code Here

        expression.setRuntime(runtime);
        final Object value = expression.computeValue();
        if (value instanceof CSSValue)
        {
          final CSSValue cssvalue = (CSSValue) value;
          final StyleKey keyByName =
              StyleKeyRegistry.getRegistry().findKeyByName(name);
          if (keyByName != null)
          {
            targetRule.setPropertyValue(keyByName, cssvalue);
          }
View Full Code Here

      if (element == null)
      {
        final StyleKey[] propertyKeys = rule.getPropertyKeysAsArray();
        for (int i = 0; i < propertyKeys.length; i++)
        {
          final StyleKey key = propertyKeys[i];
          target.setValue(key, rule.getPropertyCSSValue(key));
        }
        return;
      }

      final StyleKey[] propertyKeys = rule.getPropertyKeysAsArray();
      final CSSValue[] values = new CSSValue[rule.getSize()];
      for (int i = 0; i < values.length; i++)
      {
        final StyleKey key = propertyKeys[i];
        CSSValue value = rule.getPropertyCSSValue(key);
        if (ContentStyleKeys.CONTENT.equals(key) ||
            ContentStyleKeys.STRING_DEFINE.equals(key) ||
            ContentStyleKeys.STRING_SET.equals(key))
        {
          // dont resolve that one ..
          values[i] = value;
        }
        else
        {
          values[i] = resolveValue(value, element);
        }
      }

      for (int i = 0; i < values.length; i++)
      {
        final StyleKey key = propertyKeys[i];
        target.setValue(key, values[i]);
      }
    }
    catch (FunctionEvaluationException e)
    {
View Full Code Here

    final StyleBuilder inialBuilder = new StyleBuilder(false);
    final StyleKey[] keys = StyleKeyRegistry.getRegistry().getKeys();
    for (int i = 0; i < keys.length; i++)
    {
      final StyleKey key = keys[i];
      if (key.isInherited())
      {
        inialBuilder.append(key, initialStyle.getValue(key));
      }
    }
    contexts.push(new ContextElement(inialBuilder));
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());
      rule.setImportant(key, 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.getType());
      rule.setPropertyValue(key, cattr);
      rule.setImportant(key, important);
    }
View Full Code Here

TOP

Related Classes of org.jfree.layouting.input.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.