gmazza 2004/08/08 12:04:50 Modified: src/java/org/apache/fop/fo FObj.java PropertySets.java src/java/org/apache/fop/fo/flow BasicLink.java BidiOverride.java Block.java BlockContainer.java Inline.java InlineContainer.java ListBlock.java ListItem.java ListItemBody.java ListItemLabel.java Table.java TableAndCaption.java TableBody.java TableCaption.java TableCell.java Wrapper.java Log: Created a BitSet indicating FO's that can contain fo:marker child elements, removed all containsMarkers() methods from FObj subclasses. Revision Changes Path 1.63 +3 -12 xml-fop/src/java/org/apache/fop/fo/FObj.java Index: FObj.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObj.java,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- FObj.java 8 Aug 2004 18:39:22 -0000 1.62 +++ FObj.java 8 Aug 2004 19:04:48 -0000 1.63 @@ -92,7 +92,7 @@ for (int i = 1; i < list.length; i++) { if (list[i] != null) propertyListTable[i] = list[i]; - } + } } } @@ -163,7 +163,8 @@ * @see org.apache.fop.fo.FONode#addChildNode(FONode) */ protected void addChildNode(FONode child) { - if (containsMarkers() && "fo:marker".equals(child.getName())) { + if (PropertySets.canHaveMarkers(getNameId()) && + "fo:marker".equals(child.getName())) { addMarker((Marker) child); } else { if (childNodes == null) { @@ -332,16 +333,6 @@ */ public boolean generatesInlineAreas() { return true; - } - - /** - * Check if this formatting object may contain markers. - * - * @return true if this can contain markers - * @todo confirm if still needed after validateChildNode() fully implemented - */ - protected boolean containsMarkers() { - return false; } /** 1.9 +30 -1 xml-fop/src/java/org/apache/fop/fo/PropertySets.java Index: PropertySets.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertySets.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- PropertySets.java 8 Aug 2004 18:39:22 -0000 1.8 +++ PropertySets.java 8 Aug 2004 19:04:48 -0000 1.9 @@ -25,6 +25,7 @@ public class PropertySets { private static short[][] mapping = null; + private static BitSet can_have_markers = null; private Element[] elements = new Element[Constants.ELEMENT_COUNT+1]; private BitSet block_elems = new BitSet(); @@ -998,7 +999,6 @@ return indices; } - public static short[] getPropertySet(int elementId) { if (mapping == null) { mapping = new short[Constants.ELEMENT_COUNT+1][]; @@ -1010,6 +1010,35 @@ return mapping[elementId]; } + /** + * Determines if fo:markers are allowed as children for the given FO + * @param elementId Constants enumeration ID of the FO (e.g., FO_ROOT) + * @return true if fo:markers allowed, false otherwise + * @todo check if still needed after validateChildNode() fully implemented + */ + public static boolean canHaveMarkers(int elementId) { + if (can_have_markers == null) { + can_have_markers = new BitSet(); + can_have_markers.set(Constants.FO_BASIC_LINK); + can_have_markers.set(Constants.FO_BIDI_OVERRIDE); + can_have_markers.set(Constants.FO_BLOCK); + can_have_markers.set(Constants.FO_BLOCK_CONTAINER); + can_have_markers.set(Constants.FO_INLINE); + can_have_markers.set(Constants.FO_INLINE_CONTAINER); + can_have_markers.set(Constants.FO_LIST_BLOCK); + can_have_markers.set(Constants.FO_LIST_ITEM); + can_have_markers.set(Constants.FO_LIST_ITEM_BODY); + can_have_markers.set(Constants.FO_LIST_ITEM_LABEL); + can_have_markers.set(Constants.FO_TABLE); + can_have_markers.set(Constants.FO_TABLE_BODY); + can_have_markers.set(Constants.FO_TABLE_CELL); + can_have_markers.set(Constants.FO_TABLE_AND_CAPTION); + can_have_markers.set(Constants.FO_TABLE_CAPTION); + can_have_markers.set(Constants.FO_WRAPPER); + } + return can_have_markers.get(elementId); + } + /** * An object that represent the properties and contents of a fo element */ 1.25 +0 -8 xml-fop/src/java/org/apache/fop/fo/flow/BasicLink.java Index: BasicLink.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/BasicLink.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- BasicLink.java 8 Aug 2004 18:39:22 -0000 1.24 +++ BasicLink.java 8 Aug 2004 19:04:48 -0000 1.25 @@ -141,12 +141,4 @@ public int getNameId() { return FO_BASIC_LINK; } - - /** - * @return true (BasicLink can contain Markers) - * @todo see if can remove in favor of a BitSet for all FO's - */ - protected boolean containsMarkers() { - return true; - } } 1.16 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/BidiOverride.java Index: BidiOverride.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/BidiOverride.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- BidiOverride.java 8 Aug 2004 18:39:22 -0000 1.15 +++ BidiOverride.java 8 Aug 2004 19:04:49 -0000 1.16 @@ -146,11 +146,4 @@ public int getNameId() { return FO_BIDI_OVERRIDE; } - - /** - * @return true (BidiOverride can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } } 1.31 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/Block.java Index: Block.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Block.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- Block.java 8 Aug 2004 18:39:22 -0000 1.30 +++ Block.java 8 Aug 2004 19:04:49 -0000 1.31 @@ -350,11 +350,4 @@ public int getNameId() { return FO_BLOCK; } - - /** - * @return true (Block can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } } 1.17 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/BlockContainer.java Index: BlockContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/BlockContainer.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- BlockContainer.java 8 Aug 2004 18:39:22 -0000 1.16 +++ BlockContainer.java 8 Aug 2004 19:04:49 -0000 1.17 @@ -120,13 +120,6 @@ } /** - * @return true (BlockContainer can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * @return the span for this object */ public int getSpan() { 1.23 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/Inline.java Index: Inline.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Inline.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- Inline.java 8 Aug 2004 18:39:22 -0000 1.22 +++ Inline.java 8 Aug 2004 19:04:49 -0000 1.23 @@ -94,13 +94,6 @@ } /** - * @return true (Inline can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * @see org.apache.fop.fo.FObjMixed#charIterator */ public CharIterator charIterator() { 1.16 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/InlineContainer.java Index: InlineContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/InlineContainer.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- InlineContainer.java 8 Aug 2004 18:39:22 -0000 1.15 +++ InlineContainer.java 8 Aug 2004 19:04:49 -0000 1.16 @@ -87,13 +87,6 @@ } /** - * @return true (InlineContainer can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * @see org.apache.fop.fo.FObj#addLayoutManager(List) */ public void addLayoutManager(List list) { 1.22 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/ListBlock.java Index: ListBlock.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/ListBlock.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- ListBlock.java 8 Aug 2004 18:39:23 -0000 1.21 +++ ListBlock.java 8 Aug 2004 19:04:49 -0000 1.22 @@ -95,13 +95,6 @@ } /** - * @return true (ListBlock can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * @see org.apache.fop.fo.FObj#addLayoutManager(List) */ public void addLayoutManager(List list) { 1.24 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/ListItem.java Index: ListItem.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/ListItem.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- ListItem.java 8 Aug 2004 18:39:23 -0000 1.23 +++ ListItem.java 8 Aug 2004 19:04:49 -0000 1.24 @@ -99,13 +99,6 @@ } /** - * @return true (ListItem can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * @see org.apache.fop.fo.FObj#addLayoutManager(List) * @todo remove checks for non-nulls after validateChildNode() added */ 1.16 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/ListItemBody.java Index: ListItemBody.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/ListItemBody.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- ListItemBody.java 8 Aug 2004 18:39:23 -0000 1.15 +++ ListItemBody.java 8 Aug 2004 19:04:49 -0000 1.16 @@ -53,13 +53,6 @@ } - /** - * @return true (ListItemBody can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - public String getName() { return "fo:list-item-body"; } 1.24 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/ListItemLabel.java Index: ListItemLabel.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/ListItemLabel.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- ListItemLabel.java 8 Aug 2004 18:39:23 -0000 1.23 +++ ListItemLabel.java 8 Aug 2004 19:04:49 -0000 1.24 @@ -65,13 +65,6 @@ } - /** - * @return true (ListItemLabel may contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - protected void endOfNode() throws SAXParseException { super.endOfNode(); getFOInputHandler().endListLabel(); 1.26 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/Table.java Index: Table.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Table.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- Table.java 8 Aug 2004 18:39:23 -0000 1.25 +++ Table.java 8 Aug 2004 19:04:49 -0000 1.26 @@ -173,13 +173,6 @@ return false; } - /** - * @return true (Table contains Markers) - */ - protected boolean containsMarkers() { - return true; - } - public ArrayList getColumns() { return columns; } 1.12 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/TableAndCaption.java Index: TableAndCaption.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableAndCaption.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- TableAndCaption.java 8 Aug 2004 18:39:23 -0000 1.11 +++ TableAndCaption.java 8 Aug 2004 19:04:49 -0000 1.12 @@ -74,13 +74,6 @@ return false; } - /** - * @return true (TableAndCaption contains Markers) - */ - protected boolean containsMarkers() { - return true; - } - public String getName() { return "fo:table-and-caption"; } 1.22 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/TableBody.java Index: TableBody.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableBody.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- TableBody.java 8 Aug 2004 18:39:23 -0000 1.21 +++ TableBody.java 8 Aug 2004 19:04:49 -0000 1.22 @@ -90,13 +90,6 @@ } /** - * @return true (TableBody contains Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * This is a hook for the AddLMVisitor class to be able to access * this object. * @param aLMV the AddLMVisitor object that can access this object. 1.13 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/TableCaption.java Index: TableCaption.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableCaption.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- TableCaption.java 8 Aug 2004 18:39:23 -0000 1.12 +++ TableCaption.java 8 Aug 2004 19:04:49 -0000 1.13 @@ -67,13 +67,6 @@ } - /** - * @return true (TableCaption contains Markers) - */ - protected boolean containsMarkers() { - return true; - } - public String getName() { return "fo:table-caption"; } 1.25 +0 -8 xml-fop/src/java/org/apache/fop/fo/flow/TableCell.java Index: TableCell.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableCell.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- TableCell.java 8 Aug 2004 18:39:23 -0000 1.24 +++ TableCell.java 8 Aug 2004 19:04:49 -0000 1.25 @@ -334,14 +334,6 @@ } /** - * - * @return true (TableCell can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * @see org.apache.fop.fo.FObj#addLayoutManager(List) */ public void addLayoutManager(List list) { 1.11 +0 -7 xml-fop/src/java/org/apache/fop/fo/flow/Wrapper.java Index: Wrapper.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Wrapper.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Wrapper.java 8 Aug 2004 18:39:23 -0000 1.10 +++ Wrapper.java 8 Aug 2004 19:04:49 -0000 1.11 @@ -41,13 +41,6 @@ super(parent); } - /** - * @return true (Wrapper contains Markers) - */ - protected boolean containsMarkers() { - return true; - } - public void acceptVisitor(AddLMVisitor aLMV) { aLMV.serveWrapper(this); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]