Skip to Content

In Internet terminology, this type of navigation is called “Quick Links”. I will also use the term “Quick Links”. It is completely different from the “Quick Links” in SAP terminology.

Quick Links
are used often in web sites especially if you have complex navigation
structure.Instead of going through the navigation steps you can easily
select your navigation target from combo box. In this weblog, I will
explain the implementation steps for Quick Links.

Summary

At the end of this blog we will have a quick link menu like :

!https://weblogs.sdn.sap.com/weblogs/images/29528/image1.gif|height=181|alt=image|width=283|align=center|src=https://weblogs.sdn.sap.com/weblogs/images/29528/image1.gif|border=0!

Let’s Start

    • Open
      Netweaver Developer Studio in Enterprise Portal perspective.
    • Create
      a new “Portal Application Project”
    • Create
      a package “com.utility” in folder
      “src.core”
The project structure should
look like  :


image


    1. Create
      a class “QuickLinks”  ( superclass :
      AbstractPortalComponent )


package com.utility;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Locale;


import com.sapportals.portal.navigation.INavigationNode;
import com.sapportals.portal.navigation.INavigationService;
import com.sapportals.portal.navigation.NavigationNodes;
import com.sapportals.portal.prt.component.AbstractPortalComponent;
import com.sapportals.portal.prt.component.IPortalComponentContext;
import com.sapportals.portal.prt.component.IPortalComponentInitContext;
import com.sapportals.portal.prt.component.IPortalComponentProfile;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
import com.sapportals.portal.prt.component.PortalComponentException;
import com.sapportals.portal.prt.runtime.PortalRuntime;


/*

  • Created on 03.Mar.2007

*/


/**

  • @author Abdulbasit Gulsen

*/
public class QuickLinks extends AbstractPortalComponent {


     /**
     

      */
     String output;
     int maxdepth;     
     public QuickLinks() {
          super();
          // TODO Auto-generated constructor stub
     }


     /* (non-Javadoc)
     

  • @see com.sapportals.portal.prt.component.AbstractPortalComponent#doContent(com.sapportals.portal.prt.component.IPortalComponentRequest, com.sapportals.portal.prt.component.IPortalComponentResponse)

      */
     protected void doContent(
          IPortalComponentRequest request,
          IPortalComponentResponse response) {
          // TODO Auto-generated method stub
          IPortalComponentContext componentContext = request.getComponentContext();
          IPortalComponentProfile profile = componentContext.getProfile();
          maxdepth = Integer.parseInt(profile.getProperty(“depth”));
          int depth = 0;
          output = “”;                                                  
          Locale lcl = request.getLocale();     
          String strLocale = lcl.toString();     
          output += “<style>”;
          output += “select.list {“;
          output += “font-size : 9px;”;
          output += “}</style>”;
          output += “”;
          
          output += “<form  name=\”navigation\”>”;
          output += “<select name=\”links\” class=\”list\” onchange=\”javascript:window.location.href = document.navigation.links.options[document.navigation.links.selectedIndex].value;\”>”;                                   
          if (strLocale.equals(“tr”))               
               output += “<option selected>Hýzlý Eriþim</option>”;
          else
               output += “<option selected>Quýck Links</option>”;
          try {
          NavigationNodes rootNodes = getrootnodes(request);
          int i = 1;
          for(Iterator it = rootNodes.iterator(); it.hasNext();){
               INavigationNode rootNode = (INavigationNode)it.next();
               String title =  rootNode.getTitle(lcl);               
               output += “<option value=\”/irj/portal/anonymous?NavigationTarget=” + rootNode.getName() + “\”>” + title + “</option>”;               
               getRestofNodes(rootNode,lcl,depth);
               i = i + 1;
          }          
          } catch (Exception e) {}         
          output += “</select>
“;          
          response.write(output);
     }


     /* (non-Javadoc)
     

  • @see com.sapportals.portal.prt.component.IPortalComponentInit#init(com.sapportals.portal.prt.component.IPortalComponentInitContext)

      */
     public void init(IPortalComponentInitContext arg0)
          throws PortalComponentException {
          // TODO Auto-generated method stub
          super.init(arg0);
     }
     private void getRestofNodes(INavigationNode rootnode,
                                 Locale lcl,
                                 int depth) throws Exception
     {
     depth++;
     if (depth>=maxdepth&&maxdepth!=0) {
          return;          
     }
     String filler =””;
     for (int i=0;i
image

Hint : If you don’t want to go into deep navigation structures change depth property in IView properties.

If you put 0 you will get whole navigation structure.


To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Daniel Wroblewski
    Nice blog, and I will reference it from the Portal Wiki.

    One note: Be careful in calling this “Quick Links”, as the portal has a Quick Links feature and it was confusing, since I assumed that you were somehow creating these quick links in some automated way.

    In any event, nice blog.

    Daniel

    (0) 
    1. Abdulbasit Gulsen Post author
      Hi Daniel,

      I was also afraid of confusion with the term “Quick Links” when writing the blog. However, in Internet terminology, “Quick Links” means links in combo box. However, in SAP terminology it is completely different. I couldn’t find a more suitable word other than “Quick Links”..
      Anyway, I will change the title to prevent confusions..

      Regards
      Abdul.

      (0) 

Leave a Reply