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.

RetrieveTableMarker.java 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.fo.flow;
  19. import org.xml.sax.Attributes;
  20. import org.xml.sax.Locator;
  21. import org.apache.fop.apps.FOPException;
  22. import org.apache.fop.fo.FONode;
  23. import org.apache.fop.fo.PropertyList;
  24. /**
  25. * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_retrieve-table-marker">
  26. * <code>fo:retrieve-table-marker</code></a> formatting object.
  27. */
  28. public class RetrieveTableMarker extends AbstractRetrieveMarker {
  29. /**
  30. * Create a new RetrieveTableMarker instance that is
  31. * a child of the given {@link FONode}.
  32. *
  33. * @param parent the parent {@link FONode}
  34. */
  35. public RetrieveTableMarker(FONode parent) {
  36. super(parent);
  37. }
  38. /**
  39. * {@inheritDoc}
  40. * <i>NOTE: An <code>fo:retrieve-table-marker</code> is only permitted as a descendant
  41. * of an <code>fo:table-header</code> or an <code>fo:table-footer</code>.</i>
  42. */
  43. public void processNode
  44. (String elementName, Locator locator, Attributes attlist, PropertyList pList)
  45. throws FOPException {
  46. if (findAncestor(FO_TABLE_HEADER) < 0
  47. && findAncestor(FO_TABLE_FOOTER) < 0) {
  48. invalidChildError(locator, getParent().getName(), FO_URI, getName(),
  49. "rule.retrieveTableMarkerDescendantOfHeaderOrFooter");
  50. } else {
  51. super.processNode(elementName, locator, attlist, pList);
  52. }
  53. }
  54. /** {@inheritDoc} */
  55. public void bind(PropertyList pList) throws FOPException {
  56. super.bind(pList);
  57. setPosition(pList.get(PR_RETRIEVE_POSITION_WITHIN_TABLE).getEnum());
  58. setPositionLabel((String) pList.get(PR_RETRIEVE_POSITION_WITHIN_TABLE).getObject());
  59. setBoundary(pList.get(PR_RETRIEVE_BOUNDARY_WITHIN_TABLE).getEnum());
  60. setBoundaryLabel((String) pList.get(PR_RETRIEVE_BOUNDARY_WITHIN_TABLE).getObject());
  61. }
  62. /**
  63. * Return the value for the <code>retrieve-position-within-table</code>
  64. * property
  65. * @return the value for retrieve-position-within-table; one of
  66. * {@link org.apache.fop.fo.Constants#EN_FIRST_STARTING},
  67. * {@link org.apache.fop.fo.Constants#EN_FIC},
  68. * {@link org.apache.fop.fo.Constants#EN_LAST_STARTING},
  69. * {@link org.apache.fop.fo.Constants#EN_LAST_ENDING}.
  70. */
  71. public int getRetrievePositionWithinTable() {
  72. return getPosition();
  73. }
  74. /**
  75. * Return the value for the <code>retrieve-boundary-within-table</code>
  76. * property
  77. * @return the value for retrieve-boundary-within-table; one of
  78. * {@link org.apache.fop.fo.Constants#EN_TABLE},
  79. * {@link org.apache.fop.fo.Constants#EN_TABLE_FRAGMENT},
  80. * {@link org.apache.fop.fo.Constants#EN_PAGE}.
  81. */
  82. public int getRetrieveBoundaryWithinTable() {
  83. return getBoundary();
  84. }
  85. /** {@inheritDoc} */
  86. public String getLocalName() {
  87. return "retrieve-table-marker";
  88. }
  89. /**
  90. * {@inheritDoc}
  91. * @return {@link org.apache.fop.fo.Constants#FO_RETRIEVE_TABLE_MARKER}
  92. */
  93. public int getNameId() {
  94. return FO_RETRIEVE_TABLE_MARKER;
  95. }
  96. /** {@inheritDoc} */
  97. public void clearChildNodes() {
  98. super.clearChildNodes();
  99. this.currentTextNode = null;
  100. this.lastFOTextProcessed = null;
  101. }
  102. }