|
| AddressBook QBeans JDO Sample Application Tour |
| Previous | Next |
The "main" Method
The AddressBookApplication.java source contains the code required to launch the application and contruct the main application frame:![]() The class extends QAbstractApplication, and includes a main method that is responsible simply to
The settings permitted in the resource bundle are more clearly described in the resource bundle itself. An additional set of configuration files are provided that describe the data source(s) being used by the applications. QBeans uses these files upon the first attempt of the application to access business objects in the datasource. These properties files are located in the AddressBookApp/src/addressbook/res/datasources folder, and contain settings specific to the datasources. Menu and toolbars are created as collection of command beans called Functions that can perform any number of duties. For the most part in the application menus and toolbars, functions are created to construct and launch the particular views that are associated to the application. The following code snippet adds a QActionWindowFunction that launches the PersonsView to a menu on the menu bar:
menuEdit.add(new QActionWindowFunction("addressbook.views.PersonsView",
"AddressBook", "AddressBook", "View / modify AddressBook", getImage("people_16X16.png"))); These functions dynamically load the view by its classname in this case addressbook.views.PersonsView. Another function used to load the database is created as an inner class of the Application class and is added to the application menubar. The innerclass is defined near the end of the file and illustrates the use of Functions in QBeans applications: private static class LoadDataFunction extends QAbstractFunction
|
| Previous | Next |