Views (Properties and Events)

In the W4T Perspective to the right of the editor you see the Properties and Events Views. (They are piled one above the other. You can switch between them using the register tabs on the bottom of the Views.)

Both views are used to configure components which are worked on in the editor. The editor must be in the Designer mode to edit component properties and events.

Both the Properties and the Events View apply to the component which is currently selected in the editor. You can select components by their name from the Outline View (on the bottom left side of the workbench). Components you have just added are automatically selected.

Components are named automatically (they get names like webButton1 assigned by the code generator). They will be known under that name both in the generated code files (a member is created) and in the Outline View. You can always change the name of components by editing the name attribute in the Properties View.


The Properties View

Properties of components correspond to attributes that can be set and got by setters and getters. Whatever is of interest concerning a button, label or other component (like its background color, the text displayed on it, and also special settings like configuration files and so on) is specified via an attribute, and that attribute can be edited from the Properties View.

Note: if you have created a user-defined component and added it to the Widget Selector as described here, you can provide it with getters and setters for an attribute, and that attribute will be shown in the Properties along with the standard attributes. (At least if it is some simple type like a primitive type or String, WebColor etc. - for complex user-defined types, the editor cannot know how to edit them, of course ...)


The Events View

Most of the W4 Toolkit components trigger events of different kinds. For example, a WebButton fires a WebActionEvent when the user clicks it, a WebText or a WebSelect fires a WebItemEvent when the text or the selection on it has been changed by the user. Another sort of events are the container events of forms and panels and the special events for WebForms.

Look here for detailed information about events.

Events are triggered by adding an event listener to the component as an anonymous class. This is done automatically for you. An event handling entry method is generated. This method is called when the event occurs.

This means for you, that everything you have to do is to type your code (whatever should be executed when the event occurs) into the entry method.

Now how do you find that entry method? On the Events View for a component (let's say: some WebButton), select the event type for the event method you want to be generated. Hit the '+' button that occurs in the editor cell. A method is generated (you may change its name if you don't like the default name, but don't forget to save here ...). Now switch to the Java editor part of the editor. Somewhere near the end of the source file, you will find a code block with user-defined event listener code. The entry method just generated is here, too.

When implementing user-defined event code, make sure you stay within the special tags ('//$userdefinedEventListener_start' and '//$userdefinedEventListener_end'). Everything else is permanently generated anew, and you will lose everything you have typed in if you don't follow that rule. (But see here for an exception.)

Important Notice

Actions are not executed in the Designer Editor, so if you want to test an action you should select the "Run as" -> "W4 Toolkit Application" from the "Run" Menu of Eclipse. This will open any WebForm in a Browser window. More information is available here.

.


Copyright (c) 2003 by Innoopract Informationssysteme GmbH. All rights reserved.