Package org.apache.maven.doxia.site.decoration

Examples of org.apache.maven.doxia.site.decoration.Menu


        sink.text( i18n.getString( "site-plugin", locale, "site.sitemap.description" ) );
        sink.paragraph_();

        for ( Iterator it = decoration.getMenus().iterator(); it.hasNext(); )
        {
            Menu menu = (Menu) it.next();

            sink.section3();
            sink.sectionTitle3();
            sink.text( menu.getName() );
            sink.sectionTitle3_();
            sink.horizontalRule();

            extractItems( menu.getItems(), sink );

            sink.section3_();
        }

        sink.section1_();
View Full Code Here


    protected void populateReportItems( DecorationModel decorationModel, Locale locale, Map reportsByOutputName )
    {
        for ( Iterator i = decorationModel.getMenus().iterator(); i.hasNext(); )
        {
            Menu menu = (Menu) i.next();

            populateItemRefs( menu.getItems(), locale, reportsByOutputName );
        }
    }
View Full Code Here

        if ( categories == null )
        {
            throw new IllegalArgumentException( "The parameter 'categories' can not be null" );
        }

        Menu menu = decorationModel.getMenuRef( "reports" );

        if ( menu == null )
        {
            return;
        }

        final Locale llocale = ( locale == null ) ? Locale.getDefault() : locale;

        if ( menu.getName() == null )
        {
            menu.setName( i18n.getString( "site-tool", llocale, "decorationModel.menu.projectdocumentation" ) );
        }

        boolean found = false;
        if ( menu.getItems().isEmpty() )
        {
            List<MavenReport> categoryReports = categories.get( MavenReport.CATEGORY_PROJECT_INFORMATION );
            if ( !isEmptyList( categoryReports ) )
            {
                MenuItem item =
                    createCategoryMenu( i18n.getString( "site-tool", llocale, "decorationModel.menu.projectinformation" ),
                                        "/project-info.html", categoryReports, llocale );
                menu.getItems().add( item );
                found = true;
            }

            categoryReports = categories.get( MavenReport.CATEGORY_PROJECT_REPORTS );
            if ( !isEmptyList( categoryReports ) )
            {
                MenuItem item =
                    createCategoryMenu( i18n.getString( "site-tool", llocale, "decorationModel.menu.projectreports" ),
                                        "/project-reports.html", categoryReports, llocale );
                menu.getItems().add( item );
                found = true;
            }
        }
        if ( !found )
        {
View Full Code Here

        if ( parentProject == null )
        {
            throw new IllegalArgumentException( "The parameter 'parentProject' can not be null" );
        }

        Menu menu = decorationModel.getMenuRef( "parent" );

        if ( menu == null )
        {
            return;
        }

        if ( keepInheritedRefs && menu.isInheritAsRef() )
        {
            return;
        }

        final Locale llocale = ( locale == null ) ? Locale.getDefault() : locale;

        String parentUrl = getDistMgmntSiteUrl( parentProject );

        if ( parentUrl != null )
        {
            if ( parentUrl.endsWith( "/" ) )
            {
                parentUrl += "index.html";
            }
            else
            {
                parentUrl += "/index.html";
            }

            parentUrl = getRelativePath( parentUrl, getDistMgmntSiteUrl( project ) );
        }
        else
        {
            // parent has no url, assume relative path is given by site structure
            File parentBasedir = parentProject.getBasedir();
            // First make sure that the parent is available on the file system
            if ( parentBasedir != null )
            {
                // Try to find the relative path to the parent via the file system
                String parentPath = parentBasedir.getAbsolutePath();
                String projectPath = project.getBasedir().getAbsolutePath();
                parentUrl = getRelativePath( parentPath, projectPath ) + "/index.html";
            }
        }

        // Only add the parent menu if we were able to find a URL for it
        if ( parentUrl == null )
        {
            getLogger().warn( "Unable to find a URL to the parent project. The parent menu will NOT be added." );
        }
        else
        {
            if ( menu.getName() == null )
            {
                menu.setName( i18n.getString( "site-tool", llocale, "decorationModel.menu.parentproject" ) );
            }

            MenuItem item = new MenuItem();
            item.setName( parentProject.getName() );
            item.setHref( parentUrl );
            menu.addItem( item );
        }
    }
View Full Code Here

        if ( decorationModel == null )
        {
            throw new IllegalArgumentException( "The parameter 'decorationModel' can not be null" );
        }

        Menu menu = decorationModel.getMenuRef( "modules" );

        if ( menu == null )
        {
            return;
        }

        if ( keepInheritedRefs && menu.isInheritAsRef() )
        {
            return;
        }

        final Locale llocale = ( locale == null ) ? Locale.getDefault() : locale ;

        // we require child modules and reactors to process module menu
        if ( project.getModules().size() > 0 )
        {
            List<MavenProject> projects = reactorProjects;

            if ( menu.getName() == null )
            {
                menu.setName( i18n.getString( "site-tool", llocale, "decorationModel.menu.projectmodules" ) );
            }

            getLogger().debug( "Attempting to load module information from local filesystem" );

            // Not running reactor - search for the projects manually
View Full Code Here

        int topCounter = 0;
        for ( Menu menu : parentMenus )
        {
            if ( "top".equals( menu.getInherit() ) )
            {
                final Menu clone = menu.clone();

                rebaseMenuPaths( clone.getItems(), urlContainer );

                menus.add( topCounter, clone );
                topCounter++;
            }
            else if ( "bottom".equals( menu.getInherit() ) )
            {
                final Menu clone = menu.clone();

                rebaseMenuPaths( clone.getItems(), urlContainer );

                menus.add( clone );
            }
        }
View Full Code Here

        assertEquals( "check breadcrumb href", "http://www.apache.org/", breadcrumb.getHref() );

        LinkItem link = childModel.getBody().getLinks().get( 0 );
        assertEquals( "check link href", "http://www.bouncycastle.org", link.getHref() );

        Menu menu = childModel.getBody().getMenus().get( 0 );
        LinkItem menuItem = menu.getItems().get( 0 );
        assertEquals( "check menu item href", "http://www.apache.org/special/", menuItem.getHref() );
    }
View Full Code Here

        assertEquals( "check breadcrumb href", "../apache", breadcrumb.getHref() );

        LinkItem link = childModel.getBody().getLinks().get( 0 );
        assertEquals( "check link href", "../bouncycastle/", link.getHref() );

        Menu menu = childModel.getBody().getMenus().get( 0 );
        LinkItem menuItem = menu.getItems().get( 0 );
        assertEquals( "check menu item href", "../special/", menuItem.getHref() );
    }
View Full Code Here

        assertEquals( "check breadcrumb href", "../apache", breadcrumb.getHref() );

        LinkItem link = childModel.getBody().getLinks().get( 0 );
        assertEquals( "check link href", "../bouncycastle/", link.getHref() );

        Menu menu = childModel.getBody().getMenus().get( 0 );
        LinkItem menuItem = menu.getItems().get( 0 );
        assertEquals( "check menu item href", "../special/", menuItem.getHref() );
    }
View Full Code Here

        assertEquals( "check breadcrumb href", "../../apache", breadcrumb.getHref() );

        LinkItem link = childModel.getBody().getLinks().get( 0 );
        assertEquals( "check link href", "../../bouncycastle/", link.getHref() );

        Menu menu = childModel.getBody().getMenus().get( 0 );
        LinkItem menuItem = menu.getItems().get( 0 );
        assertEquals( "check menu item href", "../../special/", menuItem.getHref() );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.doxia.site.decoration.Menu

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.