Package org.apache.maven.doxia.document

Examples of org.apache.maven.doxia.document.DocumentTOC


            || this.tocPosition == TOC_NONE )
        {
            return;
        }

        DocumentTOC toc = docModel.getToc();

        writeln( "<fo:page-sequence master-reference=\"toc\" initial-page-number=\"1\" format=\"i\">" );
        regionBefore( toc.getName() );
        regionAfter( getFooterText() );
        writeStartTag( FLOW_TAG, "flow-name", "xsl-region-body" );
        writeStartTag( BLOCK_TAG, "id", "./toc" );
        chapterHeading( toc.getName(), false );
        writeln( "<fo:table table-layout=\"fixed\" width=\"100%\" >" );
        writeEmptyTag( TABLE_COLUMN_TAG, "column-width", "0.45in" );
        writeEmptyTag( TABLE_COLUMN_TAG, "column-width", "0.4in" );
        writeEmptyTag( TABLE_COLUMN_TAG, "column-width", "0.4in" );
        writeEmptyTag( TABLE_COLUMN_TAG, "column-width", "5in" ); // TODO {$maxBodyWidth - 1.25}in
        writeStartTag( TABLE_BODY_TAG );

        writeTocItems( toc.getItems(), 1 );

        writeEndTag( TABLE_BODY_TAG );
        writeEndTag( TABLE_TAG );
        writeEndTag( BLOCK_TAG );
        writeEndTag( FLOW_TAG );
View Full Code Here


        DocumentTOCItem item2 = new DocumentTOCItem();
        item2.setName( "Second document" );
        item2.setRef( "doc2.xml" );

        DocumentTOC toc = new DocumentTOC();
        toc.setName( "What's in here" );
        toc.addItem( item1 );
        toc.addItem( item2 );

        return toc;
    }
View Full Code Here

     * @param decorationModel a DecorationModel. May be null.
     * @return a DocumentTOC, always non-null.
     */
    private static DocumentTOC getDocumentTOC( DecorationModel decorationModel )
    {
        final DocumentTOC toc = new DocumentTOC();

        if ( decorationModel != null && decorationModel.getMenus() != null )
        {
            for ( final Iterator it = decorationModel.getMenus().iterator(); it.hasNext(); )
            {
                final Menu menu = (Menu) it.next();

                for ( final Iterator it2 = menu.getItems().iterator(); it2.hasNext(); )
                {
                    final MenuItem item = (MenuItem) it2.next();

                    final DocumentTOCItem documentTOCItem = new DocumentTOCItem();
                    documentTOCItem.setName( item.getName() );
                    documentTOCItem.setRef( item.getHref() );
                    toc.addItem( documentTOCItem );
                }
            }
        }

        return toc;
View Full Code Here

     * @param decorationModel a DecorationModel. May be null.
     * @return a DocumentTOC, always non-null.
     */
    private static DocumentTOC getDocumentTOC( DecorationModel decorationModel )
    {
        final DocumentTOC toc = new DocumentTOC();

        if ( decorationModel != null && decorationModel.getMenus() != null )
        {
            for ( final Iterator it = decorationModel.getMenus().iterator(); it.hasNext(); )
            {
                final Menu menu = (Menu) it.next();

                for ( final Iterator it2 = menu.getItems().iterator(); it2.hasNext(); )
                {
                    final MenuItem item = (MenuItem) it2.next();

                    final DocumentTOCItem documentTOCItem = new DocumentTOCItem();
                    documentTOCItem.setName( item.getName() );
                    documentTOCItem.setRef( item.getHref() );
                    toc.addItem( documentTOCItem );
                }
            }
        }

        return toc;
View Full Code Here

        assertEquals( 2, meta.getAuthors().size() );
        assertFirstDocumentAuthor( (DocumentAuthor) meta.getAuthors().get( 0 ) );
        assertEquals( "Test Name", meta.getSubject() );
        assertEquals( "Test Name", meta.getTitle() );

        DocumentTOC toc = model.getToc();
        assertEquals( 0, toc.getItems().size() );
    }
View Full Code Here

        File descriptorFile = new File( testBaseDir() + "src/site/", "model_builder_site.xml" );
        DecorationModel dModel = getDecorationModelFromFile( descriptorFile );
        DocumentModel model =
                new DocumentModelBuilder( new ModelBuilderMavenProjectStub(), dModel ).getDocumentModel();

        DocumentTOC toc = model.getToc();
        assertEquals( 1, toc.getItems().size() );
        assertEquals( "Intro", ( (DocumentTOCItem) toc.getItems().get( 0 ) ).getName() );
        assertEquals( "index.html", ( (DocumentTOCItem) toc.getItems().get( 0 ) ).getRef() );
    }
View Full Code Here

        DocumentTOCItem item2 = new DocumentTOCItem();
        item2.setName( "Second document" );
        item2.setRef( "doc2.xml" );

        DocumentTOC toc = new DocumentTOC();
        toc.setName( "What's in here" );
        toc.addItem( item1 );
        toc.addItem( item2 );

        return toc;
    }
View Full Code Here

        File descriptorFile = new File( testBaseDir() + "src/site/", "model_builder_site.xml" );
        DecorationModel dModel = getDecorationModelFromFile( descriptorFile );
        DocumentModel model =
                new DocumentModelBuilder( new ModelBuilderMavenProjectStub(), dModel ).getDocumentModel();

        DocumentTOC toc = model.getToc();
        assertEquals( 1, toc.getItems().size() );
        assertEquals( "Intro", toc.getItems().get( 0 ).getName() );
        assertEquals( "index.html", toc.getItems().get( 0 ).getRef() );
    }
View Full Code Here

     * @param decorationModel a DecorationModel. May be null.
     * @return a DocumentTOC, always non-null.
     */
    private static DocumentTOC getDocumentTOC( DecorationModel decorationModel )
    {
        final DocumentTOC toc = new DocumentTOC();

        if ( decorationModel != null && decorationModel.getMenus() != null )
        {
            for ( final Menu menu  : decorationModel.getMenus() )
            {
                for ( final MenuItem item : menu.getItems() )
                {
                    final DocumentTOCItem documentTOCItem = new DocumentTOCItem();
                    documentTOCItem.setName( item.getName() );
                    documentTOCItem.setRef( item.getHref() );
                    toc.addItem( documentTOCItem );
                }
            }
        }

        return toc;
View Full Code Here

        assertEquals( 2, meta.getAuthors().size() );
        assertFirstDocumentAuthor(meta.getAuthors().get( 0 ));
        assertEquals( "Test Name", meta.getSubject() );
        assertEquals( "Test Name", meta.getTitle() );

        DocumentTOC toc = model.getToc();
        assertEquals( 0, toc.getItems().size() );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.doxia.document.DocumentTOC

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.