gmazza 2005/01/09 04:47:40 Modified: src/java/org/apache/fop/fo FONode.java src/java/org/apache/fop/fo/pagination/bookmarks Bookmark.java Log: 1.) New attributeWarning() method added to FONode (needs to be renamed somehow because can this method can also be used for formatting object warnings as well--e.g., unimplemented FO's) 2.) Switch from processNode() -> bind() method for fo:bookmark. Revision Changes Path 1.52 +27 -4 xml-fop/src/java/org/apache/fop/fo/FONode.java Index: FONode.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FONode.java,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- FONode.java 24 Dec 2004 12:06:25 -0000 1.51 +++ FONode.java 9 Jan 2005 12:47:40 -0000 1.52 @@ -253,10 +253,10 @@ } /** - * Helper function to standardize "too many" error exceptions - * (e.g., two fo:declarations within fo:root) - * @param loc org.xml.sax.Locator object of the error (*not* parent node) - * @param offendingNode incoming node that would cause a duplication. + * Helper function to standardize property error exceptions + * (e.g., not specifying either an internal- or an external-destination + * property for an FO:link) + * @param problem text to display that indicates the problem */ protected void attributeError(String problem) throws ValidationException { @@ -265,6 +265,15 @@ } /** + * Helper function to standardize attribute warnings + * (e.g., currently unsupported properties) + * @param problem text to display that indicates the problem + */ + protected void attributeWarning(String problem) { + getLogger().warn(errorText(locator) + getName() + ", " + problem); + } + + /** * Helper function to standardize "too many" error exceptions * (e.g., two fo:declarations within fo:root) * @param loc org.xml.sax.Locator object of the error (*not* parent node) @@ -367,6 +376,20 @@ return "Error(Unknown location): "; } else { return "Error(" + loc.getLineNumber() + "/" + loc.getColumnNumber() + "): "; + } + } + + /** + * Helper function to return "Warning (line#/column#)" string for + * warning messages + * @param loc org.xml.sax.Locator object + * @return String opening warning text + */ + protected static String warningText(Locator loc) { + if (loc == null) { + return "Warning(Unknown location): "; + } else { + return "Warning(" + loc.getLineNumber() + "/" + loc.getColumnNumber() + "): "; } } 1.3 +20 -19 xml-fop/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java Index: Bookmark.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Bookmark.java 6 Jan 2005 00:56:26 -0000 1.2 +++ Bookmark.java 9 Jan 2005 12:47:40 -0000 1.3 @@ -26,6 +26,7 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.ValidationException; +import org.apache.fop.fo.properties.CommonAccessibility; /** @@ -37,8 +38,11 @@ private BookmarkTitle bookmarkTitle; private ArrayList childBookmarks = new ArrayList(); + // The value of properties relevant for this FO + private CommonAccessibility commonAccessibility; private String internalDestination; private String externalDestination; + // private ToBeImplementedProperty startingState; /** * Create a new bookmark object. @@ -50,27 +54,24 @@ } /** - * The attributes on the bookmark object are the internal and external - * destination. One of these is required. - * - * @see org.apache.fop.fo.FObj#processNode - * @todo to include all properties of fo:bookmark + * @see org.apache.fop.fo.FObj#bind(PropertyList) */ - public void processNode(String elementName, Locator locator, - Attributes attlist, PropertyList propertyList) throws FOPException - { - internalDestination = - attlist.getValue("internal-destination"); - externalDestination = - attlist.getValue("external-destination"); - if (externalDestination != null && !externalDestination.equals("")) { - getLogger().warn("fo:bookmark external-destination not supported currently."); - } - - if (internalDestination == null || internalDestination.equals("")) { - getLogger().warn("fo:bookmark requires an internal-destination."); + public void bind(PropertyList pList) throws FOPException { + commonAccessibility = pList.getAccessibilityProps(); + externalDestination = pList.get(PR_EXTERNAL_DESTINATION).getString(); + internalDestination = pList.get(PR_INTERNAL_DESTINATION).getString(); + // startingState = pList.get(PR_STARTING_STATE); + + // per spec, internal takes precedence if both specified + if (internalDestination.length() > 0) { + externalDestination = null; + } else if (externalDestination.length() == 0) { + // slightly stronger than spec "should be specified" + attributeError("Missing attribute: Either external-destination or " + + "internal-destination must be specified."); + } else { + attributeWarning("external-destination property not currently supported"); } - } /**
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]