1 17 18 19 20 package org.apache.fop.layoutmgr; 21 22 import java.util.List ; 23 24 25 28 public class BlockKnuthSequence extends KnuthSequence { 29 30 private boolean isClosed = false; 31 32 35 public BlockKnuthSequence() { 36 super(); 37 } 38 39 43 public BlockKnuthSequence(List list) { 44 super(list); 45 } 46 47 50 public boolean isInlineSequence() { 51 return false; 52 } 53 54 57 public boolean canAppendSequence(KnuthSequence sequence) { 58 return !sequence.isInlineSequence() && !isClosed; 59 } 60 61 64 public boolean appendSequence(KnuthSequence sequence) { 65 return false; 67 } 68 69 72 public boolean appendSequence(KnuthSequence sequence, boolean keepTogether, 73 BreakElement breakElement) { 74 if (!canAppendSequence(sequence)) { 75 return false; 76 } 77 if (keepTogether) { 78 breakElement.setPenaltyValue(KnuthElement.INFINITE); 79 add(breakElement); 80 } else if (!((ListElement) getLast()).isGlue()) { 81 breakElement.setPenaltyValue(0); 82 add(breakElement); 83 } 84 addAll(sequence); 85 return true; 86 } 87 88 91 public KnuthSequence endSequence() { 92 isClosed = true; 93 return this; 94 } 95 96 } 97 | Popular Tags |