Initializing the Desktop

About this task
The Desktop is started by running the Desktop class. The initialization process parses the definitions included in the Desktop definition file (desktop.xml), and converts all the tags to their corresponding components. The external file can be defined in the toolkit configuration file, and is named desktop.xml by default.

When the Desktop is initialized, each Desktop component is instantiated, has its attributes set, and is added to its parent component. Any component that is to be added to the Desktop must implement an attribute setter method for each of its attributes. The name of the attribute setter method must be of the form "setXxxx", where "xxxx" is the attribute name as defined in the Desktop definition file. Any component that is to have child components added to it must implement an Object adder method named "add".

The components are added to the visual layout of the Desktop in the order of their insertion into the XML file. Therefore, you must set the corresponding sizes (widths and heights) of the elements inserted in the XML file in order to accommodate them correctly.

The Desktop is a top-level object that builds the Desktop layout based upon the definitions belonging to the rest of the elements in the XML file. Unlike any other element, another class cannot be substituted for the Desktop in the external file. If the whole set of classes directly related to it is copied to a different package, then the new Desktop class can be used instead. This process is recommended in cases where additional functionality is required and changing the base code would prove difficult.

When the Desktop is created and filled with all the components defined in the XML file, it keeps a list of TaskInfo objects. This list allows the application and some other internal Desktop components to get specific task information. When a component implementing the TaskLauncher interface is added to the Desktop, a new TaskInfo component will be created if the TaskLauncher completely defines a task.