You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Block.java 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.area;
  8. import java.util.ArrayList;
  9. import java.util.List;
  10. import java.awt.geom.Rectangle2D;
  11. // block areas hold either more block areas or line
  12. // areas can also be used as a block spacer
  13. // a block area may have children positioned by stacking
  14. // or by relative to the parent for floats, tables and lists
  15. // cacheable object
  16. // has id information
  17. public class Block extends Area {
  18. // normally stacked with other blocks
  19. public static final int STACK = 0;
  20. // placed relative to the parent area
  21. public static final int RELATIVE = 1;
  22. // placed relative to the page or viewport
  23. public static final int ABSOLUTE = 2;
  24. // this position is used for absolute position
  25. // or as an indent
  26. // this has the size in the block progression dimension
  27. Rectangle2D bounds = null;
  28. int stacking = TB;
  29. // list of marker fo objects that are associated with this area
  30. // if a retrieve marker resolves this area it will format the
  31. // available markers, markers are discarded once page complete
  32. private ArrayList markers = null;
  33. ArrayList children = null;
  34. boolean blocks = false;
  35. // a block with may contain the dominant styling info in
  36. // terms of most lines or blocks with info
  37. int positioning = STACK;
  38. // orientation if reference area
  39. int orientation = ORIENT_0;
  40. public void addBlock(Block block) {
  41. if (children == null) {
  42. children = new ArrayList();
  43. } else if (!blocks) {
  44. // error
  45. }
  46. blocks = true;
  47. children.add(block);
  48. }
  49. public void addLineArea(LineArea line) {
  50. if (children == null) {
  51. children = new ArrayList();
  52. } else if (blocks) {
  53. // error
  54. }
  55. children.add(line);
  56. }
  57. public boolean isChildrenBlocks() {
  58. return blocks;
  59. }
  60. public List getChildAreas() {
  61. return children;
  62. }
  63. public int getPositioning() {
  64. return positioning;
  65. }
  66. }