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.

RowGroupBuilder.java 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.fo.flow.table;
  19. import org.apache.fop.fo.ValidationException;
  20. /**
  21. * A class that creates groups of rows belonging to a same set of spans. The first row of
  22. * such a group has only cells which don't span over several rows, or whose spanning
  23. * starts on this row. Similarly, the last row has only non-row spanning cells or spans
  24. * which end on this row.
  25. */
  26. abstract class RowGroupBuilder {
  27. protected Table table;
  28. /**
  29. * Creates and initialises a new builder for the given table.
  30. *
  31. * @param t a table
  32. */
  33. protected RowGroupBuilder(Table t) {
  34. table = t;
  35. }
  36. /**
  37. * Adds a table-cell to the current row-group, creating {@link GridUnit}s accordingly.
  38. *
  39. * @param cell the cell to add
  40. */
  41. abstract void addTableCell(TableCell cell);
  42. /**
  43. * Receives notification of the start of an fo:table-row element.
  44. *
  45. * @param tableRow the row being started
  46. */
  47. abstract void startTableRow(TableRow tableRow);
  48. /**
  49. * Receives notification of the end of the current row. If the current row finishes
  50. * the row group, the {@link TablePart#addRowGroup(List)} method of the parent table
  51. * part will be called.
  52. */
  53. abstract void endTableRow();
  54. /**
  55. * Receives notification of the end of the current row, when the source contains no
  56. * fo:table-row element. If the current row finishes the row group, the
  57. * {@link TablePart#addRowGroup(List)} method of the given table part will be called.
  58. *
  59. * <p>If the source does contain explicit fo:table-row elements, then the
  60. * {@link #endTableRow()} method will be called instead.</p>
  61. *
  62. * @param part the part containing the current row
  63. */
  64. abstract void endRow(TablePart part);
  65. /**
  66. * Receives notification of the start of a table-header/footer/body.
  67. *
  68. * @param part the part being started
  69. */
  70. abstract void startTablePart(TablePart part);
  71. /**
  72. * Receives notification of the end of a table-header/footer/body. The current
  73. * row-group is checked for emptiness. This row group builder is reset for handling
  74. * further possible table parts.
  75. *
  76. * @throws ValidationException if a row-spanning cell overflows the given table part
  77. */
  78. abstract void endTablePart() throws ValidationException;
  79. /**
  80. * Receives notification of the end of the table.
  81. *
  82. * @throws ValidationException if a row-spanning cell overflows one of the table's parts
  83. */
  84. abstract void endTable() throws ValidationException;
  85. }