Skip to main content link. Accesskey S
  • Anonymous
  • Log on
  • Help
  • IBM logo
  • IBM Composite Applications wiki
  • All Wikis
  • Home
  • Community Articles
  • Product Documentation
  • Learning Center


Search

Advanced Search

Categories

Tag Cloud

  • 6.2
  • 6.2.1
  • 8.0.1
  • 8.5
  • 8.5+
  • 8.5.1
  • advanced features
  • advantages
  • API
  • app dev
  • assembling
  • basics
  • benefits
  • Browser
  • CAE
  • catalog
  • changing page properties
  • changing value to another type of value
  • code snippet
  • component library
  • component properties
  • components
  • Composite Application Editor
  • Composite Applications
  • container components
  • containers
  • custom actions
  • debugging
  • demos
  • deploying
  • designing
  • developing
  • Eclipse
  • Eclipse components
  • editing properties
  • Editor
  • education
  • enablement
  • Expeditor
  • extending
  • extensions
  • FAQ
  • feature rules
  • framework
  • getting started
  • Help
  • HOD
  • host on demand
  • how to
  • Java
  • lead manager
  • linking
  • live text
  • match rules
  • new users
  • Notes
  • Notes components
  • nsf
  • NSF components
  • overview
  • page navigation
  • page properties
  • Palette
  • PBE
  • PIM
  • plugins
  • Portal
  • preference
  • product documentation
  • programming
  • properties
  • property broker
  • property broker editor
  • Property Broker Monitor tool
  • provisioning
  • resources
  • roadmap
  • samples
  • setting component properties
  • Sidebar
  • sideshelf
  • Symphony
  • Symphony view component
  • technote
  • testing
  • toolkit
  • TopologyHandler
  • troubleshooting
  • tutorial
  • update site
  • updating
  • upgrading
  • video
  • view
  • Web
  • web services
  • white lists
  • widgets
  • Wiring
  • WSDL
InformationInformation
You are currently viewing machine translated content. IBM translation might be available. Click IBM Translated Product Documentation to see what is available.X


Home > Developing Components > Creating dynamic Launcher menu items for composite applications
Rate this article 1 starRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Creating dynamic Launcher menu items for composite applications 

expanded Abstract
collapsed Abstract
No abstract provided.
 

The new Composite Application Editor in version 6.2.x of Lotus Expeditor facilitates the creation of composite applications which are stored locally as .CA files.

A composite application can be configured so that it is added to the Launcher ('Open') menu of the Expeditor client, by setting the value of com.ibm.rcp.launcher to true in the Application properties:

 

app props

 

This results in the composite application being added in a static way to the Launcher menu:

 

static ca

 

However if we wish to customise the items on the Launcher menu so that menu items are dynamically added according to which user is logged in, we can do this programmatically.

We have seen how these .CA files can be programmatically launched using method showApplication() from the CompositeApplicationUIService. This method is detailed in article: Programmatically show a composite application.

In Lotus Expeditor version 6.2.x, the preferred method for launching a .CA file is to use a CompositeApplicationUIServiceFactory instead to obtain a reference to the service.

As an example, assuming the .CA file is stored locally in directory C:\IBM\XPD\compApps, the following code would launch the .CA file:

 


 


CompositeApplicationUIServiceFactory.getService().showApplication


( new URL("FILE:///C:/IBM/XPD/compApps/dynamic_ca.ca")


, null


, null


);


 



We can get access to the Launcher menu by gettng the LauncherManager instance:

 


import com.ibm.rcp.ui.launcher.LauncherManager;



private LauncherManager lm = null;



// Get the LauncherManager instance


lm = LauncherManager.getInstance();


 


 

 

Individual items can be removed from the Launcher Manager:

 


IContributionItem[] itemArray = lm.getItems();


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


{


if (itemArray[i].getId().equals(itemId))


lm.remove(itemArray[i]);


}


 


 

Alternatively all items can be removed.

lm.removeAll();
 

 


 

Items can be added to the Launcher menu as required for a particular user.

A new submenu can be added using FolderLauncherContributionItem, or a menu item can be added using a UrlLauncherContributionItem.

 

UrlLauncherContributionItem uci = null;


FolderLauncherContributionItem fci = null;



fci = new FolderLauncherContributionItem();


fci.setLabel(groupName);


fci.setId(groupId);


lm.add(fci);



uci = new UrlLauncherContributionItem();


uci.setUrl(url);


uci.setLabel(appName);


uci.setId(appId);


uci.setPath(groupName);


uci.setAlwaysLaunchInNewWindow(false);


