private void createNavigationInternal(StringBuffer buffer, List<CmsJspNavElement> navElements) {

        // take the element to render.
        CmsJspNavElement element = navElements.remove(0);
        int elementLevel = element.getNavTreeLevel();
        String spacing = getSpaces(elementLevel * 2);
        // render element:
        buffer.append(spacing).append("<li>\n");
        buffer.append(spacing).append("  <a href=\"");
        buffer.append(m_jsp.link(element.getResourceName()));
        buffer.append("\" title=\"");
        buffer.append(element.getNavText());
        buffer.append("\"");
        if (elementLevel == 1) {
            buffer.append(" class=\"bold\"");
        }
        buffer.append(">");
        buffer.append(element.getNavText());
        buffer.append("</a>\n");

        // peek at the next (list is depth - first by contract)
        if (!navElements.isEmpty()) {
            CmsJspNavElement child = navElements.get(0);
            int childLevel = child.getNavTreeLevel();
            if (elementLevel < childLevel) {
                // next one goes down a level: it is a child by tree means
                buffer.append(spacing).append("  <ul>\n");
            } else if (elementLevel == childLevel) {
                // it is a sibling: close our list item, no recursion
                buffer.append(spacing).append("</li>\n");
            } else {
                // next element gets up one layer
                // this has to happen because of the depth-first contract!
                buffer.append(spacing).append("  </li>\n").append(spacing).append("</ul>\n");
            }
            createNavigationInternal(buffer, navElements);
        } else {
            // no more next elements: get back and close all lists (by using the recursion we are in)
            buffer.append(spacing).append("  </li>\n").append(spacing).append("</ul>\n");
        }

    }
private void createNavigationInternal ( StringBuffer buffer , List < CmsJspNavElement > navElements ) { CmsJspNavElement element = navElements . remove ( 0 ) ; int elementLevel = element . getNavTreeLevel ( ) ; String spacing = getSpaces ( elementLevel * 2 ) ; buffer . append ( spacing ) . append ( "<li>\n" ) ; buffer . append ( spacing ) . append ( "  <a href=\"" ) ; buffer . append ( m_jsp . link ( element . getResourceName ( ) ) ) ; buffer . append ( "\" title=\"" ) ; buffer . append ( element . getNavText ( ) ) ; buffer . append ( "\"" ) ; if ( elementLevel == 1 ) { buffer . append ( " class=\"bold\"" ) ; } buffer . append ( ">" ) ; buffer . append ( element . getNavText ( ) ) ; buffer . append ( "</a>\n" ) ; if ( ! navElements . isEmpty ( ) ) { CmsJspNavElement child = navElements . get ( 0 ) ; int childLevel = child . getNavTreeLevel ( ) ; if ( elementLevel < childLevel ) { buffer . append ( spacing ) . append ( "  <ul>\n" ) ; } else if ( elementLevel == childLevel ) { buffer . append ( spacing ) . append ( "</li>\n" ) ; } else { buffer . append ( spacing ) . append ( "  </li>\n" ) . append ( spacing ) . append ( "</ul>\n" ) ; } createNavigationInternal ( buffer , navElements ) ; } else { buffer . append ( spacing ) . append ( "  </li>\n" ) . append ( spacing ) . append ( "</ul>\n" ) ; } }
Creates the HTML for the internal help.<p>

@param buffer the StringBuffer to which the Navigation will be appended
@param navElements the navigation elements to build the navigation for