Package org.apache.fop.layout

Examples of org.apache.fop.layout.BlockArea


            // initialize id
            String id = this.properties.get("id").getString();
            area.getIDReferences().initializeID(id, area);
        }

        BlockArea blockArea = new BlockArea(fs, area.getAllocationWidth(),
                                            area.spaceLeft(), startIndent, endIndent, 0, align,
                                            alignLast, lineHeight);
        blockArea.setPage(area.getPage());
        blockArea.setBackgroundColor(backgroundColor);
        blockArea.start();

        blockArea.setAbsoluteHeight(area.getAbsoluteHeight());
        blockArea.setIDReferences(area.getIDReferences());

        int numChildren = this.children.size();
        for (int i = this.marker; i < numChildren; i++) {
            if (!(children.elementAt(i) instanceof ListItem)) {
                MessageHandler.errorln("WARNING: This version of FOP requires list-items inside list-blocks");
                return new Status(Status.OK);
            }
            ListItem listItem = (ListItem) children.elementAt(i);
            listItem.setDistanceBetweenStarts(
              this.provisionalDistanceBetweenStarts);
            listItem.setLabelSeparation(this.provisionalLabelSeparation);
            listItem.setBodyIndent(this.bodyIndent);
            Status status;
            if ((status = listItem.layout(blockArea)).isIncomplete()) {
                if(status.getCode() == Status.AREA_FULL_NONE && i > 0) {
                    status = new Status(Status.AREA_FULL_SOME);
                }
                this.marker = i;
                blockArea.end();
                area.addChild(blockArea);
                area.increaseHeight(blockArea.getHeight());
                area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
                return status;
            }
        }

        blockArea.end();
        area.addChild(blockArea);
        area.increaseHeight(blockArea.getHeight());
        area.setAbsoluteHeight(blockArea.getAbsoluteHeight());

        if (spaceAfter != 0) {
            area.addDisplaySpace(spaceAfter);
        }
View Full Code Here


        }
    }


    public Status layout(Area area) throws FOPException {
        BlockArea blockArea;
        blockArea = (BlockArea) area;
        boolean textDecoration;

        //retrieving font property information for fo:leader
        String fontFamily = this.properties.get("font-family").getString();
        String fontStyle = this.properties.get("font-style").getString();
        String fontWeight = this.properties.get("font-weight").getString();
        int fontSize =
          this.properties.get("font-size").getLength().mvalue();
        // font-variant support
        // added by Eric SCHAEFFER
        int fontVariant =
          this.properties.get("font-variant").getEnum();

        FontState fontstate = new FontState(area.getFontInfo(), fontFamily,
                                fontStyle, fontWeight, fontSize, fontVariant);

        //color properties
        ColorType c = this.properties.get("color").getColorType();
        float red = c.red();
        float green = c.green();
        float blue = c.blue();

        int whiteSpaceCollapse = this.properties.get(
                                    "white-space-collapse").getEnum();
        int wrapOption = this.parent.properties.get("wrap-option").getEnum();

        int tmp = this.properties.get("text-decoration").getEnum();
        if (tmp == org.apache.fop.fo.properties.TextDecoration.UNDERLINE) {
          textDecoration = true;
        } else {
          textDecoration = false;
        }

        //Character specific properties
        char characterValue = this.properties.get("character").getCharacter();


        // initialize id
        String id = this.properties.get("id").getString();
        blockArea.getIDReferences().initializeID(id, blockArea);

        LineArea la = blockArea.getCurrentLineArea();
        if(la == null) {
            return new Status(Status.AREA_FULL_NONE);
        }
        la.changeFont(fontstate);
        la.changeColor(red, green, blue);
        la.changeWrapOption(wrapOption);
        la.changeWhiteSpaceCollapse(whiteSpaceCollapse);
        blockArea.setupLinkSet(this.getLinkSet());
        int result = la.addCharacter(characterValue, this.getLinkSet(), textDecoration);
        if (result == Character.DOESNOT_FIT) {
            la = blockArea.createNextLineArea();
            if(la == null) {
                return new Status(Status.AREA_FULL_NONE);
            }
            la.changeFont(fontstate);
            la.changeColor(red, green, blue);
            la.changeWrapOption(wrapOption);
            la.changeWhiteSpaceCollapse(whiteSpaceCollapse);
            blockArea.setupLinkSet(this.getLinkSet());
            la.addCharacter(characterValue, this.getLinkSet(), textDecoration);
        }
        return new Status(Status.OK);

    }
View Full Code Here

    startIndent += bodyIndent + distanceBetweenStarts;
    bodyIndent = startIndent;
      }
  }

  BlockArea blockArea =
      new BlockArea(fs, area.getAllocationWidth(),
        area.spaceLeft(), startIndent, endIndent, 0,
        align, alignLast, lineHeight);
  blockArea.setPage(area.getPage());
  blockArea.start();

  int numChildren = this.children.size();
  for (int i = this.marker; i < numChildren; i++) {
      if (!(children.elementAt(i) instanceof ListItem)) {
    System.err.println("WARNING: This version of FOP requires list-items inside list-blocks");
    return new Status(Status.OK);
      }
      ListItem listItem = (ListItem) children.elementAt(i);
      listItem.setDistanceBetweenStarts(this.provisionalDistanceBetweenStarts);
      listItem.setLabelSeparation(this.provisionalLabelSeparation);
      listItem.setBodyIndent(this.bodyIndent);
      Status status;
      if ((status = listItem.layout(blockArea)).isIncomplete()) {
    this.marker = i;
    blockArea.end();
    area.addChild(blockArea);
    area.increaseHeight(blockArea.getHeight());
    return status;
      }
  }

  blockArea.end();
  area.addChild(blockArea);
  area.increaseHeight(blockArea.getHeight());

  if (spaceAfter != 0) {
      area.addDisplaySpace(spaceAfter);
  }
View Full Code Here

TOP

Related Classes of org.apache.fop.layout.BlockArea

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.