home
products
education
support
partners
company

introduction

get started

articles

manual

tutorials

reference docs

case studies

knowledge base

goodies

screenshots

demos

echoes

Carousel zone


SourceForge.net Logo

home

forums

downloads

bugs

mailing list
XUI Zone - articles

number of ratings 1
average rating 5.00

Using the page manager in the SugarCRM XUI client

The XPageManager object is used as soon as a XUI application starts up. It loads pages from a single page or from a framset depending on the startup properties settings. In the case of the SugarCRM application the startup.properties file has its UseFrames property set to true and the Frames property set to Frames. This ensures that the frames.xml file is used to create the initial application.

The main content startup page for the application is Welcome.xml which specifies the com.xoetrope.sugar.Welcome XPage in its class attribute. When the Work Offline button is clicked, the event declaration for the button shown in listing 1 which is taken from the Welcome.xml file, ensures that the code shown in listing 2 which is taken from the com.xoetrope.sugar.Welcome class is invoked.

Listing 1 - The event declaration


Listing 2 - The workOffline method
  public void workOffline()
  {
    CacheManager.openCacheFile();
    resetStyles();
    displayFrames( true );
    updateBannerPage();
    net.xoetrope.swing.XApplet.getMenuBar().setVisible( true );
    pageMgr.showPage( "offlinemenu" );
  }             

Before explaining the details of how the page manager is used in this example, we should first of all have a look at the logon page with its options displayed fully as shown below in Figure 1. In this application the user has a choice of themes and languages which is why we need to do a little more work with the XPageManager in the welcome class.

Figure 1 - The logon screen with it's options expanded

When the user chooses to work offline or to logon to the server, the page manager is reset so that the pages can be rebuilt again forcing the selected theme and language to be used. The displayFrames method which is shown in listing 3 is called when the user proceeds calling the reset method of the XPageManager before loading the relevant pages via the showPage method. Of course, if there is no language or style choice in the application, there will be no need to reset the page manager. After the workOffline method has been called the showPage of the XPageManager is called with the parameter offlinemenu in order to show that page.

Listing 3 - The displayFrames method
  private void displayFrames( boolean show )
  {
    if ( show ) {
      pageMgr.reset();
      pageMgr.showPage( "banner", "top" );
      pageMgr.showPage( "leftPanel", "left" );
      pageMgr.showPage( "navPanel", "bottom" );
    }
    for ( int i = 0; i < frames.length; i++ ) {
      Component comp = ((Component)pageMgr.getTarget( frames[ i ] ));
      comp.setVisible( show );
    }
  }     

Throughout the application the back buttons use the showPrevious method of the XPageManager class to move backwards through the XPage stack.

comments


If you were logged in you could rate this article or add a comment.