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.

ListElement.java 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.layoutmgr;
  19. /**
  20. * This class is the base class for all kinds of elements that are added to element lists. There
  21. * are basically two kinds of list elements: Knuth elements and unresolved elements like spaces,
  22. * border and padding elements which are converted to Knuth elements prior to the breaking
  23. * process.
  24. */
  25. public abstract class ListElement {
  26. private Position position;
  27. /**
  28. * Main constructor
  29. * @param position the Position instance needed by the addAreas stage of the LMs.
  30. */
  31. public ListElement(Position position) {
  32. this.position = position;
  33. }
  34. /**
  35. * @return the Position instance for this element.
  36. */
  37. public Position getPosition() {
  38. return this.position;
  39. }
  40. /**
  41. * Change the Position stored in this element.
  42. * @param position the Position instance
  43. */
  44. public void setPosition(Position position) {
  45. this.position = position;
  46. }
  47. /**
  48. * @return the LayoutManager responsible for this element.
  49. */
  50. public LayoutManager getLayoutManager() {
  51. if (position != null) {
  52. return position.getLM();
  53. } else {
  54. return null;
  55. }
  56. }
  57. /** @return true if this element is a KnuthBox. */
  58. public boolean isBox() {
  59. return false;
  60. }
  61. /** @return true if this element is a KnuthGlue. */
  62. public boolean isGlue() {
  63. return false;
  64. }
  65. /** @return true if this element is a KnuthPenalty. */
  66. public boolean isPenalty() {
  67. return false;
  68. }
  69. /** @return true if the element is a penalty and represents a forced break. */
  70. public boolean isForcedBreak() {
  71. return false;
  72. }
  73. /** @return true if the element is an unresolved element such as a space or a border. */
  74. public boolean isUnresolvedElement() {
  75. return true;
  76. }
  77. }