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.

ResourceEnvironmentGroup.java 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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.afp.modca;
  19. import java.io.IOException;
  20. import java.io.OutputStream;
  21. import java.util.List;
  22. import org.apache.fop.afp.Completable;
  23. /**
  24. * A Resource Environment Group contains a set of resources for a document
  25. * or for a group of pages in a document.
  26. */
  27. public class ResourceEnvironmentGroup extends AbstractEnvironmentGroup implements Completable {
  28. /** default name for the resource group */
  29. private static final String DEFAULT_NAME = "REG00001";
  30. /** the maps data resources contained in this resource environment group */
  31. private List/*<MapDataResource>*/ mapDataResources = null;
  32. /** the maps page overlays contained in this resource environment group */
  33. private List mapPageOverlays = null;
  34. /** the pre-process presentation objects contained in this resource environment group */
  35. private List/*<PreprocessPresentationObject>*/ preProcessPresentationObjects = null;
  36. /** the resource environment group state */
  37. private boolean complete = false;
  38. /**
  39. * Default constructor
  40. */
  41. public ResourceEnvironmentGroup() {
  42. this(DEFAULT_NAME);
  43. }
  44. private List/*<MapDataResource>*/ getMapDataResources() {
  45. if (mapDataResources == null) {
  46. this.mapDataResources = new java.util.ArrayList/*<MapDataResource>*/();
  47. }
  48. return this.mapDataResources;
  49. }
  50. private List getMapPageOverlays() {
  51. if (mapPageOverlays == null) {
  52. this.mapPageOverlays = new java.util.ArrayList();
  53. }
  54. return this.mapPageOverlays;
  55. }
  56. private List/*<PreprocessPresentationObject>*/ getPreprocessPresentationObjects() {
  57. if (preProcessPresentationObjects == null) {
  58. this.preProcessPresentationObjects
  59. = new java.util.ArrayList/*<PreprocessPresentationObject>*/();
  60. }
  61. return this.preProcessPresentationObjects;
  62. }
  63. /**
  64. * Constructor for the ResourceEnvironmentGroup, this takes a
  65. * name parameter which must be 8 characters long.
  66. * @param name the resource environment group name
  67. */
  68. public ResourceEnvironmentGroup(String name) {
  69. super(name);
  70. }
  71. // /**
  72. // * Adds an AFP object mapping reference to this resource environment group
  73. // * @param obj the object to add
  74. // */
  75. // public void addObject(AbstractStructuredAFPObject obj) {
  76. // getMapDataResources().add(new MapDataResource(obj));
  77. // createOverlay(obj.get);
  78. // getPreprocessPresentationObjects().add(new PreprocessPresentationObject(obj));
  79. // }
  80. /** {@inheritDoc} */
  81. protected void writeStart(OutputStream os) throws IOException {
  82. byte[] data = new byte[17];
  83. copySF(data, Type.BEGIN, Category.RESOURCE_ENVIROMENT_GROUP);
  84. os.write(data);
  85. }
  86. /** {@inheritDoc} */
  87. protected void writeEnd(OutputStream os) throws IOException {
  88. byte[] data = new byte[17];
  89. copySF(data, Type.END, Category.RESOURCE_ENVIROMENT_GROUP);
  90. os.write(data);
  91. }
  92. /** {@inheritDoc} */
  93. protected void writeContent(OutputStream os) throws IOException {
  94. writeObjects(mapDataResources, os);
  95. writeObjects(mapPageOverlays, os);
  96. writeObjects(preProcessPresentationObjects, os);
  97. }
  98. /** {@inheritDoc} */
  99. public void setComplete(boolean complete) {
  100. this.complete = complete;
  101. }
  102. /** {@inheritDoc} */
  103. public boolean isComplete() {
  104. return complete;
  105. }
  106. }