alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Jetty example source code file (maven-site.vm)

This example Jetty source code file (maven-site.vm) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Jetty tags/keywords

by, by, content-type, doctype, maven, maven, public, transitional//en, transitional//en, ua-1149868-3, version, version, w3c//dtd, xhtml

The Jetty maven-site.vm source code

#macro ( banner $id )
  #if ( $siteDescriptor.getChild( $id ) )
    #set ( $e = $siteDescriptor.getChild( $id ) )
    #if( $e.getChild( "href" ) )
        #set ( $link = $e.getChild( "href" ).getValue() )
        <a href="$link" id="$id">
    #else
        <span id="$id">
    #end

    #if( $e.getChild( "src" ) )
        #set ( $src = $e.getChild( "src" ).getValue() )
        #if ( ! ( $src.toLowerCase().startsWith("http") || $src.toLowerCase().startsWith("https") ) )
            #set ( $src = $PathTool.calculateLink( $src, $relativePath ) )
            #set ( $src = $src.replaceAll( "\\", "/" ) )
        #end
        #if ( $e.getChild( "alt" ) )
            #set ( $alt = $e.getChild( "alt" ).getValue() )
        #else
            #set ( $alt = "" )
        #end
        <img src="$src" alt="$alt" />
    #else
        $e.getChild( "name" ).getValue()
    #end

    #if( $e.getChild( "href" ) )
        </a>
    #else
        </span>
    #end
  #end
#end

#macro ( links )
  #set ( $counter = 0 )
  #set ( $links = $siteDescriptor.getChild( "body" ).getChild( "links" ) )
  #foreach( $item in $links.getChildren() )
    #set ( $counter = $counter + 1 )
    <a href="$item.getAttribute( "href" )">$item.getAttribute( "name" )
    #if ( $links.getChildCount() > $counter )
      |
    #end
  #end
#end

#macro ( displayTree $display $item )
  #if ( $item && $item.getChildren() && $item.getChildCount() > 0 )
    #foreach( $subitem in $item.getChildren() )
      #set ( $subitemHref = $PathTool.calculateLink( $subitem.getAttribute( "href" ), $relativePath ) )
      #set ( $subitemHref = $subitemHref.replaceAll( "\\", "/" ) )

      #if ( $currentFileName == $subitemHref )
        #set ( $display = true )
      #end

      #displayTree( $display $subitem )
    #end
  #end
#end

#macro ( menuItem $item )
  #set ( $collapse = "none" )
  #set ( $currentItemHref = $PathTool.calculateLink( $item.getAttribute( "href" ), $relativePath ) )
  #set ( $currentFileName = $currentFileName.replaceAll( "\\", "/" ) )
  #set ( $currentItemHref = $currentItemHref.replaceAll( "\\", "/" ) )

  #if ( $item && $item.getChildCount() > 0 )
    #if ( ( $item.getAttribute( "collapse" ) ) && ( $item.getAttribute( "collapse" ).equalsIgnoreCase( "false" ) ) )
      #set ( $collapse = "expanded" )
    #else
      ## By default collapsed
      #set ( $collapse = "collapsed" )
    #end

    #if ( $currentFileName == $currentItemHref )
      #set ( $collapse = "expanded" )
    #end
  #end
  <li class="$collapse">
    #if ( $currentFileName == $currentItemHref )
      <strong>$item.getAttribute( "name" )
    #else
      <a href="$currentItemHref">$item.getAttribute( "name" )
    #end
  #if ( $item && $item.getChildren() && $item.getChildCount() > 0 )
    #set ( $display = false )
    #set ( $itemTmp = $item )
    #displayTree( $display $itemTmp )

    #if ( $collapse == "expanded" || $display )
      <ul>
        #foreach( $subitem in $item.getChildren() )
          #menuItem( $subitem )
        #end
      </ul>
    #end
  #end
  </li>
#end

#macro ( mainMenu )
  #set ( $menus = $siteDescriptor.getChild( "body" ).getChildren( "menu" ) )
  #foreach( $menu in $menus )
    <h5>$menu.getAttribute( "name" )
    <ul>
      #foreach( $item in $menu.getChildren() )
        #menuItem( $item )
      #end
    </ul>
  #end
#end

#macro ( copyright )
  #if ( $project )
    #set ( $currentYear = ${currentDate.year} + 1900 )

    #if ( ${project.inceptionYear} && ( ${project.inceptionYear} != ${currentYear.toString()} ) )
      ${project.inceptionYear}-${currentYear}
    #else
      ${currentYear}
    #end

    #if ( ${project.organization} && ${project.organization.name} )
      ${project.organization.name}
    #end
  #end
#end

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>$title
    <style type="text/css" media="all">
      @import url("$relativePath/css/maven-base.css");
      @import url("$relativePath/css/maven-theme.css");
      @import url("$relativePath/css/site.css");
    </style>
    <link rel="stylesheet" href="$relativePath/css/print.css" type="text/css" media="print" />
    #foreach( $author in $authors )
      <meta name="author" content="$author" />
    #end
    <meta http-equiv="Content-Type" content="text/html; charset=${outputEncoding}" />
  </head>
  <body class="composite">
    <div id="banner">
      #set ( $banner = "bannerLeft" )
      #banner( $banner )
      #set ( $banner = "bannerRight" )
      #banner( $banner )
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
      <div class="xleft">Version: ${project.version}  $i18n.getString( "site-plugin", $locale, "template.lastpublished" ): $currentDate
<div class="xright">#links() <div class="clear"> <hr/> </div> </div> <div id="leftColumn"> <div id="bodyColumn"> <div id="contentBox"> $bodyContent </div> </div> <div class="clear"> <hr/> </div> <div id="footer"> <div class="xright">©#copyright() <div class="clear"> <hr/> </div> </div> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> <script type="text/javascript"> _uacct = "UA-1149868-3"; urchinTracker(); </body> </html>

Other Jetty examples (source code examples)

Here is a short list of links related to this Jetty maven-site.vm source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.