Wednesday, November 21, 2007

SnTT : The Simplest Property Broker Example in Notes 8

Recap

I've created a very simple, if not the simplest, property broker example using the Expeditor Toolkit. The idea is to understand the property broker and wires as part of the new breed of applications that integrate eclipse plugins and ND8.

In keeping with the 'simple' theme, I wanted a simple database...err...application that would have a simple notes view, when I select a document in the notes view the content in the column is sent to the text box on the TargetView view part.

Blank Composite Application


I created a new composite application (CA) from the " - blank composite application - " template, which promptly opened to show me the message

"This application page does not contain any content".


I opened the application with Designer and added a view and a form - nice and simple. Next I wanted to add a few documents. I needed to edit the composite application and add the notes form and view. Then from the action > edit application you can access the composite application editor and under the right hand side flyout pane (components palette) is the form and view.

I dragged the view into the blank page and closed the CA Editor, it now looks like an old school Notes database. I could then add in a few data documents ready for the next steps.

Packaging the Plugin


What you need to do is package up the plugin into a format that you can install into ND8. This is through the tried and tested
update-site-format. If you have applied patches or upgraded RAD/RSA you would be very familiar with this way of installing plugins and updates.

The instructions to update the plugin build properties, create a feature and generate an update site are in the tutorial "
CompAppsTutorialPart2M4.pdf". I followed these instructions and built the update site. So far so good.

Installing a plugin

Back to the Notes application and the CA Ed
itor. I need to add into the component palette my two ViewPart (TargetView and SourceView). To add components you right click, then choose Add Components > Add Components from Update Site.

My update site is in local directory, under my workspace directory. so I browsed to the site.xml and clicked OK. I was then given a dialog to select the components from the update site. Strangely the SourceView component was missing. No drama as it's the TargetView compone
nt that I needed anyway. I added the component and then dragged it onto the main page. Positioning can be a tad awkward. If you want to have the component on the bottom most part of the screen then you will need to drag the cursor right to the bottom of the screen.

Wires

In the left hand menu I selected the 'source' component the Default View (notes) component and right click then wiring - I could see the 'sets the target message' action in TargetView but there was nothing to wire from. I could see the 'Default View' component but no property.


oops...More wires

I had forgotten to add in the Notes side of the wiring. I created a new wiring properties (sample.wsdl), then opened the WSDL file with the editor and added a notesValue property, updated the namespace to cahelloworld.nsf and added a setter and getter action. The dialog is the same as the wiring editor in the Expeditor Toolkit.

It was still not working. Come to think - how would the view know which property change has happened ? In the column properties in the 'Programmatic Use' tab there is a new setting on the bottom just for this...

Composite Settings : Property




In the drop down there was only one choice 'notesValue'. When I went back to the Wiring Editor and the 'notesValue' property was showing. I wired them together and closed the CA Editor and the text box had a value. I selected the other documents and the text changed in the eclipse plugin.


I also found out why the SourceView wasn't listed when I came to add the component. In the plugin.xml the TargetView Extention element 'allowMultiple' wasn't set.

The eclipse
documentation specifies that...

allowMultiple - flag indicating whether this view allows multiple instances to be created using IWorkbenchPage.showView(String id, String secondaryId). The default is false.

Summary


On the whole the packaging up of the site and installation was fairly easy - until I moved the cahelloworld.nsf to another workstation. I'm not entirely sure about the deployment and distribution of a CA. One of the great thing about Notes applications is that deploying an application and new version is an easy process. Update the templates, maybe run agents to modify documents and thats it. Even if you have a Dev/UAT/SIT/Production type environment, it is still relatively simple. CA's will add another level of complexity to the equation.

I also found that the Help > Support > View Trace (and View Log) is helpful in tracking down property broker issues. Have a go at installing the BIRT sample in a directory other that the Notes data directory and then having a look at the Trace and Log. BTW the report does not generate, so don't hang around waiting. The logs show why.

So, there you have it. Quite possibly the most simple eclipse plugin and notes 8 composite application example.

Attachments.
com.scius.examples.helloworld.updatesite103.zip
cahelloworld-nsf.zip

4 comments:

  1. http://www-128.ibm.com/developerworks/blogs/resources/CompApps/CompAppsTutorialPart2M4.pdf

    I believe this is the correct link to the PDF

    ReplyDelete
  2. Matthias12:36 am

    Hi Tony,

    I installed your sample.
    Source view -> Target view: communication works
    Default view -> Target view: communication works

    What I can't get running is the reaction of the Default View on an incoming message from the Source view. Means: The corresponding Notes view entry isn't selected.

    I added a Notes form that contains only a field and a button (just like the RCP view) and then created a wire between this form and the view - it works.

    Do you have any idea what goes wrong here?

    ReplyDelete
  3. Correct me if I don't understand. What I think you are trying to do is, create a form to send a property change to a view, so that from a form (or RCP app) you can select a view entry.

    If this is the case, then you'll need to add an additional wire from the from the source view (form/rcp) to the notes view - you'll also need to add code into the view to watch for property changes using the Domino Property Broker Class (info in designer help - there are also some examples on the net.)

    My sample was only for one direction. However, updating the sample for bi-direction would be a good post for the future.)

    ReplyDelete