Xoetrope
HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Projects


In XUI a project acts as the root or owner for all objects within an application. The project also acts in a coordinating role, providing access to resources and components.

Adding extra project initialization
The initialization of the project can be extended by adding a ##LifeCycleListener##. The ##LifeCycleListener## interface is called during initialization and again at shutdown. The calls provide an opportunity to off-load project specific initialization functionality to custom classes without having to customize the ##XApplet## class, for example special database of connectivity functionality may require custom initialization prior to the display of the first page.

Thus in the startup.properties file:
  1. LifeCycleListener=com.mycompany.myproject.MyProjectInitializer


specifies a project lifecycle class, this class then implements the lifecycle methods:
  1. package com.mycompany.myproject;
  2.  
  3. import net.xoetrope.xui.XLifeCycleListener;
  4. import net.xoetrope.xui.XProject;
  5.  
  6. /**
  7. * Initialize the project's connection
  8. */
  9. public class MyProjectInitializerimplements XLifeCycleListener
  10. {
  11.   /**
  12.    * Called when the application/applet has been created and initialized.
  13.    * @param project the owner project
  14.    */
  15.   public void initialize( XProject project )
  16.   {
  17.     // Setup connections, etc... here
  18.   }
  19.  
  20.   /**
  21.    * Called when the application/applet has been shutdown and is about to exit
  22.    */
  23.   public void shutdown()
  24.   {
  25.     // Release resources, connections, etc... here
  26.   }
  27. }


In XUI 3 (aka Juice), a multi-project application style is being added whereby projects can be treated like modules and loaded within another project. The first loaded project is in control and specifies the general setup, with subsequent projects providing features for the first project. In this way related projects can collaborate and functionality can be reused in a modulear way.

Project Objects
As of XUI 3, the project may store a number of useful objects, these objects can be retrived by calling project.getObject( key ), where the key references the objects listed below:


It is not guaranteed that these objects are available and set. Nor is any guarantee given as to when the objects are created as the lifecycle of the various objects differ and may in some cases depend on the type and configuration of an application. The list is not exhaustive and other application components or extensions may add and use additional properties.


SourceForge Logo

There are no comments on this page. [Add comment]

Page was generated in 0.4045 seconds