Tutorial: How to add the Attachment Viewer to your mail file

As promised, here is the step by step tutorial for adding the attachment viewer to your email.  Go ahead and check out the video before you begin so you will get a clear picture of what I am talking about – in case you missed the post.  While these steps are very basic, I am going to explain them using the very technical Eclipse terminology so in the end you will surely know how the Notes 8 client is constructed and especially Mail. 🙂

Continue reading

New articles for Notes 8.5.2

There are five new articles on the Composite Application Wiki, each one hits some new or extended function you will see in the 8.5.2 release.  I will be writing about these articles separately.  This new content has come directly from excellent customer and business partner feedback.

New Component Level Access Control in Notes 8.5.2 by Michael Cooper

Using a Notes Outline to control page navigation in a composite application by Bob Balfe

Understanding the DataChange event in Container Components by Chuck Imperato

Understanding the CAI URL by Bob Balfe

jWidget – Easy Creation of Java Composite Applicaiton Components by Michael Cooper

n.Fluent is now on all IBM wikis!

Watch out Google Translate, n.Fluent technology is now on all IBM wiki’s!  I only hope the translation is better than Google’s.  If you see something wrong in your native language don’t hesitate to write in or help change it.  This is one of the benefits of all of the wiki’s using the same design – they are all updated!  Check out the Composite Application Wiki for a sample:

Creating wiki articles and some great tips

Amanda Bauman posted a nice Wiki Help article on the Composite Application Wiki.  The post shows you how to format the text for your articles including many other tips like moving a document from Microsoft Word to the wiki or including an SWF file in your article.  This formatting is good for all of the wikis based on the XPages wiki template, you can check the LotusWikis.com for the full list of wikis.

Extending the Notes View Container with a “Run Agent” custom action

The Notes View container introduced as a web delivery for Notes 8.5 is going to ship with the Notes 8.5.1 release.  When you mix that with the custom action extension point introduced in Notes 8.5.1 you can do some pretty neat stuff.  In this article I use the Notes View container, a custom action and the Notes Java API’s to give the Notes view container the ability to have agents be called from a property change from another component.  This is really a technical article and has no real work value but it shows you technically how an action like this can be coded and then having the data received by the Lotus Script agent.

Side Shelf tutorial – managing the side shelf within a composite application

In Notes 8.5 you could specify what components should show in the left and right side shelf.  In 8.5.1 you can now wire to components and also control when the components should be visible or not.  This article shows how you can manage the side shelf in the context of your composite application.

Reference article is here.

Using the Notes Document Container – Side by Side Editing use case

The Notes Document container allows you to use documents in your composites.  This is a new feature in Notes 8.5.1 and an article showing one of the many use cases for this container was posted on the CA wiki.  The concept of the document container is to easy get data into and out of Notes fields – whether it is in read only mode or edit mode and share that data with other components.  This article is the first, and most basic, use cases but also shows how you can manage the life cycle of the document component.

Referenced article is here.

Full circle implementation of the part property bridge idea

The last posting on this subject showed you how you can publish properties to other components using only Eclipse level API's. I got a few inquiries on how the Eclipse view part can receive property changes from other components.

Here is the complete round trip implementation. The view can receive property changes from the bridge using a part property listener – check out the code below. When the bridge needs to tell the eclipse part a property is changed it simple calls setPartProperty() which is part of the IWorkbenchPart3 interface. So this means your code only needs to register itself as a part property listener and process the changes as they come in.

So in short, to publish a property your part would call:

firePartPropertyChanged(propertyName.getText(), oldValue, propertyValue.getText());

To receive a property from another part you would implement a listener to yourself:

addPartPropertyListener(this);

public void propertyChange(PropertyChangeEvent arg0) {

int idx = getItemIndex(arg0.getProperty());

if (idx == -1){
propertyName.add(arg0.getProperty());
idx = getItemIndex(arg0.getProperty());
}

propertyName.select(idx);

propertyValue.setText(arg0.getNewValue() != null ? arg0.getNewValue().toString() : “”);
}

Here is the full source:

package net.balfes.partprop.bridge.views;

import org.eclipse.jface.util.IPropertyChangeListener;import org.eclipse.jface.util.PropertyChangeEvent;import org.eclipse.swt.widgets.Button;import org.eclipse.swt.widgets.Combo;import org.eclipse.swt.widgets.Composite;import org.eclipse.swt.widgets.Label;import org.eclipse.swt.widgets.Text;import org.eclipse.ui.part.*;import org.eclipse.swt.events.SelectionEvent;import org.eclipse.swt.events.SelectionListener;import org.eclipse.swt.layout.RowData;import org.eclipse.swt.layout.RowLayout;import org.eclipse.swt.SWT;

public class PropertyBridgeTest extends ViewPart implements IPropertyChangeListener {

	Combo propertyName = null;	Text propertyValue = null;	String oldValue = new String();

	public PropertyBridgeTest() {	}

