1 17 18 19 20 package org.apache.fop.fo.pagination; 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 30 33 public class Flow extends FObj { 34 private String flowName; 36 38 39 private boolean blockItemFound = false; 40 41 44 public Flow(FONode parent) { 45 super(parent); 46 } 47 48 51 public void bind(PropertyList pList) throws FOPException { 52 flowName = pList.get(PR_FLOW_NAME).getString(); 53 } 54 55 58 protected void startOfNode() throws FOPException { 59 if (flowName == null || flowName.equals("")) { 60 missingPropertyError("flow-name"); 61 } 62 63 68 78 getFOEventHandler().startFlow(this); 81 } 82 83 88 protected void endOfNode() throws FOPException { 89 if (!blockItemFound) { 90 missingChildElementError("marker* (%block;)+"); 91 } 92 getFOEventHandler().endFlow(this); 93 } 94 95 99 protected void validateChildNode(Locator loc, String nsURI, String localName) 100 throws ValidationException { 101 if (FO_URI.equals(nsURI) && localName.equals("marker")) { 102 if (blockItemFound) { 103 nodesOutOfOrderError(loc, "fo:marker", "(%block;)"); 104 } 105 } else if (!isBlockItem(nsURI, localName)) { 106 invalidChildError(loc, nsURI, localName); 107 } else { 108 blockItemFound = true; 109 } 110 } 111 112 115 public boolean generatesReferenceAreas() { 116 return true; 117 } 118 119 120 public String getFlowName() { 121 return flowName; 122 } 123 124 125 public String getLocalName() { 126 return "flow"; 127 } 128 129 132 public int getNameId() { 133 return FO_FLOW; 134 } 135 } 136 | Popular Tags |