Package org.jfree.layouting.layouter.context

Examples of org.jfree.layouting.layouter.context.ContentSpecification


  public void resolve(final LayoutProcess process,
                      final LayoutElement element,
                      final StyleKey key)
  {
    final LayoutContext layoutContext = element.getLayoutContext();
    final ContentSpecification contentSpecification =
        layoutContext.getContentSpecification();

    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSConstant)
    {
      if (ContentValues.NONE.equals(value))
      {
        contentSpecification.setAllowContentProcessing(false);
        contentSpecification.setInhibitContent(false);
        contentSpecification.setContents(PSEUDO_CONTENT);
        return;
      }
      else if (ContentValues.INHIBIT.equals(value))
      {
        contentSpecification.setAllowContentProcessing(false);
        contentSpecification.setInhibitContent(true);
        contentSpecification.setContents(PSEUDO_CONTENT);
        return;
      }
      else if (ContentValues.NORMAL.equals(value))
      {
        if (layoutContext.isPseudoElement())
        {
          if (isListMarker(element))
          {
            processListItem(process, element, contentSpecification);
            return;
          }
          else
          {
            // a pseudo-element does not have content by default.
            contentSpecification.setAllowContentProcessing(false);
            contentSpecification.setInhibitContent(true);
            contentSpecification.setContents(PSEUDO_CONTENT);
            return;
          }
        }
      }
    }

    contentSpecification.setInhibitContent(false);
    contentSpecification.setAllowContentProcessing(true);
    contentSpecification.setContents(DEFAULT_CONTENT);

    if (value instanceof CSSAttrFunction)
    {
      final ContentToken token =
          evaluateFunction((CSSFunctionValue) value, process, element);
      if (token == null)
      {
        return;
      }
      contentSpecification.setContents(new ContentToken[]{token});
    }

    if (value instanceof CSSValueList == false)
    {
      return; // cant handle that one
    }

    final ArrayList tokens = new ArrayList();
    final CSSValueList list = (CSSValueList) value;
    final int size = list.getLength();
    for (int i = 0; i < size; i++)
    {
      final CSSValueList sequence = (CSSValueList) list.getItem(i);
      for (int j = 0; j < sequence.getLength(); j++)
      {
        final CSSValue content = sequence.getItem(j);
        final ContentToken token = createToken(process, element, content);
        if (token == null)
        {
          // ok, a failure. Skip to the next content spec ...
          tokens.clear();
          break;
        }
        tokens.add(token);
      }
      if (tokens.isEmpty() == false)
      {
        final ContentToken[] contents = (ContentToken[]) tokens.toArray
            (new ContentToken[tokens.size()]);
        contentSpecification.setContents(contents);
        return;
      }
    }

  }
View Full Code Here


  public void resolve (final LayoutProcess process,
                       final LayoutElement element,
                       final StyleKey key)
  {
    final LayoutContext layoutContext = element.getLayoutContext();
    final ContentSpecification contentSpecification =
            layoutContext.getContentSpecification();
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSConstant)
    {
      if (ContentValues.NONE.equals(value))
      {
        contentSpecification.setStrings(XAlternateTextResolveHandler.DEFAULT_CONTENT);
        return;
      }
    }

    contentSpecification.setStrings(XAlternateTextResolveHandler.DEFAULT_CONTENT);
    if (value instanceof CSSAttrFunction)
    {
      final ContentToken token =
              evaluateFunction((CSSFunctionValue) value, process, element);
      if (token == null)
      {
        return;
      }
      contentSpecification.setStrings(new ContentToken[]{token});
    }

    if (value instanceof CSSValueList == false)
    {
      return; // cant handle that one
    }

    final ArrayList tokens = new ArrayList();
    final CSSValueList list = (CSSValueList) value;
    final int size = list.getLength();
    for (int i = 0; i < size; i++)
    {
      final CSSValueList sequence = (CSSValueList) list.getItem(i);
      for (int j = 0; j < sequence.getLength(); j++)
      {
        final CSSValue content = sequence.getItem(j);
        final ContentToken token = createToken(process, element, content);
        if (token == null)
        {
          // ok, a failure. Skip to the next content spec ...
          tokens.clear();
          break;
        }
        tokens.add(token);
      }
    }

    final ContentToken[] contents = (ContentToken[]) tokens.toArray
            (new ContentToken[tokens.size()]);
    contentSpecification.setStrings(contents);
  }
View Full Code Here

  }

  private boolean isCounterUsed (final LayoutElement element, final String counter)
  {
    final LayoutContext layoutContext = element.getLayoutContext();
    final ContentSpecification contentSpecification =
        layoutContext.getContentSpecification();
    final ContentToken[] contents = contentSpecification.getContents();
    for (int i = 0; i < contents.length; i++)
    {
      ContentToken content = contents[i];
      if (content instanceof ResolvedCounterToken)
      {
View Full Code Here

TOP

Related Classes of org.jfree.layouting.layouter.context.ContentSpecification

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.