Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

PageGroup.java 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 org.apache.fop.afp.Factory;
  22. /**
  23. * A page group is used in the data stream to define a named, logical grouping
  24. * of sequential pages. Page groups are delimited by begin-end structured fields
  25. * that carry the name of the page group. Page groups are defined so that the
  26. * pages that comprise the group can be referenced or processed as a single
  27. * entity. Page groups are often processed in stand-alone fashion; that is, they
  28. * are indexed, retrieved, and presented outside the context of the containing
  29. * document.
  30. */
  31. public class PageGroup extends AbstractResourceEnvironmentGroupContainer {
  32. /**
  33. * Constructor for the PageGroup.
  34. *
  35. * @param factory the resource manager
  36. * @param name the name of the page group
  37. */
  38. public PageGroup(Factory factory, String name) {
  39. super(factory, name);
  40. }
  41. /**
  42. * Creates a TagLogicalElement on the page.
  43. *
  44. * @param state
  45. * the state of the TLE
  46. */
  47. public void createTagLogicalElement(TagLogicalElement.State state) {
  48. TagLogicalElement tle = factory.createTagLogicalElement(state);
  49. if (!getTagLogicalElements().contains(tle)) {
  50. getTagLogicalElements().add(tle);
  51. }
  52. }
  53. /**
  54. * Method to mark the end of the page group.
  55. */
  56. public void endPageGroup() {
  57. complete = true;
  58. }
  59. /** {@inheritDoc} */
  60. protected void writeStart(OutputStream os) throws IOException {
  61. byte[] data = new byte[17];
  62. copySF(data, Type.BEGIN, Category.PAGE_GROUP);
  63. os.write(data);
  64. }
  65. /** {@inheritDoc} */
  66. protected void writeEnd(OutputStream os) throws IOException {
  67. byte[] data = new byte[17];
  68. copySF(data, Type.END, Category.PAGE_GROUP);
  69. os.write(data);
  70. }
  71. /** {@inheritDoc} */
  72. public String toString() {
  73. return this.getName();
  74. }
  75. }