aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2005-01-09 12:47:40 +0000
committerGlen Mazza <gmazza@apache.org>2005-01-09 12:47:40 +0000
commita2a5e1ea669973db55907af2ad62325b8e776eb5 (patch)
treeaffffaa338ea0063a2ec1492d739a980e015e493 /src
parente60c3ee7273dea8fb2c4db97eb248ee5b35972bd (diff)
downloadxmlgraphics-fop-a2a5e1ea669973db55907af2ad62325b8e776eb5.tar.gz
xmlgraphics-fop-a2a5e1ea669973db55907af2ad62325b8e776eb5.zip
PR:
Obtained from: Submitted by: Reviewed by: 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. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198249 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/fo/FONode.java31
-rw-r--r--src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java39
2 files changed, 47 insertions, 23 deletions
diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java
index ec6dc59bb..fecc2374a 100644
--- a/src/java/org/apache/fop/fo/FONode.java
+++ b/src/java/org/apache/fop/fo/FONode.java
@@ -253,10 +253,10 @@ public abstract class FONode implements Cloneable {
}
/**
- * 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 @@ public abstract class FONode implements Cloneable {
}
/**
+ * 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)
@@ -371,6 +380,20 @@ public abstract class FONode implements Cloneable {
}
/**
+ * 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() + "): ";
+ }
+ }
+
+ /**
* Returns the name of the node
* @return the name of this node
*/
diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java b/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java
index dce00e128..634240ac2 100644
--- a/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java
+++ b/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java
@@ -26,6 +26,7 @@ import org.apache.fop.fo.FObj;
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 @@ public class Bookmark extends FObj {
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 @@ public class Bookmark extends FObj {
}
/**
- * 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");
}
-
}
/**