1 17 18 19 20 package org.apache.fop.fo.flow; 21 22 import org.xml.sax.Locator ; 23 24 import org.apache.fop.apps.FOPException; 25 import org.apache.fop.fo.FONode; 26 import org.apache.fop.fo.FObj; 27 import org.apache.fop.fo.PropertyList; 28 import org.apache.fop.fo.ValidationException; 29 import org.apache.fop.fo.properties.CommonAccessibility; 30 import org.apache.fop.fo.properties.KeepProperty; 31 32 35 public abstract class AbstractListItemPart extends FObj { 36 private String id; 38 private KeepProperty keepTogether; 39 43 44 private boolean blockItemFound = false; 45 46 49 public AbstractListItemPart(FONode parent) { 50 super(parent); 51 } 52 53 56 public void bind(PropertyList pList) throws FOPException { 57 id = pList.get(PR_ID).getString(); 58 keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); 59 } 60 61 64 protected void startOfNode() throws FOPException { 65 checkId(id); 66 } 67 68 72 protected void validateChildNode(Locator loc, String nsURI, String localName) 73 throws ValidationException { 74 if (FO_URI.equals(nsURI) && localName.equals("marker")) { 75 if (blockItemFound) { 76 nodesOutOfOrderError(loc, "fo:marker", "(%block;)"); 77 } 78 } else if (!isBlockItem(nsURI, localName)) { 79 invalidChildError(loc, nsURI, localName); 80 } else { 81 blockItemFound = true; 82 } 83 } 84 85 88 protected void endOfNode() throws FOPException { 89 if (!this.blockItemFound) { 90 String contentModel = "marker* (%block;)+"; 91 if (getUserAgent().validateStrictly()) { 92 missingChildElementError(contentModel); 93 } else { 94 StringBuffer message = new StringBuffer ( 95 errorText(getLocator())); 96 message.append(getName()) 97 .append(" is missing child elements. ") 98 .append("Required Content Model: ") 99 .append(contentModel); 100 getLogger().warn(message.toString()); 101 } 102 } 103 } 104 105 106 public KeepProperty getKeepTogether() { 107 return keepTogether; 108 } 109 110 111 public String getId() { 112 return id; 113 } 114 115 } 116 117 | Popular Tags |