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 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 pre-process presentation objects contained in this resource environment group */
  31. private List/*<PreprocessPresentationObject>*/ preProcessPresentationObjects;
  32. /** the resource environment group state */
  33. private boolean complete;
  34. /**
  35. * Default constructor
  36. */
  37. public ResourceEnvironmentGroup() {
  38. this(DEFAULT_NAME);
  39. }
  40. private List/*<PreprocessPresentationObject>*/ getPreprocessPresentationObjects() {
  41. if (preProcessPresentationObjects == null) {
  42. this.preProcessPresentationObjects
  43. = new java.util.ArrayList/*<PreprocessPresentationObject>*/();
  44. }
  45. return this.preProcessPresentationObjects;
  46. }
  47. /**
  48. * Constructor for the ResourceEnvironmentGroup, this takes a
  49. * name parameter which must be 8 characters long.
  50. * @param name the resource environment group name
  51. */
  52. public ResourceEnvironmentGroup(String name) {
  53. super(name);
  54. }
  55. // /**
  56. // * Adds an AFP object mapping reference to this resource environment group
  57. // * @param obj the object to add
  58. // */
  59. // public void addObject(AbstractStructuredAFPObject obj) {
  60. // getMapDataResources().add(new MapDataResource(obj));
  61. // createOverlay(obj.get);
  62. // getPreprocessPresentationObjects().add(new PreprocessPresentationObject(obj));
  63. // }
  64. /** {@inheritDoc} */
  65. protected void writeStart(OutputStream os) throws IOException {
  66. byte[] data = new byte[17];
  67. copySF(data, Type.BEGIN, Category.RESOURCE_ENVIROMENT_GROUP);
  68. os.write(data);
  69. }
  70. /** {@inheritDoc} */
  71. protected void writeEnd(OutputStream os) throws IOException {
  72. byte[] data = new byte[17];
  73. copySF(data, Type.END, Category.RESOURCE_ENVIROMENT_GROUP);
  74. os.write(data);
  75. }
  76. /** {@inheritDoc} */
  77. protected void writeContent(OutputStream os) throws IOException {
  78. writeObjects(mapDataResources, os);
  79. writeObjects(mapPageOverlays, os);
  80. writeObjects(preProcessPresentationObjects, os);
  81. }
  82. /** {@inheritDoc} */
  83. public void setComplete(boolean complete) {
  84. this.complete = complete;
  85. }
  86. /** {@inheritDoc} */
  87. public boolean isComplete() {
  88. return complete;
  89. }
  90. }