Package org.jfree.layouting.layouter.context

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


    }

    // check, whether the element allows content at all..
    // isAllowContentProcessing is false, if the 'content' property
    // had been set to 'none' or 'inhibit'.
    final ContentSpecification contentSpec =
        currentElement.getLayoutContext().getContentSpecification();
    if (contentSpec.isAllowContentProcessing() == false)
    {
      // Quote-the-standard:
      // -------------------
      // On elements, this inhibits the children of the element from
      // being rendered as children of this element, as if the element
      // was empty.
      //
      // On pseudo-elements, this inhibits the creation of the pseudo-element,
      // as if 'display' computed to 'none'.
      //
      // In both cases, this further inhibits the creation of any
      // pseudo-elements which have this pseudo-element as a superior.
      if (contentSpec.isInhibitContent() &&
          layoutContext.isPseudoElement())
      {
//          Log.debug("Starting to ignore childs of psuedo element " +
//                  layoutContext.getTagName() + ":" +
//                  layoutContext.getPseudoElement() +
View Full Code Here


   * Warning: This possibly duplicates content and is definitly an expensive
   * operation.
   */
  private boolean isStringRecordingNeeded(final LayoutElement element)
  {
    final ContentSpecification contentSpecification =
        element.getLayoutContext().getContentSpecification();
    final ContentToken[] strings = contentSpecification.getStrings();

    // todo: This might be invalid.

    final LayoutContext layoutContext = element.getLayoutContext();
    final CSSValue value = layoutContext.getValue(ContentStyleKeys.STRING_DEFINE);
View Full Code Here

  }

  protected boolean generateContentBefore(final LayoutElement element)
      throws IOException, NormalizationException
  {
    final ContentSpecification cspec =
        element.getLayoutContext().getContentSpecification();
    final ContentToken[] tokens = cspec.getContents();
    for (int i = 0; i < tokens.length; i++)
    {
      final ContentToken token = tokens[i];
      if (token instanceof ContentsToken)
      {
View Full Code Here

  }

  protected void generateContentAfter(final LayoutElement element)
      throws IOException, NormalizationException
  {
    final ContentSpecification cspec =
        element.getLayoutContext().getContentSpecification();
    final ContentToken[] tokens = cspec.getContents();
    int posContent = 0;
    // first skip everything up to the first 'contents' token.
    for (; posContent < tokens.length; posContent++)
    {
      final ContentToken token = tokens[posContent];
View Full Code Here


  protected void generateStrings(final LayoutElement element)
      throws IOException, NormalizationException
  {
    final ContentSpecification cspec =
        element.getLayoutContext().getContentSpecification();
    final ContentToken[] tokens = cspec.getContents();
    int posContent = 0;
    boolean contentGiven = false;
    // first skip everything up to the first 'contents' token.
    for (; posContent < tokens.length; posContent++)
    {
View Full Code Here

    return null;
  }

  private QuotesPair getQuotesPair()
  {
    final ContentSpecification cspec =
        currentElement.getLayoutContext().getContentSpecification();
    final QuotesPair[] qps = cspec.getQuotes();
    final int maxQuote = Math.min(qps.length - 1, quoteLevel);
    if (maxQuote == -1)
    {
      return null;
    }
View Full Code Here

    }

    if (ignoreContext == 1)
    {
      final LayoutContext layoutContext = currentElement.getLayoutContext();
      final ContentSpecification contentSpec =
          layoutContext.getContentSpecification();

      // replace the contents token of the string-keystyle with the
      // extracted content.
      generateStrings(currentElement);
      if (contentSpec.isAllowContentProcessing() == false)
      {
        if (!contentSpec.isInhibitContent() ||
            !layoutContext.isPseudoElement())
        {
          // clean up (2): The element generated some stuff..
          generateAfterPseudoElements(currentElement);
        }
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

  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(DEFAULT_CONTENT);
        return;
      }
    }

    contentSpecification.setStrings(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

  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

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.