Thursday, June 30, 2011

Illustration of Wiring Concept in Composite Applications – Lotus Notes 8.5.2

Let images talk :)
1.
 
2.
3.

4. 
5.

6.
7.
8.
 
9.
 
10.
 
11.
 
12.
 
13.
 
14.
 
15.
16
 
17.
 
18.
 
19.

20.

21.

Hope this helps :)

Using Notes Outline for navigation in composite application

1.    Create a new composite application
2.    Create a new outline with the specifications as illustrated by the image
 
3.    Now embed the out line into a page and name it as the “Main Page” as illustrated in the following image

4.    Now Open up the Composite Application Editor (CAE). And open up the Page Navigator properties as illustrated in the following image
5.    Now ensure that the properties highlighted in the following screen shots are set accordingly. U may have to manually add them if you don’t find them
 
6.    The useNavigator setting tells the CA subsystem that we want a navigation system and the navigationModel setting equalling "custom" tells it that we will provide our own page switcher

7.    Now add 3 pages to the CAE as illustrated in the following images
 
8.    You would see a screen as follows in the Left margin in CAE
9.    Now select eacha and every page in the left section of the CAE and add a “Managed Browser” section to each of them as illustrated in the following image
10.    Now edit the component properties of all these managed browsers and give them a target url as illustrated in the following images

11.    Once that is done, save and close your CAE and preview your application on the Notes Client as illustrated in the following figure
12.    And you would be viewing something similar to the following

Wednesday, June 29, 2011

Understanding the CAI URL

CAI stands for “Computer Assisted (or-Aided) Instruction”.
CAI URLs are special URLs that are used in Composite applications to launch an application or to switch between a pages with in or across composite applications.
The CAI URL is broken into several parts, most of which are optional in many cases.


SYNTAX


 cai://[GUID]/[Page Id]?[pagealias][hint]
Where,
[GUID] - the optional GUID for the application. This parameter is actually not needed at all as long as the [Page Id], [pagealias], or the [hint] is specified.

[Page Id] - this is essentially the Eclipse perspective Id. Also an optional parameter if the [pagealias] or [hint] is specified.

[pagealias] - this corresponds to the com.ibm.rcp.alias parameter in the pages for a composite application. By including this parameter with a blank [GUID] and blank [Page Id] the composite application framework will attempt to open the page with the matching pagealias in the current application.Lotus Notes 8.5.2 and Lotus Expdeitor 6.2.2 and above.

[hint] - the url hint is used to tell the composite framework where to get the file for this cai url. The hint can be any kind of addressable URL: file, http, nrpc. The hint is the actual .ca file



Sample URLs and their behaviors



cai://?hint=http://acme.com/mycompapp.ca
- This will open the application stored at the http site and show its first visible page
- This will process the .CA file and install any features referenced by the .CA
- If any features are installed this will require a restart of the product

cai://DB1F567B0E6F6784084D923134028D4C_8525764000063159
- This will open an already installed application with the following GUID
- If the application is not installed it will error out.
- The first visible page will be opened
- If the hint URL is specified then this will process the .CA file and install any features referenced by the .CA. If any features are installed this will require a restart of the product

cai://DB1F567B0E6F6784084D923134028D4C_8525764000063159/BD973A4E8C0FCDED54C69CB23940B5FC_6_3KE527R200VQ502MGJOIMC20H7
- This will open an already installed application with the following GUID
- If the application is not installed it will error out.
- The page with the [Page Id] will be displayed.
- If the hint URL is specified then this will process the .CA file and install any features referenced by the .CA. If any features are installed this will require a restart of the product

cai://?hint=nrpc:/__8525729D0030946C/composite.xml?file=MyCompApp.nsf&name=CompAppMain
- This will install and launch the composite application from a Lotus Notes database using the nrpc URL.

cai://?pagealias=First Page
- This launches the page in the currently opened composite application with the com.ibm.rcp.alias set to "First Page"
- If the pagealias is not found in the current application the user will see an error dialog.

cai://?pagealias=First Page?hint=http://acme.com/mycompapp.ca?ColorScheme=Blue&Font=Arial
- This launches the page in the currently opened composite application with the com.ibm.rcp.alias set to "First Page"
- The application at the hint will be checked for an update prior to opening the page
- If the pagealias is not found in the current application the user will see an error dialog.
- The ColorScheme and Font parameters will be available as preferences for all components on the page.


Computing a cai URL in formula language



The following can be used to simply show a page in the same composite NSF from formula language as a URL:

"cai://?pagealias=Page 1"


The following snippet of code can be used in a Notes outline to show a specific page (using the [pagealias] parameter) and optionally install or update the composite using the [hint] parameter.

