org.apache.fop.datatypes
Class IDReferences

java.lang.Object
  extended byorg.apache.fop.datatypes.IDReferences

public class IDReferences
extends java.lang.Object

IDReferences contains a map of IDs and the objects to which they refer. It also contains a list of references to IDs which have yet to be encountered. Modified by Mark Lillywhite mark-fop@inomial.com. Added getInvalidElements() so that StreamRenderer can tell what hasn't been determined yet. Modified by lmckenzi@ca.ibm.com Sometimes IDs are created, but not validated. This code fixes the incorrect complaint that the ID already exists which prevents basic-links from working (sometimes).


Constructor Summary
IDReferences()
          Constructor for IDReferences
 
Method Summary
 void addToIdValidationList(java.lang.String id)
          Adds id to validation list to be validated.
 void addToUnvalidatedIdList(java.lang.String id)
          Adds created id list of unvalidated ids that have already been created.
 void configureID(java.lang.String id, Area area)
          Configures this id
 void createID(java.lang.String id)
          Creates id entry
 java.lang.String createInternalLinkGoTo(java.lang.String id, int objectNumber)
          creates an Internal Link GoTo object for this id
 void createNewId(java.lang.String id)
          Adds an id to IDReferences
 void createUnvalidatedID(java.lang.String id)
          Creates id entry that hasn't been validated
 boolean doesGoToReferenceExist(java.lang.String id)
          Determines whether the GoTo reference for the specified id is defined
 boolean doesIDExist(java.lang.String id)
          Determines whether specified id already exists in IDReferences
 boolean doesUnvalidatedIDExist(java.lang.String id)
          Determines whether specified id already exists in idUnvalidated
 java.lang.String getDestinationRef(java.lang.String id)
          Returns a destination reference for the node with the specified id.
 java.lang.String getInternalLinkGoToReference(java.lang.String id)
          Returns the reference to the GoTo object used for the internal link
 java.util.Iterator getInvalidElements()
           
 java.lang.String getInvalidIds()
          Returns all invalid id's still remaining in the validation list
 java.lang.String getPageNumber(java.lang.String id)
          Returns the page number where the specified id is found
 PDFGoTo getPDFGoTo(java.lang.String id)
          Returns the PDFGoTo object for the specified id
 void initializeID(java.lang.String id, Area area)
          Creates and configures the specified id.
 boolean isEveryIdValid()
          Determines whether all id's are valid
 void removeFromIdValidationList(java.lang.String id)
          Removes id from validation list.
 void removeFromUnvalidatedIDList(java.lang.String id)
          Removes id from list of unvalidated ids.
 void removeID(java.lang.String id)
          Removes id from IDReferences
 void setInternalGoToPageReference(java.lang.String id, java.lang.String pageReference)
          sets the page reference for the internal link's GoTo.
 void setPageNumber(java.lang.String id, java.lang.String pageNumber)
          Sets the page number for the specified id
 void setPosition(java.lang.String id, int x, int y)
          Sets the x and y position of specified id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDReferences

public IDReferences()
Constructor for IDReferences

Method Detail

initializeID

public void initializeID(java.lang.String id,
                         Area area)
                  throws FOPException
Creates and configures the specified id.

Parameters:
id - The id to initialize
area - The area where this id was encountered
Throws:
FOPException

createID

public void createID(java.lang.String id)
              throws FOPException
Creates id entry

Parameters:
id - The id to create
Throws:
FOPException

createUnvalidatedID

public void createUnvalidatedID(java.lang.String id)
Creates id entry that hasn't been validated

Parameters:
id - The id to create

addToUnvalidatedIdList

public void addToUnvalidatedIdList(java.lang.String id)
Adds created id list of unvalidated ids that have already been created. This should be used if it is unsure whether the id is valid but it must be anyhow.

Parameters:
id - The id to create

removeFromUnvalidatedIDList

public void removeFromUnvalidatedIDList(java.lang.String id)
Removes id from list of unvalidated ids. This should be used if the id has been determined to be valid.

