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.

ElementListCollector.java 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.layoutengine;
  19. import java.util.List;
  20. import org.apache.fop.layoutmgr.ElementListObserver.Observer;
  21. /**
  22. * This class collects element list generated during a FOP processing run. These lists are later
  23. * used to perform automated checks.
  24. */
  25. public class ElementListCollector implements Observer {
  26. private List elementLists = new java.util.ArrayList();
  27. /**
  28. * Resets the collector.
  29. */
  30. public void reset() {
  31. elementLists.clear();
  32. }
  33. /**
  34. * @return the list of ElementList instances.
  35. */
  36. public List getElementLists() {
  37. return this.elementLists;
  38. }
  39. /** @see org.apache.fop.layoutmgr.ElementListObserver.Observer */
  40. public void observe(List elementList, String category, String id) {
  41. elementLists.add(new ElementList(elementList, category, id));
  42. }
  43. /**
  44. * Data object representing an element list along with additional information.
  45. */
  46. public static class ElementList {
  47. private List elementList;
  48. private String category;
  49. private String id;
  50. /**
  51. * Creates a new ElementList instance
  52. * @param elementList the element list
  53. * @param category the category for the element list
  54. * @param id an optional ID
  55. */
  56. public ElementList(List elementList, String category, String id) {
  57. this.elementList = elementList;
  58. this.category = category;
  59. this.id = id;
  60. }
  61. /** @return the element list */
  62. public List getElementList() {
  63. return elementList;
  64. }
  65. /** @return the category */
  66. public String getCategory() {
  67. return category;
  68. }
  69. /** @return the ID, may be null */
  70. public String getID() {
  71. return id;
  72. }
  73. }
  74. }