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.

FONode.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.fo;
  8. // FOP
  9. import org.apache.fop.apps.FOPException;
  10. import org.apache.fop.apps.StructureHandler;
  11. import org.apache.fop.util.CharUtilities;
  12. // Avalon
  13. import org.apache.avalon.framework.logger.Logger;
  14. import org.xml.sax.Attributes;
  15. import java.util.ListIterator;
  16. import java.util.NoSuchElementException;
  17. /**
  18. * base class for nodes in the XML tree
  19. *
  20. */
  21. abstract public class FONode {
  22. protected FOUserAgent userAgent;
  23. protected FONode parent;
  24. protected String name;
  25. protected FONode(FONode parent) {
  26. this.parent = parent;
  27. }
  28. public void setName(String str) {
  29. name = str;
  30. }
  31. public Logger getLogger() {
  32. return userAgent.getLogger();
  33. }
  34. public void setUserAgent(FOUserAgent ua) {
  35. userAgent = ua;
  36. }
  37. public void setStructHandler(StructureHandler st) {
  38. }
  39. public void handleAttrs(Attributes attlist) throws FOPException {
  40. }
  41. /**
  42. * returns the name of the object
  43. * @return the name of this object
  44. */
  45. public String getName() {
  46. return this.name;
  47. }
  48. /**
  49. * adds characters (does nothing here)
  50. * @param data text
  51. * @param start start position
  52. * @param length length of the text
  53. */
  54. protected void addCharacters(char data[], int start, int length) {
  55. // ignore
  56. }
  57. /**
  58. *
  59. */
  60. protected void start() {
  61. // do nothing by default
  62. }
  63. /**
  64. *
  65. */
  66. protected void end() {
  67. // do nothing by default
  68. }
  69. protected void addChild(FONode child) {
  70. }
  71. public FONode getParent() {
  72. return this.parent;
  73. }
  74. /**
  75. * Return an iterator over all the children of this FObj.
  76. * @return A ListIterator.
  77. */
  78. public ListIterator getChildren() {
  79. return null;
  80. }
  81. /**
  82. * Return an iterator over the object's children starting
  83. * at the pased node.
  84. * @param childNode First node in the iterator
  85. * @return A ListIterator or null if childNode isn't a child of
  86. * this FObj.
  87. */
  88. public ListIterator getChildren(FONode childNode) {
  89. return null;
  90. }
  91. public CharIterator charIterator() {
  92. return new OneCharIterator(CharUtilities.CODE_EOT);
  93. }
  94. }