vgritsenko    2003/01/31 18:09:31

  Modified:    src/scratchpad/src/org/apache/cocoon/transformation/pagination
                        PageRules.java Pagesheet.java Paginator.java
               src/scratchpad/webapp/samples scratchpad-samples.xml
               src/scratchpad/webapp/samples/paginator README.txt
                        sitemap.xmap
               src/scratchpad/webapp/samples/paginator/content list.xml
               src/scratchpad/webapp/samples/paginator/pagesheets
                        list.pagesheet pagesheet.dtd
               src/scratchpad/webapp/samples/paginator/stylesheets
                        list2html.xsl pagedlist2html.xsl
  Added:       src/scratchpad/webapp/samples/paginator/content text.xml
               src/scratchpad/webapp/samples/paginator/pagesheets
                        text.pagesheet
  Log:
  improve paginator: first stab on character based pagination.
  demo included.
  
  Revision  Changes    Path
  1.8       +2 -2      
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/pagination/PageRules.java
  
  Index: PageRules.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/pagination/PageRules.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PageRules.java    31 Jan 2003 22:54:48 -0000      1.7
  +++ PageRules.java    1 Feb 2003 02:09:29 -0000       1.8
  @@ -61,7 +61,7 @@
   
       public String elementName;
       public String elementURI;
  -    public int elementCount = 1;
  +    public int elementCount = 0;
       public int charCount = 0;
       public int unitLinks = 0;
       public int rangeLink = 0;
  
  
  
  1.9       +107 -71   
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/pagination/Pagesheet.java
  
  Index: Pagesheet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/pagination/Pagesheet.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Pagesheet.java    31 Jan 2003 22:54:48 -0000      1.8
  +++ Pagesheet.java    1 Feb 2003 02:09:29 -0000       1.9
  @@ -3,34 +3,34 @@
    ============================================================================
                      The Apache Software License, Version 1.1
    ============================================================================
  - 
  +
    Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  - 
  +
    Redistribution and use in source and binary forms, with or without modifica-
    tion, are permitted provided that the following conditions are met:
  - 
  +
    1. Redistributions of  source code must  retain the above copyright  notice,
       this list of conditions and the following disclaimer.
  - 
  +
    2. Redistributions in binary form must reproduce the above copyright notice,
       this list of conditions and the following disclaimer in the documentation
       and/or other materials provided with the distribution.
  - 
  +
    3. The end-user documentation included with the redistribution, if any, must
       include  the following  acknowledgment:  "This product includes  software
       developed  by the  Apache Software Foundation  (http://www.apache.org/)."
       Alternately, this  acknowledgment may  appear in the software itself,  if
       and wherever such third-party acknowledgments normally appear.
  - 
  +
    4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
       used to  endorse or promote  products derived from  this software without
       prior written permission. For written permission, please contact
       [EMAIL PROTECTED]
  - 
  +
    5. Products  derived from this software may not  be called "Apache", nor may
       "Apache" appear  in their name,  without prior written permission  of the
       Apache Software Foundation.
  - 
  +
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
    FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  @@ -41,12 +41,12 @@
    ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
    (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  - 
  +
    This software  consists of voluntary contributions made  by many individuals
    on  behalf of the Apache Software  Foundation and was  originally created by
  - Stefano Mazzocchi  <[EMAIL PROTECTED]>. For more  information on the Apache 
  + Stefano Mazzocchi  <[EMAIL PROTECTED]>. For more  information on the Apache
    Software Foundation, please see <http://www.apache.org/>.
  - 
  +
   */
   
   package org.apache.cocoon.transformation.pagination;
  @@ -65,8 +65,9 @@
   
   /**
    * Interprets the pagesheet rules to perform pagination.
  - * 
  - * FIXME (SM): this code sucks! It was done to show the concept of 
  + *
  + * <pre>
  + * 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
  @@ -74,12 +75,13 @@
    *             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 :)
  + * </pre>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stefano Mazzocchi</a>
    * @version CVS $Revision$ $Date$
    */
  - 
  -/* 
  +
  +/*
   
   This is an example pagesheet to show the power of this:
   
  @@ -102,55 +104,55 @@
   
   which indicates that:
   
  - 1) there is one item group called "picture" and each item is given by the 
  + 1) there is one item group called "picture" and each item is given by the
       element "file" of the namespace "http://apache.org/cocoon/directory/2.0";.
  -    
  +
    2) for the first page, the pagination rules indicate that there are two unit
  -    links (two above and two below, so linking to page -2 -1 0 +1 +2) and 
  +    links (two above and two below, so linking to page -2 -1 0 +1 +2) and
       range links have value 10 (so they link to page -10 and +10).
  - 
  +
    3) for the rest of the pages, there are three unit links (-3 -2 -1 0 +1 +2 +3)
       and range goes 20 (so +20 and -20).
  -    
  -*/
   
  +*/
   public class Pagesheet extends DefaultHandler implements Cloneable, Modifiable {
   
  +    // Used only during parsing of pagesheet document
       private int level = 0;
       private int pg = 0;
       private long lastModified;
  -    private Pagesheet pagesheet;
       private PageRules rules;
   
  +    // Loaded pagesheet information
       ResizableContainer pageRules;
  -    ResizableContainer pages;
  -
       Map itemGroupsPerName;
       Map itemGroupsPerElement;
       Map itemListsPerName;
       Map itemListsPerElement;
   
  -    private int currentPage = 1;
  -    private int currentPageElementStart = 1;
  -    private int currentPageElementEnd = 1;
  -    private int counter = 0;
  +    // Runtime information
  +    private ResizableContainer pages;
  +    private Page currentPage = new Page(1, 1);
  +    private int pageCounter = 1;
  +    private int elementCounter = 0;
       private int descendant = 0;
   
  -    class Page {
  +    private static class Page {
           public int elementStart;
           public int elementEnd;
  +        public int characters;
   
  -        public Page(int start, int end) {
  -            this.elementStart = start;
  -            this.elementEnd = end;
  +        public Page(int elementStart, int elementEnd) {
  +            this.elementStart = elementStart;
  +            this.elementEnd = elementEnd;
           }
   
  -        public boolean validInPage(int counter) {
  -            return (this.elementStart <= counter) && (counter <= this.elementEnd);
  +        public boolean validInPage(int elementCounter) {
  +            return (this.elementStart <= elementCounter) && (elementCounter <= 
this.elementEnd);
           }
       }
   
  -    class ItemList extends ArrayList {
  +    private static class ItemList extends ArrayList {
   
           public ItemList(int capacity) {
               super(capacity);
  @@ -170,6 +172,7 @@
           }
       }
   
  +
       public Pagesheet() {
           this.pages = new ResizableContainer(2);
       }
  @@ -180,17 +183,17 @@
           this.itemGroupsPerElement = itemGroupsPerElement;
   
           this.pages = new ResizableContainer(5);
  -        
  +
           if ((this.itemGroupsPerName != null) && (this.itemGroupsPerElement != 
null)) {
               this.itemListsPerName = new HashMap(itemGroupsPerName.size());
               this.itemListsPerElement = new HashMap(itemGroupsPerName.size());
  -    
  +
               Iterator iter = itemGroupsPerName.values().iterator();
  -            for (int i = 0; iter.hasNext(); i++) {
  +            for (; iter.hasNext(); ) {
                   ItemGroup group = (ItemGroup) iter.next();
                   ItemList list = new ItemList(10);
  -                this.itemListsPerName.put(group.getName(),list);
  -                
this.itemListsPerElement.put(group.getElementURI()+group.getElementName(),list);
  +                this.itemListsPerName.put(group.getName(), list);
  +                this.itemListsPerElement.put(group.getElementURI() + 
group.getElementName(), list);
               }
           }
       }
  @@ -208,13 +211,15 @@
           switch (level) {
               case 1:
                   if (loc.equals("pagesheet")) {
  -                    pagesheet = new Pagesheet();
  +                    // This object represents pagesheet
                       return;
                   }
                   break;
               case 2:
                   if (loc.equals("rules")) {
  -                    if (this.pageRules == null) this.pageRules = new 
ResizableContainer(2);
  +                    if (this.pageRules == null) {
  +                        this.pageRules = new ResizableContainer(2);
  +                    }
                       String key = a.getValue("page");
                       if (key != null) {
                           try {
  @@ -228,16 +233,21 @@
                       rules = new PageRules();
                       return;
                   } else if (loc.equals("items")) {
  -                    if (this.itemGroupsPerName == null) this.itemGroupsPerName = 
new HashMap(2);
  -                    if (this.itemGroupsPerElement == null) 
this.itemGroupsPerElement = new HashMap(2);
  +                    if (this.itemGroupsPerName == null) {
  +                        this.itemGroupsPerName = new HashMap(2);
  +                    }
  +                    if (this.itemGroupsPerElement == null) {
  +                        this.itemGroupsPerElement = new HashMap(2);
  +                    }
                       return;
                   }
                   break;
               case 3:
                   if (loc.equals("count")) {
  +                    rules.elementName = a.getValue("name");
  +                    rules.elementURI = a.getValue("namespace");
  +
                       if (a.getValue("type").equals("element")) {
  -                        rules.elementName = a.getValue("name");
  -                        rules.elementURI = a.getValue("namespace");
                           try {
                               rules.elementCount = 
Integer.parseInt(a.getValue("num"));
                           } catch (NumberFormatException e) {
  @@ -272,13 +282,17 @@
                       return;
                   } else if (loc.equals("group")) {
                       String name = a.getValue("name");
  +                    if (name == null) {
  +                        throw new SAXException("Syntax error: the attribute 
'group/@name' must be present.");
  +                    }
                       String elementName = a.getValue("element");
  +                    if (elementName == null) {
  +                        throw new SAXException("Syntax error: the attribute 
'group/@element' must be present.");
  +                    }
                       String elementURI = a.getValue("namespace");
  -                    if (name == null) throw new SAXException("Syntax error: the 
attribute 'group/@name' must be present.");
  -                    if (elementName == null) throw new SAXException("Syntax error: 
the attribute 'group/@element' must be present.");
                       ItemGroup group = new ItemGroup(name, elementURI, elementName);
                       this.itemGroupsPerName.put(name, group);
  -                    this.itemGroupsPerElement.put(elementURI+elementName, group);
  +                    this.itemGroupsPerElement.put(elementURI + elementName, group);
                       return;
                   }
           }
  @@ -293,25 +307,30 @@
       }
   
       public void endDocument() throws SAXException {
  -        if (pageRules.size() == 0) throw new SAXException("Pagesheet must contain 
at least a set of pagination rules.");
  -        if (pageRules.get(0) == null) throw new SAXException("Pagesheet must 
contain the global pagination rules.");
  +        if (pageRules.size() == 0) {
  +            throw new SAXException("Pagesheet must contain at least a set of 
pagination rules.");
  +        }
  +        if (pageRules.get(0) == null) {
  +            throw new SAXException("Pagesheet must contain the global pagination 
rules.");
  +        }
       }
   
       // --------------- process the received element events ----------------
   
       public void processStartElement(String uri, String name) {
  -        PageRules rules = getPageRules(currentPage);
  +        PageRules rules = getPageRules(pageCounter);
   
  -        if (rules.match(name,uri)) {
  -            counter++;
  +        if (rules.match(name, uri)) {
  +            elementCounter++;
               descendant++;
  -            if (counter == currentPageElementStart) {
  -                currentPageElementEnd = currentPageElementStart + 
rules.elementCount - 1;
  -                pages.set(currentPage, new Page(currentPageElementStart, 
currentPageElementEnd));
  -            }
  -            if (counter == currentPageElementEnd) {
  -                currentPage++;
  -                currentPageElementStart = currentPageElementEnd + 1;
  +            if (currentPage == null || elementCounter == currentPage.elementStart) {
  +                // System.out.println(">>>> " + pageCounter + ": Starting page!!!");
  +                if (rules.elementCount > 0) {
  +                    currentPage.elementEnd = currentPage.elementStart + 
rules.elementCount - 1;
  +                } else {
  +                    currentPage.elementEnd = currentPage.elementStart + 1;
  +                }
  +                pages.set(pageCounter, currentPage);
               }
           }
   
  @@ -320,24 +339,41 @@
               ItemGroup group = (ItemGroup) this.itemGroupsPerElement.get(qname);
               if ((group != null) && (group.match(uri))) {
                   ItemList list = (ItemList) this.itemListsPerElement.get(qname);
  -                if (list != null) list.addItem(currentPage);
  +                if (list != null) {
  +                    list.addItem(pageCounter);
  +                }
               }
           }
       }
   
       public void processEndElement(String uri, String name) {
  -        PageRules rules = getPageRules(currentPage);
  +        PageRules rules = getPageRules(pageCounter);
           if (rules.match(name,uri)) {
               descendant--;
  +
  +            if (rules.charCount > 0 && currentPage.characters > rules.charCount) {
  +                // We are over character limit. Flip the page.
  +                // System.out.println(">>>> " + pageCounter + ": Flipping page!!!");
  +                currentPage.elementEnd = elementCounter;
  +            } else if (rules.elementCount == 0) {
  +                // No limit on elements is specified, and limit on characters is 
not reached yet.
  +                currentPage.elementEnd ++;
  +            }
  +
  +            if (elementCounter == currentPage.elementEnd) {
  +                System.out.println(">>>> " + pageCounter + ": Ending page!!!");
  +                pageCounter++;
  +                currentPage = new Page(currentPage.elementEnd + 1, 0);
  +            }
           }
       }
   
       public void processCharacters(char[] ch, int index, int len) {
  -        PageRules rules = getPageRules(currentPage);
  -        // FIXME (SM): do nothing for now but this is the place where
  -        // we should process the character to do char-based pagination
  -        // instead of element-based pagination which is much more
  -        // useful for text-based documents.
  +        if (descendant > 0) {
  +            // Count amount of characters in the currect page.
  +            // System.out.println(">>>> " + pageCounter + ": " + new String(ch, 
index, len) + " (" + len + " bytes)");
  +            currentPage.characters += len;
  +        }
       }
   
       // --------------- return the pagination information ----------------
  @@ -347,7 +383,7 @@
       }
   
       public int getTotalPages() {
  -        return currentPage;
  +        return pageCounter;
       }
   
       public int getTotalItems(String itemGroup) {
  @@ -378,7 +414,7 @@
       private boolean valid(int page, int item, String itemGroup) {
           if (item == 0) {
               Page p = (Page) pages.get(page);
  -            return (p != null) && (p.validInPage(counter));
  +            return (p != null) && (p.validInPage(elementCounter));
           } else {
               if (this.itemListsPerElement == null) return false;
               ItemList list = (ItemList) this.itemListsPerName.get(itemGroup);
  
  
  
  1.19      +40 -21    
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/pagination/Paginator.java
  
  Index: Paginator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/pagination/Paginator.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Paginator.java    31 Jan 2003 22:54:48 -0000      1.18
  +++ Paginator.java    1 Feb 2003 02:09:29 -0000       1.19
  @@ -99,9 +99,6 @@
       private SAXParser parser;
       private Store store;
       private Source inputSource;
  -    private Parameters par;
  -    private Map objectModel;
  -    private SourceResolver resolver;
       private int page;
       private int item;
       private String itemGroup;
  @@ -137,7 +134,7 @@
               this.parser = null;
           }
           if (this.store != null) {
  -            this.manager.release((Component) this.store);
  +            this.manager.release(this.store);
           } else {
               this.store = null;
           }
  @@ -156,16 +153,18 @@
           try {
               this.level = 0;
               this.prefixMapping = false;
  -            this.par = par;
  -            this.objectModel = objectModel;
               this.inputSource = resolver.resolveURI(src);
  -            this.resolver = resolver;
  -            getLogger().debug("Using pagesheet: '" + this.inputSource.getURI() + "' 
in " + this + ", last modified: " + 
  -                              this.inputSource.getLastModified());
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Using pagesheet: '" + this.inputSource.getURI()
  +                                  + "' in " + this + ", last modified: " + 
this.inputSource.getLastModified());
  +            }
               this.page = par.getParameterAsInteger("page", 1);
               this.item = par.getParameterAsInteger("item", 0);
               this.itemGroup = par.getParameter("item-group", "");
  -            getLogger().debug("Paginating with [page = " + this.page + ", item = " 
+ this.item + ", item-group = " + this.itemGroup + "]");
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Paginating with [page = " + this.page
  +                                  + ", item = " + this.item + ", item-group = " + 
this.itemGroup + "]");
  +            }
   
               this.request = ObjectModelHelper.getRequest(objectModel);
               this.requestURI = request.getRequestURI();
  @@ -181,7 +180,9 @@
                   pagesheet = new Pagesheet();
                   pagesheet.setLastModified(inputSource.getLastModified());
                   parser.parse(new InputSource(inputSource.getInputStream()), 
pagesheet);
  -                if (store != null) store.store(src,pagesheet);
  +                if (store != null) {
  +                    store.store(src,pagesheet);
  +                }
               }
   
               // Clone it in order to avoid concurrency collisions since the
  @@ -367,7 +368,9 @@
       public void characters(char c[], int start, int len)
       throws SAXException {
           pagesheet.processCharacters(c, start, len);
  -        if (pagesheet.isInPage(page, item, itemGroup)) 
super.characters(c,start,len);
  +        if (pagesheet.isInPage(page, item, itemGroup)) {
  +            super.characters(c,start,len);
  +        }
       }
   
       /**
  @@ -379,7 +382,9 @@
        */
       public void ignorableWhitespace(char c[], int start, int len)
       throws SAXException {
  -        if (pagesheet.isInPage(page, item, itemGroup)) 
super.ignorableWhitespace(c,start,len);
  +        if (pagesheet.isInPage(page, item, itemGroup)) {
  +            super.ignorableWhitespace(c,start,len);
  +        }
       }
   
       /**
  @@ -391,7 +396,9 @@
        */
       public void processingInstruction(String target, String data)
       throws SAXException {
  -        if (pagesheet.isInPage(page, item, itemGroup)) 
super.processingInstruction(target,data);
  +        if (pagesheet.isInPage(page, item, itemGroup)) {
  +            super.processingInstruction(target,data);
  +        }
       }
   
       /**
  @@ -402,7 +409,9 @@
        */
       public void skippedEntity(String name)
       throws SAXException {
  -        if (pagesheet.isInPage(page, item, itemGroup)) super.skippedEntity(name);
  +        if (pagesheet.isInPage(page, item, itemGroup)) {
  +            super.skippedEntity(name);
  +        }
       }
   
       /**
  @@ -447,7 +456,9 @@
        */
       public void startEntity(String name)
       throws SAXException {
  -        if (pagesheet.isInPage(page, item, itemGroup)) super.startEntity(name);
  +        if (pagesheet.isInPage(page, item, itemGroup)) {
  +            super.startEntity(name);
  +        }
       }
   
       /**
  @@ -457,7 +468,9 @@
        */
       public void endEntity(String name)
       throws SAXException {
  -        if (pagesheet.isInPage(page, item, itemGroup)) super.endEntity(name);
  +        if (pagesheet.isInPage(page, item, itemGroup)) {
  +            super.endEntity(name);
  +        }
       }
   
       /**
  @@ -465,7 +478,9 @@
        */
       public void startCDATA()
       throws SAXException {
  -        if (pagesheet.isInPage(page, item, itemGroup)) super.startCDATA();
  +        if (pagesheet.isInPage(page, item, itemGroup)) {
  +            super.startCDATA();
  +        }
       }
   
       /**
  @@ -473,7 +488,9 @@
        */
       public void endCDATA()
       throws SAXException {
  -        if (pagesheet.isInPage(page, item, itemGroup)) super.endCDATA();
  +        if (pagesheet.isInPage(page, item, itemGroup)) {
  +            super.endCDATA();
  +        }
       }
   
       /**
  @@ -485,7 +502,9 @@
        */
       public void comment(char ch[], int start, int len)
       throws SAXException {
  -        if (pagesheet.isInPage(page, item, itemGroup)) super.comment(ch,start,len);
  +        if (pagesheet.isInPage(page, item, itemGroup)) {
  +            super.comment(ch,start,len);
  +        }
       }
   
       /**
  
  
  
  1.6       +6 -3      xml-cocoon2/src/scratchpad/webapp/samples/scratchpad-samples.xml
  
  Index: scratchpad-samples.xml
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/scratchpad-samples.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- scratchpad-samples.xml    31 Jan 2003 18:48:26 -0000      1.5
  +++ scratchpad-samples.xml    1 Feb 2003 02:09:30 -0000       1.6
  @@ -24,8 +24,11 @@
     </group>
   
     <group name="Paginator">
  -    <sample name="PaginatorTransformer" href="paginator/">
  -      Show the usage of the Paginator Transformer.
  +    <sample name="List Pagination" href="paginator/list(1)">
  +      Show the usage of the Paginator Transformer to paginate document based on 
items count limit.
  +    </sample>
  +    <sample name="Text Pagination" href="paginator/text(1)">
  +      Show the usage of the Paginator Transformer to paginate document based on 
characters count limit.
       </sample>
     </group>
     
  
  
  
  1.3       +10 -3     xml-cocoon2/src/scratchpad/webapp/samples/paginator/README.txt
  
  Index: README.txt
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/paginator/README.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- README.txt        10 Jul 2002 19:00:32 -0000      1.2
  +++ README.txt        1 Feb 2003 02:09:30 -0000       1.3
  @@ -1,14 +1,21 @@
   
  +CVS: $Id$
  +
  +
   To get started, read the How-To for this component:
      http://localhost:8080/cocoon/howto/howto-paginator-transformer.html
   
   For those who don't like to read docs:
   
  -Make sure you have a version 2.0.3 or greater of Cocoon. The PaginatorTransformer 
component source code is located in the scratchpad area. Therefore, you need to use 
the following command to build a deployable cocoon.war which includes the scratchpad 
libraries.
  +Make sure you have a version 2.0.3 or greater of Cocoon. The PaginatorTransformer 
component
  +source code is located in the scratchpad area. Therefore, you need to use the 
following
  +command to build a deployable cocoon.war which includes the scratchpad libraries.
   
  -  ./build.[ sh | bat ] -Dinclude.scratchpad.libs=yes webapp 
  +  ./build.[ sh | bat ] run 
   
  -During the build process, the necessary configuration details for the 
PaginatorTransformer component are copied to cocoon.xconf of cocoon.war. This means 
that you don't need to manually configure cocoon.xconf.
  +During the build process, the necessary configuration details for the 
PaginatorTransformer
  +component are copied to cocoon.xconf of cocoon.war. This means that you don't need 
to
  +manually configure cocoon.xconf.
   
   To get going with Cocoon 2.0.3, access:
         http://localhost:8080/cocoon/mount/paginator/list(1)
  
  
  
  1.2       +34 -36    xml-cocoon2/src/scratchpad/webapp/samples/paginator/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/paginator/sitemap.xmap,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sitemap.xmap      1 Jul 2002 15:09:19 -0000       1.1
  +++ sitemap.xmap      1 Feb 2003 02:09:30 -0000       1.2
  @@ -1,41 +1,39 @@
   <?xml version="1.0"?>
  -<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
   
  - <map:components>
  -  <map:generators default="file"/>
  -  <map:transformers default="xslt">
  -   <map:transformer name="paginate" 
src="org.apache.cocoon.transformation.pagination.Paginator"/>
  -  </map:transformers>
  -  <map:readers default="resource"/>
  -  <map:serializers default="html"/>
  -  <map:matchers default="wildcard"/>
  -  <map:selectors default="browser"/>
  - </map:components>
  +<!-- CVS: $Id$ -->
   
  - <map:pipelines>
  -  <map:pipeline>
  +<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
  +  <map:components>
  +    <map:generators default="file"/>
  +    <map:transformers default="xslt">
  +      <map:transformer name="paginate" 
src="org.apache.cocoon.transformation.pagination.Paginator"/>
  +    </map:transformers>
  +    <map:readers default="resource"/>
  +    <map:serializers default="html"/>
  +    <map:matchers default="wildcard"/>
  +    <map:selectors default="browser"/>
  +  </map:components>
  +
  +  <map:pipelines>
  +    <map:pipeline>
  +      <map:match pattern="">
  +        <map:redirect-to uri="list(1)"/>
  +      </map:match>
    
  -   <map:match pattern="">
  -    <map:redirect-to uri="list(1)"/>
  -   </map:match>
  -
  -   <map:match pattern="list">
  -    <map:generate src="content/list.xml"/>
  -    <map:transform src="stylesheets/list2html.xsl"/>
  -    <map:serialize type="html"/>
  -   </map:match>
  -
  -   <map:match pattern="list(*)">
  -    <map:generate src="content/list.xml"/>
  -    <map:transform type="paginate" src="pagesheets/list.pagesheet">
  -      <map:parameter name="page" value="{1}"/>
  -    </map:transform>    
  -    <map:transform src="stylesheets/pagedlist2html.xsl"/>
  -    <map:serialize type="html"/>
  -   </map:match>
  -
  -  </map:pipeline>
  -
  - </map:pipelines>
  -
  +      <map:match pattern="*(*)">
  +        <map:generate src="content/{1}.xml"/>
  +        <map:transform type="paginate" src="pagesheets/{1}.pagesheet" 
label="content">
  +          <map:parameter name="page" value="{2}"/>
  +        </map:transform>    
  +        <map:transform src="stylesheets/pagedlist2html.xsl"/>
  +        <map:serialize type="html"/>
  +      </map:match>
  + 
  +      <map:match pattern="*">
  +        <map:generate src="content/{1}.xml"/>
  +        <map:transform src="stylesheets/list2html.xsl"/>
  +        <map:serialize type="html"/>
  +      </map:match>
  +   </map:pipeline>
  +  </map:pipelines>
   </map:sitemap>
  
  
  
  1.2       +13 -9     
xml-cocoon2/src/scratchpad/webapp/samples/paginator/content/list.xml
  
  Index: list.xml
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/paginator/content/list.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- list.xml  1 Jul 2002 15:09:19 -0000       1.1
  +++ list.xml  1 Feb 2003 02:09:30 -0000       1.2
  @@ -1,11 +1,15 @@
  +<?xml version="1.0"?>
  +
  +<!-- CVS: $Id$ -->
  +
   <list>
  - <item>This is item 1</item>
  - <item>This is item 2</item>
  - <item>This is item 3</item>
  - <item>This is item 4</item>
  - <item>This is item 5</item>
  - <item>This is item 6</item>
  - <item>This is item 7</item>
  - <item>This is item 8</item>
  - <item>This is item 9</item>
  +  <item>This is item 1</item>
  +  <item>This is item 2</item>
  +  <item>This is item 3</item>
  +  <item>This is item 4</item>
  +  <item>This is item 5</item>
  +  <item>This is item 6</item>
  +  <item>This is item 7</item>
  +  <item>This is item 8</item>
  +  <item>This is item 9</item>
   </list>
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/webapp/samples/paginator/content/text.xml
  
  Index: text.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- CVS: $Id: text.xml,v 1.1 2003/02/01 02:09:30 vgritsenko Exp $ -->
  
  <list>
    <item>This is the paragraph number one (44 chars).</item>
    <item>This is the paragraph number two, a bit longer (58 chars).</item>
    <item>This one is third (29 chars).</item>
    <item>4th (15 chars).</item>
    <item>5th (15 chars).</item>
    <item>This is the paragraph number six.</item>
    <item>This is the paragraph number seven.</item>
    <item>This is the paragraph number eight.</item>
    <item>This is the paragraph number nine which is longer (twice) then any other 
paragraph before.</item>
    <item>This is the paragraph number ten.</item>
    <item>This is the paragraph number eleven.</item>
  </list>
  
  
  
  1.2       +7 -4      
xml-cocoon2/src/scratchpad/webapp/samples/paginator/pagesheets/list.pagesheet
  
  Index: list.pagesheet
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/paginator/pagesheets/list.pagesheet,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- list.pagesheet    1 Jul 2002 15:09:19 -0000       1.1
  +++ list.pagesheet    1 Feb 2003 02:09:30 -0000       1.2
  @@ -1,7 +1,10 @@
   <?xml version="1.0"?>
  +
  +<!-- CVS: $Id$ -->
  +
   <pagesheet xmlns="http://apache.org/cocoon/paginate/1.0";>
  - <rules>
  -  <count type="element" name="item" num="4"/>
  -  <link type="unit" num="1"/>
  - </rules>
  +  <rules>
  +    <count type="element" name="item" num="4"/>
  +    <link type="unit" num="1"/>
  +  </rules>
   </pagesheet>
  
  
  
  1.2       +9 -11     
xml-cocoon2/src/scratchpad/webapp/samples/paginator/pagesheets/pagesheet.dtd
  
  Index: pagesheet.dtd
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/paginator/pagesheets/pagesheet.dtd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- pagesheet.dtd     1 Jul 2002 15:09:19 -0000       1.1
  +++ pagesheet.dtd     1 Feb 2003 02:09:30 -0000       1.2
  @@ -1,8 +1,9 @@
  -<!-- ===================================================================
  -
  -     Pagesheet DTD (Version 0.1)
  -
  -==================================================================== -->
  +<!-- =================================================================== -->
  +<!-- CVS: $Id$     -->
  +<!--                                                                     -->
  +<!--     Pagesheet DTD (Version 0.1)                                     -->
  +<!--                                                                     -->
  +<!-- =================================================================== -->
   
   <!ELEMENT pagesheet (items?, rules)*>
   <!ATTLIST pagesheet xmlns CDATA #IMPLIED>
  @@ -30,9 +31,6 @@
      namespace CDATA #IMPLIED 
    >
   
  -<!-- =============================================================== -->
  -<!-- End of DTD -->
  -<!-- =============================================================== -->
  -
  -
  -
  +<!-- =================================================================== -->
  +<!-- End of DTD                                                          -->
  +<!-- =================================================================== -->
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/webapp/samples/paginator/pagesheets/text.pagesheet
  
  Index: text.pagesheet
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- CVS: $Id: text.pagesheet,v 1.1 2003/02/01 02:09:30 vgritsenko Exp $ -->
  
  <pagesheet xmlns="http://apache.org/cocoon/paginate/1.0";>
    <rules>
      <count type="chars" name="item" num="110"/>
      <link type="unit" num="1"/>
    </rules>
  </pagesheet>
  
  
  
  1.2       +2 -0      
xml-cocoon2/src/scratchpad/webapp/samples/paginator/stylesheets/list2html.xsl
  
  Index: list2html.xsl
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/paginator/stylesheets/list2html.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- list2html.xsl     1 Jul 2002 15:09:20 -0000       1.1
  +++ list2html.xsl     1 Feb 2003 02:09:30 -0000       1.2
  @@ -1,5 +1,7 @@
   <?xml version="1.0"?>
   
  +<!-- CVS: $Id$ -->
  +
   <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
   
     <xsl:template match="/">
  
  
  
  1.2       +2 -2      
xml-cocoon2/src/scratchpad/webapp/samples/paginator/stylesheets/pagedlist2html.xsl
  
  Index: pagedlist2html.xsl
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/paginator/stylesheets/pagedlist2html.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- pagedlist2html.xsl        1 Jul 2002 15:09:20 -0000       1.1
  +++ pagedlist2html.xsl        1 Feb 2003 02:09:31 -0000       1.2
  @@ -1,5 +1,7 @@
   <?xml version="1.0"?>
   
  +<!-- CVS: $Id$ -->
  +
   <!DOCTYPE xsl:stylesheet [
    <!ENTITY laquo "&#xAB;" >
    <!ENTITY raquo "&#xBB;" >
  @@ -64,8 +66,6 @@
   
          </tr>
         </table>
  -
      </xsl:if>
     </xsl:template>
  -  
   </xsl:stylesheet>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to