lm.add(uci);


 

The update() method must be called to refresh the items on the Launcher menu.

 


lm.update(true);
 

In order to be able to invoke the showApplication() method when a menu item is selected, we need to subclass the ILauncherListener class to provide our own Launcher behaviour. The custom behaviour is added to the preLaunchItem() method:

 



import com.ibm.rcp.ui.launcher.ILauncherListener;



public class CustomLauncherListener implements IlauncherListener


{



public void postLaunchItem(LauncherEvent event) {


// TODO Auto-generated method stub


}



public void postLaunchItemInNewWindow(LauncherEvent event) {


// TODO Auto-generated method stub


}



public void preLaunchItem(LauncherEvent event) {


// TODO Auto-generated method stub


UrlLauncherContributionItem lci = (UrlLauncherContributionItem) event.getLauncherContributionItem();


final String id = lci.getId();


final String selectedUrl = lci.getUrl();


Activator.getDefault().getWorkbench().getDisplay().asyncExec


(new Runnable()


{


public void run()


{


try


{


CompositeApplicationUIServiceFactory.getService()


.showApplication


( new URL(url)


, null


, null


);


} catch (IllegalArgumentException e) {


// TODO Auto-generated catch block


e.printStackTrace();


} catch (MalformedURLException e) {


// TODO Auto-generated catch block


e.printStackTrace();


} catch (CompositeApplicationException e) {


// TODO Auto-generated catch block


e.printStackTrace();


}


}


});


}



public void preLaunchItemInNewWindow(LauncherEvent event) {


// TODO Auto-generated method stub


}


}


 


We finally need to associate the CustomLauncherListener with the LauncherManager:

 


CustomLauncherListener myLauncherListener = new CustomLauncherListener();


lm.addLauncherListener(myLauncherListener);


 


 

Now when we log in to the Expeditor client, we see the additional items that we added on the Launcher menu:

 

dynamic ca

When we select the dynamic_ca menu item, the composite application is launched using the showApplication() method as described above:

 

prg_launch


expanded Article information
collapsed Article information
Category:
Developing Components
Tags:

This Version: Version 16 December 9, 2009 3:34:19 PM by Bob Balfe  IBMer

expanded Attachments (4)
collapsed Attachments (4)

 


File TypeSizeFile NameCreated On
image/jpeg 44 KB app_props.jpg 12/7/09 10:20 AM
image/jpeg 10 KB static_ca.jpg 12/7/09 10:20 AM
image/jpeg 9 KB dynamic_ca.jpg 12/7/09 10:20 AM
image/jpeg 108 KB prg_launch.jpg 12/7/09 10:20 AM
expanded Versions (16)
collapsed Versions (16)
Version Comparison     
Version Date Changed by               Summary of changes
This version (16) Dec 9, 2009 3:34:19 PM Bob Balfe  
15 Dec 7, 2009 10:54:53 AM Gill Woodcock  
14 Dec 7, 2009 10:53:41 AM Gill Woodcock  
13 Dec 7, 2009 10:51:47 AM Gill Woodcock  
12 Dec 7, 2009 10:50:12 AM Gill Woodcock  
11 Dec 7, 2009 10:48:52 AM Gill Woodcock  
10 Dec 7, 2009 10:42:26 AM Gill Woodcock  
9 Dec 7, 2009 10:40:40 AM Gill Woodcock  
8 Dec 7, 2009 10:39:03 AM Gill Woodcock  
7 Dec 7, 2009 10:37:26 AM Gill Woodcock  
6 Dec 7, 2009 10:36:22 AM Gill Woodcock  
5 Dec 7, 2009 10:35:13 AM Gill Woodcock  
4 Dec 7, 2009 10:33:41 AM Gill Woodcock  
3 Dec 7, 2009 10:30:09 AM Gill Woodcock  
2 Dec 7, 2009 10:27:05 AM Gill Woodcock  
1 Dec 7, 2009 10:20:42 AM Gill Woodcock  
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedSubscribe to RSSHelpAbout
  • All Lotus and WebSphere Portal wikis
  • IBM developerWorks
  • IBM Software support
  • IBM Social Business User Experience Blog
  • IBMSocialBizUX on Twitter
  • IBMSocialBizUX on Facebook
  • Lotus product forums
  • IBM Social Business UX blog
  • IBM Collaboration Solutions
  • Recently added feedRecently added
  • Recently edited feedRecently edited
  • Recently added comments feedRecently Added Comments
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Contact IBM
  • IBM Terms of use
  • Wiki terms of use