JavaScript and the Domino IDE

Domino 6 provides even more integration for JavaScript. It even goes so far as to provide the developer with a graphic of the language's object model. The new JavaScript Object Model graphic is the first thing that developers will encounter in the new Designer 6. An object model graphic can be selected for the various object languages supported by Domino ”LotusScript and OLE, DXL, and JavaScript. When the graphic is clicked, Domino Help pops up to the correct help section for the selected object model. This provides a quick link to Help for the selected object model itself or its components . Figure 16.1 shows the JavaScript Object Model graphic in Designer 6.

Figure 16.1. The JavaScript Object Model graphic as shown in the Domino Designer 6.

In previous versions of Domino, you had to kludge your JavaScript code directly onto the Domino form manually in between tags. This is called inline scripting. In turn , any inline script placed on the form was then served up to the Web as pass-thru HTML. The reason that you had to use inline scripting was because there was no direct support for JavaScript in previous versions of the IDE. Full support for JavaScript began in R5, and IBM/Lotus has further expanded its adoption of JavaScript within Domino 6. JavaScript is truly an intrinsic interpreted programming language built right into the Designer 6 IDE. Inline scripting can still be used on your Domino pages and forms, but the support for JavaScript objects and events has come full-circle in Domino 6.

With JavaScript built right into the IDE, the programmer gets features such as a color -coded editor; syntax checking when being compiled; event placeholders such as onLoad , onClick , and onMouseOver ; and a JavaScript Header object in which to write and store JavaScript code.

The IDE also displays all the Designer's objects inside the IDE Object pane to the left of the screen as shown in Figure 16.2. It has two tabs: the Object tab and the Reference tab. On the Object tab, if there is code behind an object's event, the pointer marker becomes solid blue. When you select an event from the Object pane, the Programmer's pane shows the language choices for that event. Figure 16.3 shows the drop-down list of the supported language choices available. Notice that on the Client Run choice (Web or Client), the language choices change for the event. If Web is chosen , only JavaScript or Common JavaScript can be selected. Common JavaScript is script that can be used by the Notes client as well as the Web browser. You can write code for both run on events, unlike other objects for which only one code type can be stored on a form. Be warned that you might drive yourself crazy thinking that there's only one set of code and that the changes you put out aren't working, when actually there are really two sets. Overall, the IDE makes programming in Domino very easy to do, enables you to build code quickly, and lends itself nicely to the process of building any type of application.

Figure 16.2. The JavaScript Header object shown in the Domino Designer IDE.

Figure 16.3. The language choices in the Designer IDE.

The Reference tab in the Designer's Object pane allows the programmer to select various referenced methods available in the Document Object Model or the Web Document Object Model when JavaScript is used. Depending on the DOM selected, the various methods for the DOM appear in the Reference tab pane. You can double-click the desired method to paste it into the programmer's script pane. The reference contents also change based on the DOM object that is selected in the Object tab. If you do not want to see the Object pane, you can easily drag the pane divider all the way over the left, exposing a full screen for the Programmer's pane.

The IDE really provides the programmer with the ease of object and method access, onscreen reference, and, new to Domino 6, autocomplete pop-up functions.

Категории