Domino Connection : Samples for Domino and Notes Version 4.5 : Using a database part : Step by Step description how to build the sample
Step by Step description how to build the sample
Make sure you have performed the initial steps to rebuild the samples before you proceed (see Preparations for Version 4.5 samples). If you have not already done so, create a connection specification named MyDiscussionSample for the local \vasample\vadis45.nsf database.
1. Create a new visual part. Select Domino Parts from the parts palette and add a Domino Database part to the free form surface. Set the parts name to Database. Double-click the database part to open the settings page. From the Alias Name dropdown listbox select the MyDiscussionSample connection alias. The database part is now reading structural information about the sample database. Select the Error Reporter Creation Automatic check box to make the part ready for automatic error handling. Select OK to close the settings page. You have now configured the database part.
2. Connect the aboutToOpenWidget event of the main window to the open action of the database part to initialize the part during runtime. Connect the aboutToCloseWidget event of the main window to the close action of the database part to free resources when the program ends.
3. Add entry fields and listboxes for those attributes of the database you want do display (the sample uses entry fields for: Current User Name, Mail Server Name, Database Title and listboxes for Visible Servers, Forms and Views).
4. Right click the database part and select the connect option from the pop up menu. Create attribute to attribute connections from each attribute of the database part to the corresponding entry fields object attribute and the corresponding lists items attributes. As there is no visible servers attribute available in the database part, you have to create a script to retrieve the visible server names.
5. Switch to the Script Editor of your part and add the following method:
visibleServers
"return the list of currently visible Notes/Domino servers"
| serverNames |
serverNames := AbtLnEnvironment serverNames.
^serverNames asOrderedCollection
6. Switch to the Composition Editor and connect the items attribute of the list used for display of the visible servers to the visibleServers script. Add a button labeled ACL Managers to display an extra window showing information about the database's Access Control List (ACL). Add an extra window named ACL Managers to the free form surface and add a list to the new window. Connect the clicked event of the ACL Managers button with the openWidget event of the ACL Managers window.
7. Switch to the script editor and add the following methods:
databasePart
"Answer our part representing the database"
^(self subpartNamed: 'Notes Database')
aclManagers
"return a list with all ACL entries with manager privilege"
^self databasePart lnDatabase notNil
ifTrue: [
self databasePart lnDatabase accessControlList entries
inject:(OrderedCollection new) into:
[ :col :value | (value isManager) ifTrue: [ col add: (
value name ) ]. col ] ]
ifFalse: #() ]
8. Switch to the Composition Editor. Connect the openedWidget event of the ACL Managers window with the items attribute of the list in this window to display the ACL managers of the database. You now have to add the required parameter to the event to attribute connection. Right click on the connection and connect the value property with the aclManagers script. Finally connect the defaultActionRequested event of the list to the closeWidget action of the ACL Managers window. You are now ready to test the part.
Last modified date: 01/29/2015