CVS: jfor/src/org/jfor/jfor/converter PageNumberCitationBuilder.java,NONE,1.1

Marra Roberto <[email protected]> Mon, 29 Jul 2002 06:48:33 -0700
Newsgroups gmane.text.xml.jfor.cvs
Message-ID <[email protected]>
Update of /cvsroot/jfor/jfor/src/org/jfor/jfor/converter
In directory usw-pr-cvs1:/tmp/cvs-serv3440

Added Files:
	PageNumberCitationBuilder.java 
Log Message:
initial check-in M.Boris Poudérous contribution

--- NEW FILE: PageNumberCitationBuilder.java ---
package org.jfor.jfor.converter;

import java.io.IOException;
import org.xml.sax.Attributes;
import org.jfor.jfor.rtflib.rtfdoc.*;

/*-----------------------------------------------------------------------------
 * jfor - Open-Source XSL-FO to RTF converter - see www.jfor.org
 *
 * The contents of this file are subject to the Mozilla Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is the contents of this java source file, as distributed
 * on www.sourceforge.net/projects/jfor and/or www.jfor.org.
 *
 * The Initial Developer of the Original Code is Bertrand Delacrétaz,
 * codeconsult, Cugy/Lausanne, Switzerland [email protected].
 * Portions created by Bertrand Delacrétaz are Copyright (C) 2001 codeconsult,
 * Bertrand Delacrétaz. All Rights Reserved.
 *
 * Contributor(s):
 * Christopher Scott, [email protected]
 * Portions created by Christopher Scott are Coypright (C) 2001
 * Westinghouse Electric Company. All Rights Reserved.
 *
 * Boris Poudérous, [email protected]
 * Portions created by Boris Poudérous are Coypright (C) 2002
 * All Rights Reserved.
-----------------------------------------------------------------------------*/

class PageNumberCitationBuilder extends AbstractBuilder
{
    private RtfPageNumberCitation m_pageNumberCitation;
    private RtfAttributes m_attributes;

    PageNumberCitationBuilder(BuilderContext ctx)
    {
        super(ctx);
    }

    /** called by Converter at the start of an element */
    public void start(String rawName, Attributes attrs) throws IOException
    {
       IRtfPageNumberCitationContainer pageNumberCitationContainer = (IRtfPageNumberCitationContainer)
       m_context.getContainer(IRtfPageNumberCitationContainer.class,true,this);

       // Get the 'ref-id' attribute value
       String attrValue = null;
       if (AbstractBuilder.attributeIsSet(attrs,"ref-id"))
         attrValue = new String(attrs.getValue("ref-id"));
       else
         super.m_context.log.logWarning("The element <fo:page-number-citation/> must have a 'ref-id' attribute");

       m_pageNumberCitation = pageNumberCitationContainer.newPageNumberCitation(attrValue);
       m_context.pushContainer(m_pageNumberCitation);
    }

    /** called by Converter at the end of an element */
    public void end() {
        m_context.popContainer();
    }

    /** this builder applies to fo:root */
    public IBuilder getBuilder(BuilderContext ctx,String rawName, Attributes atts)
    {
       if(rawName.equals("fo:page-number-citation")) return new PageNumberCitationBuilder(ctx);
       else return null;
    }
}



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31