Package org.jfree.layouting.layouter.style.resolver

Examples of org.jfree.layouting.layouter.style.resolver.StyleResolver


      {
        // Currently, we're in a table-body element, and expect rows to follow.
        // Stupid user gave us something else instead, so we have to autogenerate
        // a row and a cell..
        // Autogenerate the table-row ..
        final StyleResolver styleResolver = layoutProcess.getStyleResolver();
        final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);
        final LayoutContext rowContext =
            styleResolver.createAnonymousContext(id, layoutContext);
        fc.addElement(MODEL_TABLE_ROW, FLAG_AUTOGENERATED | TYPE_TABLE_ROW, rowContext);
        contentGenerator.startedTableRow(rowContext);

        final LayoutContext cellContext =
            styleResolver.createAnonymousContext(id, rowContext);
        fc.addElement(MODEL_BLOCK_INSIDE, FLAG_AUTOGENERATED | TYPE_TABLE_CELL, cellContext);
        contentGenerator.startedTableCell(cellContext);
        addToBlockLevelBox(layoutContext);
        return;
      }
      case MODEL_TABLE_ROW:
      {
        final StyleResolver styleResolver = layoutProcess.getStyleResolver();
        final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);

        final LayoutContext cellContext =
            styleResolver.createAnonymousContext(id, layoutContext);
        fc.addElement(MODEL_BLOCK_INSIDE, FLAG_AUTOGENERATED | TYPE_TABLE_CELL, cellContext);
        contentGenerator.startedTableCell(cellContext);
        addToBlockLevelBox(layoutContext);
        return;
      }
View Full Code Here


    // check if the parent is a table.
    final int currentDisplayModel = fc.getCurrentDisplayModel();
    if (currentDisplayModel != MODEL_TABLE)
    {
      // Autogenerate the table ..
      final StyleResolver styleResolver = layoutProcess.getStyleResolver();
      final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);

      final LayoutContext tableContext =
          styleResolver.createAnonymousContext(id, context);
      fc.addElement(MODEL_TABLE, FLAG_AUTOGENERATED | TYPE_TABLE, tableContext);
      contentGenerator.startedTable(tableContext);
    }

    fc.addElement(MODEL_BLOCK_INSIDE, TYPE_TABLE_CAPTION, context);
View Full Code Here

    // check if the parent is a table.
    final int currentDisplayModel = fc.getCurrentDisplayModel();
    if (currentDisplayModel != MODEL_TABLE)
    {
      // Autogenerate the table ..
      final StyleResolver styleResolver = layoutProcess.getStyleResolver();
      final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);

      final LayoutContext tableContext =
          styleResolver.createAnonymousContext(id, context);
      fc.addElement(MODEL_TABLE, FLAG_AUTOGENERATED | TYPE_TABLE, tableContext);
      contentGenerator.startedTable(tableContext);
    }

    fc.addElement(MODEL_TABLE_COLGROUP, TYPE_TABLE_COLGROUP, context);
View Full Code Here

    final int currentDisplayModel = fc.getCurrentDisplayModel();
    if (currentDisplayModel != MODEL_TABLE &&
        currentDisplayModel != MODEL_TABLE_COLGROUP)
    {
      // Autogenerate the table ..
      final StyleResolver styleResolver = layoutProcess.getStyleResolver();
      final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);

      suspendNonBlockElements();
      final LayoutContext tableContext =
          styleResolver.createAnonymousContext(id, context);
      fc.addElement(MODEL_TABLE, FLAG_AUTOGENERATED | TYPE_TABLE, tableContext);
      contentGenerator.startedTable(tableContext);
    }

    fc.addElement(MODEL_TABLE_COL, TYPE_TABLE_COL, context);
