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.

StaticContent.java 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright 1999-2005 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.fo.pagination;
  18. // XML
  19. import org.xml.sax.Locator;
  20. import org.apache.fop.apps.FOPException;
  21. import org.apache.fop.fo.FONode;
  22. import org.apache.fop.fo.ValidationException;
  23. /**
  24. * Class modelling the fo:static-content object.
  25. */
  26. public class StaticContent extends Flow {
  27. /**
  28. * @param parent FONode that is the parent of this object
  29. */
  30. public StaticContent(FONode parent) {
  31. super(parent);
  32. }
  33. /**
  34. * @see org.apache.fop.fo.FONode#startOfNode()
  35. */
  36. protected void startOfNode() throws FOPException {
  37. if (getFlowName() == null || getFlowName().equals("")) {
  38. throw new ValidationException("A 'flow-name' is required for "
  39. + getName() + ".", locator);
  40. }
  41. getFOEventHandler().startFlow(this);
  42. }
  43. /**
  44. * Make sure content model satisfied, if so then tell the
  45. * FOEventHandler that we are at the end of the flow.
  46. * @see org.apache.fop.fo.FONode#endOfNode
  47. */
  48. protected void endOfNode() throws FOPException {
  49. if (childNodes == null && getUserAgent().validateStrictly()) {
  50. missingChildElementError("(%block;)+");
  51. }
  52. getFOEventHandler().endFlow(this);
  53. }
  54. /**
  55. * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
  56. * XSL Content Model: (%block;)+
  57. */
  58. protected void validateChildNode(Locator loc, String nsURI, String localName)
  59. throws ValidationException {
  60. if (!isBlockItem(nsURI, localName)) {
  61. invalidChildError(loc, nsURI, localName);
  62. }
  63. }
  64. /** @see org.apache.fop.fo.FObj#getLocalName() */
  65. public String getLocalName() {
  66. return "static-content";
  67. }
  68. /** @see org.apache.fop.fo.FObj#getNameId() */
  69. public int getNameId() {
  70. return FO_STATIC_CONTENT;
  71. }
  72. }