rep_id := @Left(@ReplicaID; 8) + @Right(@ReplicaID; 8);

"cai://?pagealias=Page 1&hint=nrpc:/__" + rep_id + "/composite.xml?file=PlayWithNavigator.nsf&name=CompAppMain"

Note :
1.    nrpc stands for  Notes Remote Procedure Calls
2.    The next section titled “Using Notes Outline for navigation in composite application” shows  CAI URL in action

GUID of a Composite application

GUID stands for Global Unique Identifier. Hope the title makes sense now. This section will simply help you understand how you can get the GUID of a composite application.

In the following screen shot of a composite application, I have an action button which upon clicking gets me the GUID if the application.


This is possible when you code the button with a formula as follows  


So the trick is – hmmm its simple - @GetGUID
And the lotus script equivalent is as follows

Wednesday, June 22, 2011

Starting a Tomcat server


Recently I downloaded apache-tomcat-7.0.14-windows-x86 and had a few issues starting up the server.
I attempted to start the server using the “startup.bat” present in the “\tomcat\bin” folder and was facing issues that kept bombarding errors like,

The CATALINA_HOME environment variable is not defined correctly
This environment variable is needed to run this program


This issue was rectified when I keyed in the command,
>set CATALINA_HOME=D:\apache-tomcat-7.0.14-windows-x86\tomcat – the folder path where I deployed my tomcat server   
 And once the above issue was rectified, the following error occurred when attempting to start the server from the command prompt,

The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE



Hence I attempted the following in the command prompt
>set JAVA_HOME=C:\Program Files\Java\jdk1.6.0
And at last my tomcat server ran like charm

Thursday, June 16, 2011

Is 0.1+0.2==0.3

Recently a friend of mine brought it up. Try the following in Javascript and to my amusement the answer is false.

What are our computers doing... funny :). Probably the compilers fault.

javascript:var a=0.1;var b=0.2; alert(a+b==0.3).


This one is anologous to the other one posted in http://ozinisle.blogspot.com/2010/05/what-is-20-11-any-idea.html


Hope you enjoyed :)

Friday, June 3, 2011

Working with HTTP POST in Lotus Notes

Create a form design element as illustrated in the following image. Note the usage of the action parameter that has been added as an attribute to the form tag. The page gets redirected to the url mentioned  as the action attribute when document submit Is triggered. The trick here is to key in your agent url which will enable execution of that agent from the server


Now write an agent with the following lotus script code in it and ensure that this url is mentioned as the action param on the browser


Note the usage of Request_Content and Query_String reserverd fields in the agent code. Now preview the form on the browser , key in a few values and hit submit.


This eventually triggers your agent and you will see the desired out put. Your Post parameters and the Get (Query_String) parameters.


Hope this helps :)

Open about database document on the browser

The following url can be used to open the about database page of a Lotus Notes Database
http://servername/dbpath/$about?openAbout

How ever the following seems to work as well, (tested in chrome)
http://servername/dbpath/$about
http://servername/dbpath?openAbout

hope this helps :)

Thursday, June 2, 2011

Get Foldernames on the web


The following is a simple way that would illustrate how one can get the list of names of folders available in a database. In this case I have used a list box to bring up those names. Also you can be specific , with a fourth parameter if you don’t want a folder name from being displayed on the list
@DbCommand( "Domino" ; "FolderList" ;"My Custom First Element" )

 Hope this helps :)

Examples using @DBCommand – A simple way to navigate between pages in an Embedded View

1.       Create a form  and add an embedded view to the same

2.       Now add a couple of buttons namely “<<Prev” and “Next>>”

3.         Now add the following commands to  these functions respectively,
a.        @DbCommand( "Domino" ; "ViewPreviousPage" )
b.       @DbCommand( "Domino" ; "ViewNextPage" )
4.       Now preview the form on the browser and try playing with these buttons.

you will be able to see how the documents being listed in the embedded view changes according to the clicks on these buttons. A simple way to navigate between pages voila….

Hope this helps :)

Wednesday, June 1, 2011

Using Data Tables in XPages

It took me quite some time to understand the way controls inside a datatable get bound to the datasources. It was a kind of trick that we would use with repeat controls that helped me do this.

1.Create a view with a few sample documents as shown below.

2.Now create an XPage that anddrag and drop a control on to it as shown below. Ofcourse add the computed texts and lables as shown in the image with desired styles

3. Now add the sample view that was created earlier as the data source for this data table

4. In the properties pane of the Data table, mention the collection name as colName1 s shown in the image

5. Now go to the properties pane of the computed fields and in the value tab bind them to the view columns as displayed in the image.

6. Now save and preview your XPage. You must be seeing something similar to the following. Ofcourse depending on the style sheets that you apply

Hope this helps :)