View Full Code Here

    // check if the parent is a table.
    final int currentDisplayModel = fc.getCurrentDisplayModel();
    if (currentDisplayModel != MODEL_TABLE)
    {
      // Autogenerate the table ..
      final StyleResolver styleResolver = layoutProcess.getStyleResolver();
      final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);

      // the table is a block level element here, so we have to close any open
      // paragraphs before proceeding ..
      suspendNonBlockElements();

      final LayoutContext tableContext =
          styleResolver.createAnonymousContext(id, context);
      fc.addElement(MODEL_TABLE, FLAG_AUTOGENERATED | TYPE_TABLE, tableContext);
      contentGenerator.startedTable(tableContext);
    }

    fc.addElement(MODEL_TABLE_SECTION, TYPE_TABLE_SECTION, context);
View Full Code Here

    final FlowContext fc = (FlowContext) flowContexts.peek();
    // check if the parent is a table.
    final int currentDisplayModel = fc.getCurrentDisplayModel();
    if (currentDisplayModel != MODEL_TABLE_SECTION)
    {
      final StyleResolver styleResolver = layoutProcess.getStyleResolver();
      final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);

      if (currentDisplayModel != MODEL_TABLE)
      {
        // there is not even a table .. generate it
        // Autogenerate the table ..
        final LayoutContext tableContext =
            styleResolver.createAnonymousContext(id, context);

        suspendNonBlockElements();
        fc.addElement(MODEL_TABLE, FLAG_AUTOGENERATED | TYPE_TABLE, tableContext);
        contentGenerator.startedTable(tableContext);
      }

      // OK, finally add the table section ..
      final LayoutContext sectionContext =
          styleResolver.createAnonymousContext(id, context);
      fc.addElement(MODEL_TABLE_SECTION, FLAG_AUTOGENERATED | TYPE_TABLE_SECTION, sectionContext);
      contentGenerator.startedTableSection(sectionContext);
    }

    fc.addElement(MODEL_TABLE_ROW, TYPE_TABLE_ROW, context);
View Full Code Here

    final FlowContext fc = (FlowContext) flowContexts.peek();
    // check if the parent is a table.
    int currentDisplayModel = fc.getCurrentDisplayModel();
    if (currentDisplayModel != MODEL_TABLE_ROW)
    {
      final StyleResolver styleResolver = layoutProcess.getStyleResolver();
      final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);

      if (currentDisplayModel != MODEL_TABLE &&
          currentDisplayModel != MODEL_TABLE_SECTION)
      {
        // generate the table ..
        suspendNonBlockElements();

        final LayoutContext tableContext =
            styleResolver.createAnonymousContext(id, context);
        fc.addElement(MODEL_TABLE, FLAG_AUTOGENERATED | TYPE_TABLE, tableContext);
        contentGenerator.startedTable(tableContext);
        currentDisplayModel = MODEL_TABLE;
      }

      if (currentDisplayModel != MODEL_TABLE_SECTION)
      {
        // OK, generate the table section ..
        final LayoutContext sectionContext =
            styleResolver.createAnonymousContext(id, context);
        fc.addElement(MODEL_TABLE_SECTION, FLAG_AUTOGENERATED | TYPE_TABLE_SECTION, sectionContext);
        contentGenerator.startedTableSection(sectionContext);
      }

      // Autogenerate the table-row ..
      final LayoutContext rowContext =
          styleResolver.createAnonymousContext(id, context);
      fc.addElement(MODEL_TABLE_ROW, FLAG_AUTOGENERATED | TYPE_TABLE_ROW, rowContext);
      contentGenerator.startedTableRow(rowContext);
    }

    fc.addElement(MODEL_BLOCK_INSIDE, TYPE_TABLE_CELL, context);
