Package org.jfree.layouting.input.style

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


                                           final CSSDeclarationRule source)
  {
    final StyleKey[] styleKeys = source.getPropertyKeysAsArray();
    for (int i = 0; i < styleKeys.length; i++)
    {
      final StyleKey key = styleKeys[i];
      final CSSValue value = source.getPropertyCSSValue(key);
      if (value == null)
      {
        continue;
      }
View Full Code Here


      final Expression expression = (Expression) entry.getValue();
      try
      {
        expression.setRuntime(runtime);
        final Object value = expression.computeValue();
        final StyleKey keyByName =
            StyleKeyRegistry.getRegistry().findKeyByName(name);

        if (value instanceof CSSValue)
        {
          final CSSValue cssvalue = (CSSValue) value;
View Full Code Here

    {
      // ok, manual copy ..
      DebugLog.log("Failed to use fast-copy");
      for (int i = 0; i < keys.length; i++)
      {
        final StyleKey key = keys[i];
        layoutContext.setValue(key, initialStyle.getValue(key));
      }
    }

    final LayoutStyle parentStyle;
    if (parent != null)
    {
      parentStyle = parent.getLayoutContext();
      final StyleKey[] inheritedKeys = getInheritedKeys();
      for (int i = 0; i < inheritedKeys.length; i++)
      {
        final StyleKey key = inheritedKeys[i];
        layoutContext.setValue(key, parentStyle.getValue(key));
      }
    }
    else
    {
      parentStyle = initialStyle;
    }

    // Stage 1b: Find all matching stylesheets for the given element
    performSelectionStep(element, layoutContext);

    // 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 AttributeMap attributes = layoutContext.getAttributes();
    final Object libLayoutStyleValue = attributes.getAttribute
            (Namespaces.LIBLAYOUT_NAMESPACE, "style");
    // You cannot override element specific styles with that. So an HTML-style
    // attribute has move 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();
    for (int i = 0; i < keys.length; i++)
    {
      final StyleKey key = keys[i];
      final Object value = layoutContext.getValue(key);
      if (inheritInstance.equals(value))
      {
        layoutContext.setValue(key, parentStyle.getValue(key));
      }
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[propertyKeys.length];
      for (int i = 0; i < values.length; i++)
      {
        final StyleKey key = propertyKeys[i];
        final CSSValue value = rule.getPropertyCSSValue(key);
        if (value == null)
        {
          continue;
        }
        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 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

    {
      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 = handler.getAffectedKeys();
    for (int i = 0; i < keys.length; i++)
    {
      final StyleKey key = keys[i];
      rule.setPropertyValue(key, CSSInheritValue.getInstance());
      rule.setImportant(key, important);
    }
  }
View Full Code Here

    }

    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)
      {
        logger.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)
      {
        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 ..
    }
    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

    final LayoutStyle initialStyle = getInitialStyle();

    // initialize the style ...
    for (int i = 0; i < keys.length; i++)
    {
      final StyleKey key = keys[i];
      layoutContext.setValue(key, initialStyle.getValue(key));
    }

    // Stage 2: Search for all class attributes, and lookup the corresponding
    // style. The sty
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.