Selected document and widget

Hi, I’m new on the Lotus Notes platform and I wish to develop a widget on the sidebar reacting on different selected object.

My needs :

I want a widget on the sidebar which reacts on document focus to display :

  • Contact information when the user click or open a Contact Document

  • Sender information whent the user click or open an Email Document.

  • Do a research on a overline a word or a sentence with a item in the context menu (right click)

What I have :

  • I can update a widget (now a web browser) on the sidebar when the focus change

  • I can add an item in the context menu when an item is overline and add an action to update a widget on the sidebar

My problems :

  • When I use the added item in the context menu I have an IStructuredSelection object but can’t get the selected text. How to do this?

  • When the focus change, I have NotesDocumentSummary or com.ibm.csi.types.DocumentSummary object (when clicking on a Contact in the AddressBook or when I select an Email in my Inbox folder). How can I extract the email address and Firstname and Lastname ( the From header for Email) ?

Thanks for your help.

Fabrice

Subject: Try Our Notes Java UI APIs

Hi Fabrice,

I think most of what you are asking to do can be accomplished using our Notes Java UI APIs. You should reference the Javadoc in the 8.5.1 help. In Notes go to Help → Help Contents-> Client APIs for Lotus Notes and Domino Designer - Javadoc → Notes Client Java UI APIs. Here you will find several APIs which help plugin developers to consume and alter Notes data. Your plugin will have to depend on com.ibm.notes.java.ui and com.ibm.notes.java.api. Most of the functionality in these APIs originate from NotesUIWorkspace. To solve your questions you probably want to use NotesUIWorkspace.getCurrentDocument(). This will give you the current document that is showing, either in the UI as its own tab, or being displayed in the preview pane. This method returns a NotesUIDocument which has several methods but the two I think you are interested in are getSelectedText() and getField(fieldName)/getFields().

In your right click menu you probably don’t want to bother with the IStructuredSelection, instead you want to call NotesUIWorkspace.getCurrentDocument().getSelectedText().

For you second problem what do you mean when you say “focus changed”? Are you referring to changing your selection in your inbox view, or changing focus by switching tabs? There is no supported way to pull data from view entries in your inbox. If you are talking about switching focus between open documents in tabs or the open document in the preview pane than getting the current document as I explained above and calling getField(fieldName) will work. You can determine the fields in any document by opening the properties dialog for that document. You can do this by going to File → Properties while the document is open and going to the second tab (Design Tab) in the resulting dialog. There you will see a list of fields. This is not so easy to understand if the document has a lot of fields. If you have Domino Designer installed I would suggest opening the form used to create the document and looking at the fields that way. For example an email in your inbox is created with a form called Memo. A reply document is created with a form called Reply. Open any mail database in Domino Designer and look for those forms under the Forms section to find the available fields in the document. I hope this helps. Please let me know if you need more help.

-Ryan

Subject: Good Info…

Hi Ryan,

Thanks for you post. Hope this helps many.

Is there any Tutorial for Notes plugin development available on web with which i can start off?

Subject: Lotus Expeditor

Hi Sriram,

Lotus Notes is based on Lotus Expeditor so you should use the Expeditor Toolkit to do your Notes Plugin development. Please take a look at the Lotus Expeditor Wiki for more information.

http://www-10.lotus.com/ldd/lewiki.nsf

-Ryan

Subject: Thanks

Thanks Ryan for this precious help.I’m trying it now !!

Subject: NotesUIWorspace isn’t always here…

Hi,

I tried to use NotesUIWorkspace.getCurrentDocument() and it works well in some conditions but not for other.

In example, when I click on an item in a list (emails or contacts) I get com.ibm.csi.notes.internal.types.NotesDocumentSummary and com.ibm.workplace.noteswc.selection.NotesDocumentSummary objects and NotesUIWorkspace.getCurrentDocument() is null…

NotesUIWorkspace.getCurrentDocument() seems to be good only on open document.

How can I get information from these 2 types of object ?

Thanks

Fabrice

Subject: Your Right

Hi Fabrice,

I assume you are trying to get the current document in selected in a view. Get current document does not work in views, only if the document is open or is open in the preview pane of the view and has focus. We are considering new APIs in a future release of Notes where you can get and track the current selection in a view. You may explore those two classes but I cannot comment on how to use them as they are not officially supported by us. However I do think there are ways to get column values from at least one of those classes.

-Ryan