View Full Code Here

      // Generate the paragraph box ..
      if (reactivateSuspendedInlines(fc) == false)
      {
        // todo: check for possibly suspended inlines and reactivate them

        final StyleResolver styleResolver = layoutProcess.getStyleResolver();
        final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);
        final LayoutContext paragraphContext =
            styleResolver.createAnonymousContext(id, context);
        fc.addElement(MODEL_INLINE_INSIDE, FLAG_AUTOGENERATED | TYPE_PARAGRAPH, paragraphContext);
        contentGenerator.startedRootInline(paragraphContext);
      }

      // now add the element ..
      final CSSValue displayModel = context.getValue(BoxStyleKeys.DISPLAY_MODEL);
      if (DisplayModel.TABLE.equals(displayModel))
      {
        fc.addElement(MODEL_TABLE, TYPE_INLINE, context);
        contentGenerator.startedTable(context);
      }
      else if (DisplayModel.INLINE_INSIDE.equals(displayModel))
      {
        fc.addElement(MODEL_INLINE_INSIDE, TYPE_INLINE, context);
        contentGenerator.startedInline(context);
      }
      else
      {
        fc.addElement(MODEL_BLOCK_INSIDE, TYPE_BLOCK, context);
        contentGenerator.startedBlock(context);
      }
      return;
    }

    // Todo: need to check for run-in and compact as well..
    // Everything else is considered a block-level element and treated as such..
    final CSSValue displayModel = context.getValue(BoxStyleKeys.DISPLAY_MODEL);
    if (DisplayModel.TABLE.equals(displayModel))
    {
      fc.addElement(MODEL_TABLE, TYPE_TABLE, context);
      contentGenerator.startedTable(context);
    }
    else if (DisplayModel.INLINE_INSIDE.equals(displayModel))
    {
      // A block level element that declares that all its direct childs should
      // be treated as inline-level elements. We create a paragraph box for that
      // one.
      fc.addElement(MODEL_INLINE_INSIDE, TYPE_BLOCK, context);
      contentGenerator.startedBlock(context);

      final StyleResolver styleResolver = layoutProcess.getStyleResolver();
      final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);
      final LayoutContext paragraphContext =
          styleResolver.createAnonymousContext(id, context);
      fc.addElement(MODEL_INLINE_INSIDE,
          FLAG_AUTOGENERATED | TYPE_PARAGRAPH, paragraphContext);
      contentGenerator.startedRootInline(paragraphContext);
    }
    else
View Full Code Here

  }

  private void addToTableLevelBox(final LayoutContext context)
      throws NormalizationException
  {
    final StyleResolver styleResolver = layoutProcess.getStyleResolver();
    final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);

    // This is some non-table content that has been added to a table.
    // This generally means that someone messed up the layout, we have to
    // generate a default table ...
    final FlowContext fc = (FlowContext) flowContexts.peek();

    final LayoutContext sectionContext =
        styleResolver.createAnonymousContext(id, context);
    fc.addElement(MODEL_TABLE_SECTION, FLAG_AUTOGENERATED | TYPE_TABLE_SECTION, sectionContext);
    contentGenerator.startedTableSection(sectionContext);

    final LayoutContext rowContext =
        styleResolver.createAnonymousContext(id, sectionContext);
    fc.addElement(MODEL_TABLE_ROW, FLAG_AUTOGENERATED | TYPE_TABLE_ROW, rowContext);
    contentGenerator.startedTableRow(rowContext);

    final LayoutContext cellContext =
        styleResolver.createAnonymousContext(id, rowContext);
    fc.addElement(MODEL_BLOCK_INSIDE, FLAG_AUTOGENERATED | TYPE_TABLE_CELL, cellContext);
    contentGenerator.startedTableCell(cellContext);

    addToBlockLevelBox(context);
  }
View Full Code Here

    {
      // todo: check for suspended inlines and reactivate them if needed.
      if (reactivateSuspendedInlines(fc) == false)
      {
        // generate a inline box ..
        final StyleResolver styleResolver = layoutProcess.getStyleResolver();
        final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);
        final LayoutContext paragraphContext =
            styleResolver.createAnonymousContext(id, layoutContext);
        fc.addElement(MODEL_INLINE_INSIDE, FLAG_AUTOGENERATED | TYPE_PARAGRAPH, paragraphContext);
        contentGenerator.startedRootInline(paragraphContext);
        contentGenerator.addContent(paragraphContext, content);
      }
      else
View Full Code Here

TOP

Related Classes of org.jfree.layouting.layouter.style.resolver.StyleResolver

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.