Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

FormattingResults.java 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright 1999-2003,2005 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.apps;
  18. import java.util.List;
  19. import org.apache.fop.fo.pagination.PageSequence;
  20. /**
  21. * Class for reporting back formatting results to the calling application.
  22. */
  23. public class FormattingResults {
  24. private int pageCount = 0;
  25. private List pageSequences = null;
  26. /**
  27. * Constructor for the FormattingResults object
  28. */
  29. public FormattingResults() {
  30. }
  31. /**
  32. * Gets the number of pages rendered
  33. *
  34. * @return The number of pages overall
  35. */
  36. public int getPageCount() {
  37. return this.pageCount;
  38. }
  39. /**
  40. * Gets the results for the individual page-sequences.
  41. *
  42. * @return A List with PageSequenceResults objects
  43. */
  44. public List getPageSequences() {
  45. return this.pageSequences;
  46. }
  47. /**
  48. * Resets this object
  49. */
  50. public void reset() {
  51. this.pageCount = 0;
  52. if (this.pageSequences != null) {
  53. this.pageSequences.clear();
  54. }
  55. }
  56. /**
  57. * Reports the result of one page sequence rendering
  58. * back into this object.
  59. *
  60. * @param pageSequence the PageSequence which just completed rendering
  61. * @param pageCount the number of pages rendered for that PageSequence
  62. */
  63. public void haveFormattedPageSequence(PageSequence pageSequence, int pageCount) {
  64. this.pageCount += pageCount;
  65. if (this.pageSequences == null) {
  66. this.pageSequences = new java.util.ArrayList();
  67. }
  68. this.pageSequences.add(
  69. new PageSequenceResults(pageSequence.getId(),
  70. pageCount));
  71. }
  72. }