Package org.apache.pluto.portalImpl.aggregation.navigation

Examples of org.apache.pluto.portalImpl.aggregation.navigation.Navigation


    // Aaron's code -- to force the navigation tree to render fully expanded, and not offer links to non-leaf nodes
    //                 todo this is pretty bad and should be replaced by a subclass of TabNavigation
    //                 see http://svn.apache.org/repos/asf/portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/aggregation/navigation/
    java.util.List list = new java.util.ArrayList();
    java.util.Stack stack = new java.util.Stack();
    Navigation root = fragment.getRootNavigation();
    java.util.List childList = (java.util.List)root.getChildren();
    java.util.Map map = new java.util.HashMap();
    for(int i=childList.size()-1; i>=0; i--) {
        stack.push(childList.get(i));
        map.put(stack.peek(), new Integer(0));
    }
    while(!stack.isEmpty()) {
        Navigation nav = (Navigation) stack.pop();
        Integer depth = (Integer) map.get(nav);
        list.add(new NavigationTreeBean(nav, nav.getChildren().size() > 0 || url.isPartOfGlobalNavigation(nav.getLinkedFragment().getId()), depth.intValue()));
        childList = (java.util.List)nav.getChildren();
        for(int i=childList.size()-1; i>=0; i--) {
            stack.push(childList.get(i));
            map.put(stack.peek(), new Integer(depth.intValue()+1));
        }
    }
    tree = (NavigationTreeBean[]) list.toArray(new NavigationTreeBean[list.size()]);
    // End Aaron's Code

    for (int i=0; i<tree.length; i++) {
            Navigation nav = tree[i].navigation;
            String imageName = nav.getDescription();
            int index = imageName.indexOf(" ");
            if ((index == -1) || !imageName.substring(index-4, index).equals(GIF)) {
               imageName = DEFAULT_GIF;
            } else {
               imageName = imageName.substring(0,index);
            }

            boolean partOfNav = tree[i].partOfGlobalNav;

            if (tree[i].depth>0)
            {

      out.write("\n\t\t\t\t\t\t\t\t<tr><td><div class=\"Subselection\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\"> \n                <tr>\n                  <td class=\"Left\">&nbsp;</td> \n                  <td class=\"Indent\">&nbsp;</td> \n                  <td class=\"Middle\">\n");

              for (int k=0; k<tree[i].depth; k++)
              {

      out.write("\n  \t\t\t\t\t\t\t&nbsp;&nbsp;&nbsp;\n");

              }
                if (!partOfNav)
                {

      out.write("\n                    <a href=\"");
      out.print(new PortalURL(request, nav.getLinkedFragment()).toString());
      out.write("\"><img border=\"0\" src=\"");
      out.print(request.getContextPath());
      out.write("/images/");
      out.print(imageName);
      out.write("\">&nbsp;");
      out.print(nav.getTitle());
      out.write("</a>\n");

                }
                else
                {

      out.write("                  <img border=\"0\" src=\"");
      out.print(request.getContextPath());
      out.write("/images/");
      out.print(imageName);
      out.write("\">&nbsp;");
      out.print(nav.getTitle());
      out.write('\n');

                }

      out.write("\n                  </td> \n                  <td class=\"Right\">&nbsp;</td> \n                </tr> \n\t\t\t\t\t\t\t\t</table></div></td></tr>\n");

            }
            else
            {

      out.write("\t\t\t\t\t\t\n\t\t\n  \t\t\t\t\t\t<tr><td><div class=\"Selection\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">\n              <tr>\n\t\t\t\t\t\t\t  <td class=\"CollapsedLeft\">&nbsp;</td>\n\t\t\t\t\t\t\t\t<td class=\"Indent\">&nbsp;</td>\n\t\t\t\t\t\t\t  <td class=\"TopMiddle\">\n");

                if (!partOfNav)
                {

      out.write("                  <a href=\"");
      out.print(new PortalURL(request, nav.getLinkedFragment()).toString());
      out.write("\"><img border=\"0\" src=\"");
      out.print(request.getContextPath());
      out.write("/images/");
      out.print(imageName);
      out.write("\">&nbsp;");
      out.print(nav.getTitle());
      out.write("</a>\n");

                }
                else
                {

      out.write("                  <img border=\"0\" src=\"");
      out.print(request.getContextPath());
      out.write("/images/");
      out.print(imageName);
      out.write("\">&nbsp;");
      out.print(nav.getTitle());
      out.write('\n');

                }

      out.write("\n \t\t\t\t\t\t\t      \n\t \t\t\t\t\t\t  </td>\n                <td class=\"CollapsedRight\">&nbsp;</td> \n              </tr>\n\t\t\t\t\t\t</table></div></td></tr>\n");
View Full Code Here


    // Aaron's code -- to force the navigation tree to render fully expanded, and not offer links to non-leaf nodes
    //                 todo this is pretty bad and should be replaced by a subclass of TabNavigation
    //                 see http://svn.apache.org/repos/asf/portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/aggregation/navigation/
    java.util.List list = new java.util.ArrayList();
    java.util.Stack stack = new java.util.Stack();
    Navigation root = fragment.getRootNavigation();
    java.util.List childList = (java.util.List)root.getChildren();
    java.util.Map map = new java.util.HashMap();
    for(int i=childList.size()-1; i>=0; i--) {
        stack.push(childList.get(i));
        map.put(stack.peek(), new Integer(0));
    }
    while(!stack.isEmpty()) {
        Navigation nav = (Navigation) stack.pop();
        Integer depth = (Integer) map.get(nav);
        list.add(new NavigationTreeBean(nav, nav.getChildren().size() > 0 || url.isPartOfGlobalNavigation(nav.getLinkedFragment().getId()), depth.intValue()));
        childList = (java.util.List)nav.getChildren();
        for(int i=childList.size()-1; i>=0; i--) {
            stack.push(childList.get(i));
            map.put(stack.peek(), new Integer(depth.intValue()+1));
        }
    }
    tree = (NavigationTreeBean[]) list.toArray(new NavigationTreeBean[list.size()]);
    // End Aaron's Code

    for (int i=0; i<tree.length; i++) {

      out.write('\n');

            Navigation nav = tree[i].navigation;
            boolean partOfNav = tree[i].partOfGlobalNav;

            if (tree[i].depth>0)
            {

      out.write("\n\t\t\t\t\t\t\t\t<tr><td><div class=\"Subselection\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\"> \n                <tr>\n                  <td class=\"Left\">&nbsp;</td> \n                  <td class=\"Indent\">&nbsp;</td> \n                  <td class=\"Middle\">\n");

              for (int k=0; k<tree[i].depth; k++)
              {

      out.write("\n  \t\t\t\t\t\t\t&nbsp;&nbsp;&nbsp;\n");

              }
                if (!partOfNav)
                {

      out.write("\n                    <a href=\"");
      out.print(new PortalURL(request, nav.getLinkedFragment()).toString());
      out.write('"');
      out.write('>');
      out.print(nav.getTitle());
      out.write("</a>\n");

                }
                else
                {

      out.write("                  ");
      out.print(nav.getTitle());
      out.write('\n');

                }

      out.write("\n                  </td> \n                  <td class=\"Right\">&nbsp;</td> \n                </tr> \n\t\t\t\t\t\t\t\t</table></div></td></tr>\n");

            }
            else
            {

      out.write("\t\t\t\t\t\t\n\t\t\n  \t\t\t\t\t\t<tr><td><div class=\"Selection\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">\n              <tr>\n\t\t\t\t\t\t\t  <td class=\"CollapsedLeft\">&nbsp;</td>\n\t\t\t\t\t\t\t\t<td class=\"Indent\">&nbsp;</td>\n\t\t\t\t\t\t\t  <td class=\"TopMiddle\">\n");

                if (!partOfNav)
                {

      out.write("                  <a href=\"");
      out.print(new PortalURL(request, nav.getLinkedFragment()).toString());
      out.write('"');
      out.write('>');
      out.print(nav.getTitle());
      out.write("</a>\n");

                }
                else
                {

      out.write("                  ");
      out.print(nav.getTitle());
      out.write('\n');

                }

      out.write("\n\n \t\t\t\t\t\t\t      \n\t \t\t\t\t\t\t  </td>\n                <td class=\"CollapsedRight\">&nbsp;</td> \n              </tr>\n\t\t\t\t\t\t</table></div></td></tr>\n");
View Full Code Here

    {
        super(null,
              config,
              null,
              null,
              new Navigation(null,
                             null) );
        getNavigation().setLinkedFragment(this);
    }
View Full Code Here

TOP

Related Classes of org.apache.pluto.portalImpl.aggregation.navigation.Navigation

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.