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.

BlockParent.java 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001-2002 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.io.Serializable;
  9. import java.util.ArrayList;
  10. import java.util.List;
  11. /**
  12. * A BlockParent holds block-level areas.
  13. */
  14. public class BlockParent extends Area implements Serializable {
  15. // this position is used for absolute position
  16. // or as an indent
  17. // this has the size in the block progression dimension
  18. /**
  19. * The x offset position of this block parent.
  20. * Used for relative and absolute positioning.
  21. */
  22. protected int xOffset = 0;
  23. /**
  24. * The y offset position of this block parent.
  25. * Used for relative and absolute positioning.
  26. */
  27. protected int yOffset = 0;
  28. /**
  29. * The width of this block parent.
  30. */
  31. protected int width = 0;
  32. /**
  33. * The height of this block parent.
  34. */
  35. protected int height = 0;
  36. /**
  37. * The children of this block parent area.
  38. */
  39. protected ArrayList children = null;
  40. // orientation if reference area
  41. private int orientation = ORIENT_0;
  42. /**
  43. * Add the block area to this block parent.
  44. *
  45. * @param block the child block area to add
  46. */
  47. public void addBlock(Block block) {
  48. if (children == null) {
  49. children = new ArrayList();
  50. }
  51. children.add(block);
  52. }
  53. /**
  54. * Get the list of child areas for this block area.
  55. *
  56. * @return the list of child areas
  57. */
  58. public List getChildAreas() {
  59. return children;
  60. }
  61. /**
  62. * Set the X offset of this block parent area.
  63. *
  64. * @param off the x offset of the block parent area
  65. */
  66. public void setXOffset(int off) {
  67. xOffset = off;
  68. }
  69. /**
  70. * Set the Y offset of this block parent area.
  71. *
  72. * @param off the y offset of the block parent area
  73. */
  74. public void setYOffset(int off) {
  75. yOffset = off;
  76. }
  77. /**
  78. * Set the width of this block parent area.
  79. *
  80. * @param w the width of the area
  81. */
  82. public void setWidth(int w) {
  83. width = w;
  84. }
  85. /**
  86. * Set the height of this block parent area.
  87. *
  88. * @param h the height of the block parent area
  89. */
  90. public void setHeight(int h) {
  91. height = h;
  92. }
  93. /**
  94. * Get the X offset of this block parent area.
  95. *
  96. * @return the x offset of the block parent area
  97. */
  98. public int getXOffset() {
  99. return xOffset;
  100. }
  101. /**
  102. * Get the Y offset of this block parent area.
  103. *
  104. * @return the y offset of the block parent area
  105. */
  106. public int getYOffset() {
  107. return yOffset;
  108. }
  109. /**
  110. * Get the width of this block parent area.
  111. *
  112. * @return the width of the area
  113. */
  114. public int getWidth() {
  115. return width;
  116. }
  117. /**
  118. * Get the height of this block parent area.
  119. *
  120. * @return the height of the block parent area
  121. */
  122. public int getHeight() {
  123. return height;
  124. }
  125. }