1 16 19 20 package org.apache.pluto.portalImpl.aggregation.navigation; 21 22 import java.util.ArrayList ; 23 import java.util.Iterator ; 24 import java.util.List ; 25 26 import javax.servlet.ServletConfig ; 27 28 import org.apache.pluto.portalImpl.core.PortalURL; 29 30 public class TabNavigation extends AbstractNavigationFragment { 31 32 public TabNavigation(String id, 33 ServletConfig config, 34 org.apache.pluto.portalImpl.aggregation.Fragment parent, 35 org.apache.pluto.portalImpl.om.page.Fragment fragDesc, 36 org.apache.pluto.portalImpl.aggregation.navigation.Navigation navigation) 37 throws Exception 38 { 39 super(id, config, parent, fragDesc, navigation); 40 } 41 42 public NavigationTreeBean[] getNavigationView(PortalURL url) { 43 List result = new ArrayList (); 44 for (Iterator it = getRootNavigation().getChildren().iterator(); it.hasNext();) { 45 Navigation child = (Navigation) it.next(); 46 walkTree(child, url , result, 0); 47 } 48 return(NavigationTreeBean[]) result.toArray(new NavigationTreeBean[0]); 49 } 50 51 private static void walkTree(Navigation nav, PortalURL url, List path, int depth) 52 { 53 if (url.isPartOfGlobalNavigation(nav.getLinkedFragment().getId())) { 54 path.add(new NavigationTreeBean(nav, true, depth)); 55 for (Iterator it = nav.getChildren().iterator(); it.hasNext();) { 56 Navigation child = (Navigation) it.next(); 57 walkTree(child, url, path, depth+1); 58 } 59 } else { 60 path.add(new NavigationTreeBean(nav, false, depth)); 61 } 62 } 63 64 65 } 66 | Popular Tags |