From 637eba565897927257bf349bd150124f86069d15 Mon Sep 17 00:00:00 2001 From: Jordan Naftolin Date: Wed, 21 Jun 2000 23:40:41 +0000 Subject: [PATCH] created initializeID method git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193424 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/datatypes/IDReferences.java | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/org/apache/fop/datatypes/IDReferences.java b/src/org/apache/fop/datatypes/IDReferences.java index 232e74360..c610525d6 100644 --- a/src/org/apache/fop/datatypes/IDReferences.java +++ b/src/org/apache/fop/datatypes/IDReferences.java @@ -59,13 +59,15 @@ import java.util.Hashtable; import java.util.Vector; import java.util.Enumeration; import java.util.NoSuchElementException; +import org.apache.fop.layout.Area; +import org.apache.fop.apps.FOPException; -public class IDReferences -{ +public class IDReferences { private Hashtable idReferences; private Vector idValidation; + final static int ID_PADDING = 5000; // space to add before id y position /** * Constructor for IDReferences @@ -77,6 +79,28 @@ public class IDReferences } + /** + * Initializes the specified id. This should be called everytime an id is encountered + * + * @param id The id to initialize + * @param area The area where this id was encountered + * @exception FOPException + */ + public void initializeID(String id, Area area) throws FOPException + { + if ( id!=null && !id.equals("") ) { + if ( doesIDExist(id) ) { + throw new FOPException("The id \""+id+"\" already exists in this document"); + } + else { + createNewId(id); + removeFromIdValidationList(id); + setYPosition(id,area.getPage().getBody().getYPosition() - area.getAbsoluteHeight()+ID_PADDING); + area.getPage().addToIDList(id); + } + } + } + /** * Adds id to validation list to be validated . This should be used if it is unsure whether the id is valid * -- 2.39.5