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