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.

FormattingResults.java 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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.apps;
  19. import java.util.List;
  20. import org.apache.fop.fo.pagination.AbstractPageSequence;
  21. /**
  22. * Class for reporting back formatting results to the calling application.
  23. */
  24. public class FormattingResults {
  25. private int pageCount;
  26. private List pageSequences;
  27. /**
  28. * Constructor for the FormattingResults object
  29. */
  30. public FormattingResults() {
  31. }
  32. /**
  33. * Gets the number of pages rendered
  34. *
  35. * @return The number of pages overall
  36. */
  37. public int getPageCount() {
  38. return this.pageCount;
  39. }
  40. /**
  41. * Gets the results for the individual page-sequences.
  42. *
  43. * @return A List with PageSequenceResults objects
  44. */
  45. public List getPageSequences() {
  46. return this.pageSequences;
  47. }
  48. /**
  49. * Resets this object
  50. */
  51. public void reset() {
  52. this.pageCount = 0;
  53. if (this.pageSequences != null) {
  54. this.pageSequences.clear();
  55. }
  56. }
  57. /**
  58. * Reports the result of one page sequence rendering
  59. * back into this object.
  60. *
  61. * @param pageSequence the page sequence which just completed rendering
  62. * @param pageCount the number of pages rendered for that PageSequence
  63. */
  64. public void haveFormattedPageSequence(AbstractPageSequence pageSequence, int pageCount) {
  65. this.pageCount += pageCount;
  66. if (this.pageSequences == null) {
  67. this.pageSequences = new java.util.ArrayList();
  68. }
  69. this.pageSequences.add(
  70. new PageSequenceResults(pageSequence.getId(),
  71. pageCount));
  72. }
  73. }