Package org.apache.fop.layout

Examples of org.apache.fop.layout.BlockArea


        if (spaceBefore != 0) {
            area.addDisplaySpace(spaceBefore);
        }

        this.blockArea =
            new BlockArea(propMgr.getFontState(area.getFontInfo()), area.getAllocationWidth(),
                          area.spaceLeft(), 0, 0,
                          0, align, alignLast, lineHeight);
        blockArea.setPage(area.getPage());
        blockArea.start();
View Full Code Here


        super(parent, propertyList);
        this.name = "fo:leader";
    }

    public Status layout(Area area) throws FOPException {
        BlockArea blockArea;
        //restriction in this version
        if (!(area instanceof BlockArea)) {
            MessageHandler.errorln("WARNING: in this version of Fop fo:leader must be a direct child of fo:block ");
            return new Status(Status.OK);
        } else {
            blockArea = (BlockArea) area;
        }

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

        //fo:leader specific properties
        //determines the pattern of leader; allowed values: space, rule,dots, use-content
        int leaderPattern = this.properties.get("leader-pattern").getEnum();
        //length of the leader
        int leaderLengthOptimum = this.properties.get(
                                    "leader-length.optimum").getLength().mvalue();
        int leaderLengthMinimum = this.properties.get(
                                    "leader-length.minimum").getLength().mvalue();
        int leaderLengthMaximum = this.properties.get(
                                    "leader-length.maximum").getLength().mvalue();
        //the following properties only apply for leader-pattern = "rule"
        int ruleThickness = this.properties.get(
                              "rule-thickness").getLength().mvalue();
        int ruleStyle = this.properties.get("rule-style").getEnum();
        // if leaderPatternWidth = 0 = default = use-font-metric
        int leaderPatternWidth = this.properties.get(
                                   "leader-pattern-width").getLength().mvalue();
        int leaderAlignment =
          this.properties.get("leader-alignment").getEnum();

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

        //adds leader to blockarea, there the leaderArea is generated
        int succeeded = addLeader(blockArea, propMgr.getFontState(area.getFontInfo()), red, green, blue,
                                            leaderPattern, leaderLengthMinimum,
                                            leaderLengthOptimum, leaderLengthMaximum,
View Full Code Here

      area.addDisplaySpace(spaceBefore);
  }

  startIndent += this.bodyIndent;

  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();
  if (numChildren != 2) {
      throw new FOPException("list-item must have exactly two children");
  }
  ListItemLabel label = (ListItemLabel) children.elementAt(0);
  ListItemBody body = (ListItemBody) children.elementAt(1);

  label.setDistanceBetweenStarts(this.distanceBetweenStarts);
  label.setLabelSeparation(this.labelSeparation);
  label.setBodyIndent(this.bodyIndent);

  body.setDistanceBetweenStarts(this.distanceBetweenStarts);
  body.setBodyIndent(this.bodyIndent);

  /* this doesn't actually do anything */
  body.setLabelSeparation(this.labelSeparation);

  Status status;

  // what follows doesn't yet take into account whether the
  // body failed completely or only got some text in

  if (this.marker == 0) {
      status = label.layout(blockArea);
      if (status.isIncomplete()) {
    return status;
      }
  }

  status = body.layout(blockArea);
  if (status.isIncomplete()) {
      blockArea.end();
      area.addChild(blockArea);
      area.increaseHeight(blockArea.getHeight());
      this.marker = 1;
      return status;
  }

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

  if (spaceAfter != 0) {
      area.addDisplaySpace(spaceAfter);
  }

View Full Code Here

    endIndent += area.getAllocationWidth() - forcedWidth -
        forcedStartOffset;
      }
  }

  BlockArea blockArea =
      new BlockArea(fs, area.getAllocationWidth(),
        area.spaceLeft(), startIndent, endIndent, 0,
        align, alignLast, lineHeight);
  blockArea.setPage(area.getPage());
  blockArea.setBackgroundColor(backgroundColor);
  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

        if (this.areaCurrent == null) {
            return new Status(Status.OK);
        }

        if (area instanceof BlockArea) {
            BlockArea ba = (BlockArea) area;
            LineArea la = ba.getCurrentLineArea();
            if (la == null) {
                return new Status(Status.AREA_FULL_NONE);
            }
            la.addPending();
            if (areaCurrent.getEffectiveWidth() > la.getRemainingWidth()) {
                la = ba.createNextLineArea();
                if (la == null) {
                    return new Status(Status.AREA_FULL_NONE);
                }
            }
            la.addInlineArea(areaCurrent);
View Full Code Here

             // 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()) {
    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

        super(parent, propertyList);
        this.name = "fo:leader";
    }

    public Status layout(Area area) throws FOPException {
        BlockArea blockArea;
        //restriction in this version
        if (!(area instanceof BlockArea)) {
            MessageHandler.errorln("WARNING: in this version of Fop fo:leader must be a direct child of fo:block ");
            return new Status(Status.OK);
        } else {
            blockArea = (BlockArea) area;
        }

        //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();
        //wrapping it up into Fontstate
        FontState fontstate = new FontState(area.getFontInfo(), fontFamily,
                                            fontStyle, fontWeight, fontSize);
        //color properties
        ColorType c = this.properties.get("color").getColorType();
        float red = c.red();
        float green = c.green();
        float blue = c.blue();

        //fo:leader specific properties
        //determines the pattern of leader; allowed values: space, rule,dots, use-content
        int leaderPattern = this.properties.get("leader-pattern").getEnum();
        //length of the leader
        int leaderLengthOptimum = this.properties.get(
                                    "leader-length.optimum").getLength().mvalue();
        int leaderLengthMinimum = this.properties.get(
                                    "leader-length.minimum").getLength().mvalue();
        //brute force method to set default, because default values cannot be set
        //in the properties classes for all subtypes
        if (leaderLengthMinimum == 12000) {
            leaderLengthMinimum = 0;
        }
        int leaderLengthMaximum = this.properties.get(
                                    "leader-length.maximum").getLength().mvalue();
        //here too
        if (leaderLengthMaximum == 12000) {
            leaderLengthMaximum = 24000;
        }
        //the following properties only apply for leader-pattern = "rule"
        int ruleThickness = this.properties.get(
                              "rule-thickness").getLength().mvalue();
        int ruleStyle = this.properties.get("rule-style").getEnum();
        // if leaderPatternWidth = 0 = default = use-font-metric
        int leaderPatternWidth = this.properties.get(
                                   "leader-pattern-width").getLength().mvalue();
        int leaderAlignment =
          this.properties.get("leader-alignment").getEnum();

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

        //adds leader to blockarea, there the leaderArea is generated
        int succeeded = blockArea.addLeader(fontstate, red, green, blue,
                                            leaderPattern, leaderLengthMinimum,
                                            leaderLengthOptimum, leaderLengthMaximum,
                                            ruleThickness, ruleStyle, leaderPatternWidth,
                                            leaderAlignment);
        if (succeeded == 1) {
View Full Code Here

      area.addDisplaySpace(spaceBefore);
  }

  startIndent += this.bodyIndent;

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

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

  int numChildren = this.children.size();
  if (numChildren != 2) {
      throw new FOPException("list-item must have exactly two children");
  }
  ListItemLabel label = (ListItemLabel) children.elementAt(0);
  ListItemBody body = (ListItemBody) children.elementAt(1);

  label.setDistanceBetweenStarts(this.distanceBetweenStarts);
  label.setLabelSeparation(this.labelSeparation);
  label.setBodyIndent(this.bodyIndent);

  body.setDistanceBetweenStarts(this.distanceBetweenStarts);
  body.setBodyIndent(this.bodyIndent);

  /* this doesn't actually do anything */
  body.setLabelSeparation(this.labelSeparation);

  Status status;

  // what follows doesn't yet take into account whether the
  // body failed completely or only got some text in

  if (this.marker == 0) {
            // configure id
            area.getIDReferences().configureID(id,area);

      status = label.layout(blockArea);
      if (status.isIncomplete()) {
    return status;
      }
  }

  status = body.layout(blockArea);
  if (status.isIncomplete()) {
      blockArea.end();
      area.addChild(blockArea);
      area.increaseHeight(blockArea.getHeight());
            area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
      this.marker = 1;
      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

        super(parent, propertyList);
        this.name = "fo:leader";
    }

    public Status layout(Area area) throws FOPException {
        BlockArea blockArea;
        //restriction in this version
        if (!(area instanceof BlockArea)) {
            MessageHandler.errorln("WARNING: in this version of Fop fo:leader must be a direct child of fo:block ");
            return new Status(Status.OK);
        } else {
            blockArea = (BlockArea) area;
        }

        //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();

        //fo:leader specific properties
        //determines the pattern of leader; allowed values: space, rule,dots, use-content
        int leaderPattern = this.properties.get("leader-pattern").getEnum();
        //length of the leader
        int leaderLengthOptimum = this.properties.get(
                                    "leader-length.optimum").getLength().mvalue();
        int leaderLengthMinimum = this.properties.get(
                                    "leader-length.minimum").getLength().mvalue();
        int leaderLengthMaximum = this.properties.get(
                                    "leader-length.maximum").getLength().mvalue();
        //the following properties only apply for leader-pattern = "rule"
        int ruleThickness = this.properties.get(
                              "rule-thickness").getLength().mvalue();
        int ruleStyle = this.properties.get("rule-style").getEnum();
        // if leaderPatternWidth = 0 = default = use-font-metric
        int leaderPatternWidth = this.properties.get(
                                   "leader-pattern-width").getLength().mvalue();
        int leaderAlignment =
          this.properties.get("leader-alignment").getEnum();

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

        //adds leader to blockarea, there the leaderArea is generated
        int succeeded = addLeader(blockArea, fontstate, red, green, blue,
                                            leaderPattern, leaderLengthMinimum,
                                            leaderLengthOptimum, leaderLengthMaximum,
View Full Code Here

    return new Status(Status.FORCE_PAGE_BREAK_EVEN);
    }
  }

    if (area instanceof BlockArea) {
            BlockArea ba = (BlockArea)area;
            LineArea la = ba.getCurrentLineArea();
            la.addPending();
            if(areaCurrent.getEffectiveWidth() > la.getRemainingWidth()) {
                la = ba.createNextLineArea();
                if(la == null) {
                    return new Status(Status.AREA_FULL_NONE);
                }
            }
            la.addInlineArea(areaCurrent);
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.