public void createRecursiveNavigation(final TreeItem pitem,
      final List<NavigationEntryInterface> plist, final NavigationEntryInterface pactiveEntry) {
    for (final NavigationEntryInterface navEntry : plist) {
      final TreeItem newItem;
      if (navEntry instanceof NavigationEntryFolder) {
        newItem = new TreeItem(navEntry.getMenuValue());
        createRecursiveNavigation(newItem, ((NavigationEntryFolder) navEntry).getSubEntries(),
            pactiveEntry);
        newItem.setState(navEntry.isOpenOnStartup());
      } else if (navEntry instanceof NavigationLink) {
        final Anchor link = ((NavigationLink) navEntry).getAnchor();
        link.setStylePrimaryName(resources.navigationStyle().link());
        newItem = new TreeItem(link);
      } else if (navEntry.getToken() == null) {
        newItem = null;
      } else {
        final InlineHyperlink entryPoint = GWT.create(InlineHyperlink.class);
        entryPoint.setHTML(navEntry.getMenuValue());
        entryPoint.setTargetHistoryToken(navEntry.getFullToken());
        entryPoint.setStylePrimaryName(resources.navigationStyle().link());
        newItem = new TreeItem(entryPoint);
        navigationMap.put(newItem, navEntry);
      }
      if (newItem != null) {
        pitem.addItem(newItem);
        if (pactiveEntry != null && pactiveEntry.equals(navEntry)) {
          selectedItem = newItem;
          selectedItem.setSelected(true);
        }
      }
    }
  }
public void createRecursiveNavigation ( final TreeItem pitem , final List < NavigationEntryInterface > plist , final NavigationEntryInterface pactiveEntry ) { for ( final NavigationEntryInterface navEntry : plist ) { final TreeItem newItem ; if ( navEntry instanceof NavigationEntryFolder ) { newItem = new TreeItem ( navEntry . getMenuValue ( ) ) ; createRecursiveNavigation ( newItem , ( ( NavigationEntryFolder ) navEntry ) . getSubEntries ( ) , pactiveEntry ) ; newItem . setState ( navEntry . isOpenOnStartup ( ) ) ; } else if ( navEntry instanceof NavigationLink ) { final Anchor link = ( ( NavigationLink ) navEntry ) . getAnchor ( ) ; link . setStylePrimaryName ( resources . navigationStyle ( ) . link ( ) ) ; newItem = new TreeItem ( link ) ; } else if ( navEntry . getToken ( ) == null ) { newItem = null ; } else { final InlineHyperlink entryPoint = GWT . create ( InlineHyperlink . class ) ; entryPoint . setHTML ( navEntry . getMenuValue ( ) ) ; entryPoint . setTargetHistoryToken ( navEntry . getFullToken ( ) ) ; entryPoint . setStylePrimaryName ( resources . navigationStyle ( ) . link ( ) ) ; newItem = new TreeItem ( entryPoint ) ; navigationMap . put ( newItem , navEntry ) ; } if ( newItem != null ) { pitem . addItem ( newItem ) ; if ( pactiveEntry != null && pactiveEntry . equals ( navEntry ) ) { selectedItem = newItem ; selectedItem . setSelected ( true ) ; } } } }
create navigation in a recursive way.

@param pitem the item to add new items
@param plist the list of the navigation entries
@param pactiveEntry the active entry