	public void createPartControl(Composite parent) {

		RowLayout rl = new RowLayout(SWT.VERTICAL);

		parent.setLayout(rl);

		Label l = new Label(parent, SWT.NONE);		l.setText("Enter property name");

		RowData rd = new RowData();		rd.width = 300;

		propertyName = new Combo(parent, SWT.READ_ONLY);		propertyName.setLayoutData(rd);

		l = new Label(parent, SWT.NONE);		l.setText("Enter property value");

		propertyValue = new Text(parent, SWT.NONE);		propertyValue.setLayoutData(rd);

		Button b = new Button(parent, SWT.PUSH);		b.setText("Publish");

		b.addSelectionListener(new SelectionListener(){

			public void widgetDefaultSelected(SelectionEvent arg0) {

			}

			public void widgetSelected(SelectionEvent arg0) {				firePartPropertyChanged(propertyName.getText(), oldValue, propertyValue.getText());

				oldValue = propertyValue.getText();			}

		});

		addPartPropertyListener(this);

		//Setup what properties are in our view		createPartProperties();			}

	private void createPartProperties() {		this.setPartProperty("Name", "Bob Balfe");		this.setPartProperty("Phone", "555-543-1212");		this.setPartProperty("Manager", "George Bush");		this.setPartProperty("Computer", "Lenovo");	}

	public void setFocus() {			}

	int getItemIndex(String name){		String[] vals = propertyName.getItems();

		for (int x=0; x<vals.length; x++)			if (vals[x].equals(name))				return x;

		return -1;	}	public void propertyChange(PropertyChangeEvent arg0) {		int idx = getItemIndex(arg0.getProperty());

		if (idx == -1){			propertyName.add(arg0.getProperty());			idx = getItemIndex(arg0.getProperty());		}

		propertyName.select(idx);

		propertyValue.setText(arg0.getNewValue() != null ? arg0.getNewValue().toString() : "");	}

}

Adding custom launch items to the “Open” menu

Lotus Notes has a very cool UI where you can contribute launcher items to the Open menu. You can not only contribute bookmarks and databases but you can create a custom handler to have just about anything launch from the Open menu.

You can check out the Info Center help here where it shows you how to add a contribution to the menu. The one area the help does not go into is the handler implementation (TestURILauncherItemHandler()). The great thing is the object passed in just needs to extend org.eclipse.core.commands.AbstractHandler and override the execute event. So really, you can pretty much do whatever you want in that method.

From the help in the info center here are the out of the box handlers that get installed with the platform:

* nativeProgramLaunchItem — Identifies the item as being a NativeProgramLauncherContributionItem class, which is a contribution item that starts a native program.

* perspectiveLaunchItem — Identifies the item as being a PerspectiveLauncherContributionItem class, which is a contribution item that starts a standard client application by specifying an Eclipse perspective.

* urlLaunchItem — Identifies the item as being a UrlLauncherContributionItem class, which is a contribution item that opens a URL.

Tags: : :

Creating extensions dynamically

I have been asked a few times how we create perspectives dynamically in Lotus Expeditor and Notes in the composite application space. We actually create many extensions dynamically using the Eclipse RegistryFactory API. The getRegistry() method returns an instance of the extension registry factory (IExtensionRegistry) where you can call addContribution(). Once this method is called the extension becomes available for use – usually reflected in a toolbar, menu, etc.

What would this kind of stuff be good for?

Say you have data stored in some other format – like an NSF, database, a external system – and you want that to be represented as some existing extension. You can now dynamically create those extensions from those other sources. This is exactly what we do for perspectives and other extensions in composite applications.

Another great sample would be to clone an existing perspective but maybe add a different context to it. For example, you could have your IPerspectiveFactory class create the layout for your perspective and base the contents on the Page data stored in the composite application model. This would allow your perspective to use this data space to initialize views and the data that is used in them. This means you could then contribute a special launch contribution item to the Open menu, dynamically create a new perspective off of the current workbench selection and initialize that perspective with the selection data. This would be yery similar to the Web Browser and Symphony documents. Your perspective may be a “user session” for a banking application. Each perspective may be a specific customer profile – so when you open up multiple instances of this perspective they would all point to different customers.

The cool thing about using page and component data is it can be conditionally used. You can use core Eclipse API's to get the data and if nothing is returned then its not available – if the data is returned you can use it! Check out the Wiki page I wrote about this model.

Tags: : :

To see code samples
The code below has a variable called buffer. The contents of buffer simply need to be the XML you would normally use for a plugin extension. For example, the buffer could be this xml:

<perspective
name="Test"
class="org.eclipse.ui.articles.perspective.TestPerspective"
id="org.eclipse.ui.articles.perspective.Test">

That sample plugin xml code came from the Using Eclipse Perspectives article.

byte[] bytes = buffer.toString( ).getBytes("UTF-8");
is = new ByteArrayInputStream(bytes);

IExtensionRegistry registry = RegistryFactory.getRegistry( );

if (!registry.addContribution(is, contributor, false, null, translations, null)){
//Log an error or something
}

Unfortunately there are some caveats to the call. The one major problem is the “persist” flag does nothing today. So if you want your contributions to be available on next launch you need to do this every time.