org.apache.cocoon.transformation.pagination
Class Pagesheet

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.apache.cocoon.transformation.pagination.Pagesheet
All Implemented Interfaces:
Cloneable, ContentHandler, DTDHandler, EntityResolver, ErrorHandler, org.apache.cocoon.Modifiable

public class Pagesheet
extends DefaultHandler
implements Cloneable, org.apache.cocoon.Modifiable

Interprets the pagesheet rules to perform pagination.

 FIXME (SM): this code sucks! It was done to show the concept of
             rule driven pagination (which I find very nice) but
             it needs major refactoring in order to be sufficiently
             stable to allow any input to enter without breaking
             SAX well-formness. I currently don't have the time to make
             it any better (along with implementing the char-based rule
             that is mostly useful for text documents) but if you want
             to blast the code and rewrite it better, you'll make me happy :)
 

Version:
$Id: Pagesheet.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Constructor Summary
Pagesheet()
           
 
Method Summary
 Object clone()
           
 void endDocument()
           
 void endElement(String uri, String loc, String raw)
           
 String getItemGroupName(String elementURI, String elementName)
           
 int getPageForItem(int item, String itemGroup)
           
 PageRules getPageRules(int page)
           
 int getTotalItems(String itemGroup)
           
 int getTotalPages()
           
 boolean isInPage(int page, int item, String itemGroup)
           
 int itemCount(String elementURI, String elementName)
           
 boolean modifiedSince(long date)
           
 void processCharacters(char[] ch, int index, int len)
           
 void processEndElement(String uri, String name)
           
 void processStartElement(String uri, String name)
           
 void setLastModified(long lastModified)
           
 void startElement(String uri, String loc, String raw, Attributes a)
           
 void startPrefixMapping(String prefix, String uri)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pagesheet

public Pagesheet()
Method Detail

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Specified by:
startPrefixMapping in interface ContentHandler
Throws:
SAXException

startElement

public void startElement(String uri,
                         String loc,
                         String raw,
                         Attributes a)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Throws:
SAXException

endElement

public void endElement(String uri,
                       String loc,
                       String raw)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Throws:
SAXException

processStartElement

public void processStartElement(String uri,
                                String name)

processEndElement

public void processEndElement(String uri,
                              String name)

processCharacters

public void processCharacters(char[] ch,
                              int index,
                              int len)

isInPage

public boolean isInPage(int page,
                        int item,
                        String itemGroup)

getTotalPages

public int getTotalPages()

getTotalItems

public int getTotalItems(String itemGroup)

getPageForItem

public int getPageForItem(int item,
                          String itemGroup)

itemCount

public int itemCount(String elementURI,
                     String elementName)

getItemGroupName

public String getItemGroupName(String elementURI,
                               String elementName)

getPageRules

public PageRules getPageRules(int page)

setLastModified

public void setLastModified(long lastModified)

modifiedSince

public boolean modifiedSince(long date)
Specified by:
modifiedSince in interface org.apache.cocoon.Modifiable

clone

public Object clone()


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.