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.

AbstractAction.java 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.render.intermediate.extensions;
  19. import org.apache.xmlgraphics.util.XMLizable;
  20. /**
  21. * Abstract base class for document actions, like "go-to" actions with absolute page coordinates.
  22. */
  23. public abstract class AbstractAction implements XMLizable {
  24. private String id;
  25. private String structurePointer;
  26. /**
  27. * Sets an ID to make the action referencable.
  28. * @param id the ID
  29. */
  30. public void setId(String id) {
  31. this.id = id;
  32. }
  33. /**
  34. * Returns an optional ID for this action.
  35. * @return the ID or null
  36. */
  37. public String getId() {
  38. return this.id;
  39. }
  40. /**
  41. * Sets the structure element corresponding to this action.
  42. * @param structurePointer a reference to the structure element
  43. */
  44. public void setStructurePointer(String structurePointer) {
  45. this.structurePointer = structurePointer;
  46. }
  47. /**
  48. * Returns the structure element corresponding to this action.
  49. * @return the reference to the structure element
  50. */
  51. public String getStructurePointer() {
  52. return structurePointer;
  53. }
  54. /**
  55. * Indicates whether the action has an ID and is therefore referencable.
  56. * @return true if the action has an ID
  57. */
  58. public boolean hasId() {
  59. return this.id != null;
  60. }
  61. /**
  62. * Indicates whether two action are equal. Note: this is not the same as
  63. * {@link Object#equals(Object)}!
  64. * @param other the other action to compare to
  65. * @return true if the actions are equal
  66. */
  67. public abstract boolean isSame(AbstractAction other);
  68. /**
  69. * Indicates whether the action is complete, i.e has all the required information to be
  70. * rendered in the target format.
  71. * @return true if the action is complete
  72. */
  73. public boolean isComplete() {
  74. return true;
  75. }
  76. /**
  77. * Returns a string that is used to prefix a generated ID to make it unique.
  78. * @return the prefix string
  79. */
  80. public String getIdPrefix() {
  81. return null;
  82. }
  83. }