Parameters:
id - The id to remove

doesUnvalidatedIDExist

public boolean doesUnvalidatedIDExist(java.lang.String id)
Determines whether specified id already exists in idUnvalidated

Parameters:
id - The id to search for
Returns:
true if ID was found, false otherwise

configureID

public void configureID(java.lang.String id,
                        Area area)
Configures this id

Parameters:
id - The id to configure
area - The area where the id was encountered

addToIdValidationList

public void addToIdValidationList(java.lang.String id)
Adds id to validation list to be validated. This should be used if it is unsure whether the id is valid.

Parameters:
id - id to be added

removeFromIdValidationList

public void removeFromIdValidationList(java.lang.String id)
Removes id from validation list. This should be used if the id has been determined to be valid

Parameters:
id - the id to remove

removeID

public void removeID(java.lang.String id)
Removes id from IDReferences

Parameters:
id - The id to remove

isEveryIdValid

public boolean isEveryIdValid()
Determines whether all id's are valid

Returns:
true if all id's are valid, false otherwise

getInvalidIds

public java.lang.String getInvalidIds()
Returns all invalid id's still remaining in the validation list

Returns:
invalid ids from validation list

doesIDExist

public boolean doesIDExist(java.lang.String id)
Determines whether specified id already exists in IDReferences

Parameters:
id - the id to search for
Returns:
true if ID was found, false otherwise

doesGoToReferenceExist

public boolean doesGoToReferenceExist(java.lang.String id)
Determines whether the GoTo reference for the specified id is defined

Parameters:
id - the id to search for
Returns:
true if GoTo reference is defined, false otherwise

getInternalLinkGoToReference

public java.lang.String getInternalLinkGoToReference(java.lang.String id)
Returns the reference to the GoTo object used for the internal link

Parameters:
id - the id whose reference to use
Returns:
reference to GoTo object

createInternalLinkGoTo

public java.lang.String createInternalLinkGoTo(java.lang.String id,
                                               int objectNumber)
creates an Internal Link GoTo object for this id

Parameters:
id - The id for which to set the Internal Link Go To
objectNumber - The object number to use for the GoTo object
Returns:
the object reference of the new GoTo object

createNewId

public void createNewId(java.lang.String id)
Adds an id to IDReferences

Parameters:
id - the id to add

getPDFGoTo

public PDFGoTo getPDFGoTo(java.lang.String id)
Returns the PDFGoTo object for the specified id

Parameters:
id - the id for which the PDFGoTo to be retrieved is associated
Returns:
the PDFGoTo object associated with the specified id

setInternalGoToPageReference

public void setInternalGoToPageReference(java.lang.String id,
                                         java.lang.String pageReference)
sets the page reference for the internal link's GoTo. The GoTo will jump to this page reference.

Parameters:
pageReference - the page reference to which the internal link GoTo should jump ex. 23 0 R

setPageNumber

public void setPageNumber(java.lang.String id,
                          java.lang.String pageNumber)
Sets the page number for the specified id

Parameters:
id - The id whose page number is being set
pageNumber - The page number of the specified id

getPageNumber

public java.lang.String getPageNumber(java.lang.String id)
Returns the page number where the specified id is found

Parameters:
id - The id whose page number to return
Returns:
the page number of the id, or null if the id does not exist

setPosition

public void setPosition(java.lang.String id,
                        int x,
                        int y)
Sets the x and y position of specified id

Parameters:
id - the id whose position is to be set
x - x position of id
y - y position of id

getInvalidElements

public java.util.Iterator getInvalidElements()

getDestinationRef

public java.lang.String getDestinationRef(java.lang.String id)
Returns a destination reference for the node with the specified id. If id does not exist, returns null. Destination format is: [ ?objectId 0 R /XYZ ?x ?y null ]

Parameters:
id - The id whose destination reference to return
Returns:
Destination reference for this node


Copyright © 1999-2003 Apache Software Foundation. All Rights Reserved.