Device Application Designer Generated Code Structure

This topic illustrates the structure of code generated by the Device Application Designer, and describes the contents of folders.

The BlackBerry application is built into two parts: the client application and the options library. The application package contains all client code, while the options package contains options code. The custom package accommodates all screen classes as well as any tab folder packages. The tab panel classes are contained in the tab folder packages.

Client code is generated into two categories:
  1. Code is generated each time you invoke the Device Application Designer generation wizard. The Device Application Designer Model document is parsed and the screen classes and the BOBCUIDefinition/BOBCOptionsDefinition class are generated.
  2. User's custom code is initially generated by the Device Application Designer when the Device Application Designer generation wizard is invoked. The custom code extends the generated screen classes and BOBCUIDefinition/ BOBCOptionsDefinition class.
Modify the custom code only to customize your BlackBerry device application in the BlackBerry JDE (or any other Native IDE).


BlackBerry Generated Code Structure 2

Custom Coding Subclasses

You can enable custom code generation by assigning a value of true to the platform-specific property Generate a custom coding subclass for the Device, Screens, Tab Folder, and Tab panels. You can specify this property for all elements from the preference page.

Folder Contents

The default generated code location is <%current_workspace%>\<%current_project%>\DAD Generated Code\<%current_dad_file_name%>\Blackberry. In that location, the application client code is in the generated/application folder. The options module code is in the generated/options folder. The image files are in the generated/images folder. The JavaDoc files are in the generated/doc folder.

The custom code is generated into the custom folder in the same package structure as the generated folder. The applicationandoption folders, contain the custom code for the main application and the option application, respectively. For each element that enables custom coding, a subclass is generated into the application folder. Once generated, the custom subclass is not overwritten in subsequent code generation unless you select Remove custom folder in the generation wizard.

All object API code is generated into a separate folder named object_api. This folder contains subfolders for the main application and option application.

You can customize subclasses to insert your own code in your development environment.

Event Delegates

For elements that support widget events, you can specify what events are supported for a particular element. When you select events, those events take effect in the application. An event delegate is generated in the custom folder for all events (whether selected or not). This allows the delegation of all the selected events for an element. The event delegate class is in same package as its element’s containing class (that is, the event delegate class for a button is located in the same package as the subclass for the parent screen).

You can customize the event delegate to apply your own code.

Similar to the custom subclasses, the event delegate is not overwritten during subsequent code generation, unless you select Remove custom folder.