[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
WorkplaceFunctionTree create with pages with own Workpage class  XML
Forum Index -> Development
Author Message
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 750
Offline

Hi,

I created a MyWorkpage class which inherits from Workpage, there I override the close() method. This works fine, for page I create and manually add to the container, but in the WorkplaceFunctionTree I see no possibility to influence the class which creates the page?

Markus
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5538
Offline

Hi,

the execute on the workplace function tree component callse the following method of WorkplaceFUnctionTree:

Code:
     protected void loadContentPage(WorkpageStartInfo wpi)
     {
         WorkpageStarterFactory.getWorkpageStarter().
             startWorkpage((IWorkpageDispatcher)getOwningDispatcher(),
                            getWorkpageContainer(),
                            wpi);
     }
 


Either you overwrite this (protected) method or you write an own workpage starter, this is the code of the factory class:
Code:
 **
  * Factory for providing the object that starts a workpage.
  */
 public class WorkpageStarterFactory
 {
     static IWorkpageStarter s_wps = new WorkpageDefaultStarter();
     
     /**
      * This method allows to explicitly define an own workpage starter environment.
      * By default the {@link WorkpageDefaultStarter} class is used.
      */
     public static void setWorkpageStarter(IWorkpageStarter wps)
     {
         s_wps = wps;
     }
     
     public static IWorkpageStarter getWorkpageStarter() { return s_wps; }
 }


The interface of IWorkplageStarter is:

Code:
 package org.eclnt.workplace;
 
 import java.io.Serializable;
 
 /**
  * Starts a workpage with the information specified in the startInfo parameter
  * within the workplace environment provided by  "workplaceDispatcher" 
  * and "workpageContainer".
  * <br><br>
  * This is the central interface for starting workpages: any place in the workplace
  * management where workpages are started from (e.g. workplace function tree, favorite
  * icons, ...) do so by using this interface.
  * <br><br>
  * The class {@link WorkpageStarterFactory} is the one that serves as factory
  * for manageing the instance of {@link IWorkpageStarter}.
  */
 public interface IWorkpageStarter
     extends Serializable
 {
     public IWorkpage startWorkpage(IWorkpageDispatcher workpageDispatcher,
                                    IWorkpageContainer workpageContainer,
                                    WorkpageStartInfo startInfo);
 }
 


Pay attention: everywhere, where a page is stared out of "start information" (e.g. there is alsow a favorite-area etc.) is is done through this starter-mechanism. So, when you change, this is a change for all...
(...yes...: typically only the function trees are used to start functions from...)


Björn

Björn Müller, CaptainCasa GmbH
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 750
Offline

buuhhh, thanx that looks heavy, I'll take a deep look at this

Markus
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5538
Offline

...in order to increase the heaviness: this is the default starter:

Code:
 package org.eclnt.workplace;
 
 /**
  * Default implementation for {@link IWorkpageStarter}. You may sub-class
  * this implementation for adding own, specific start functions.
  */
 public class WorkpageDefaultStarter implements IWorkpageStarter
 {
     public IWorkpage startWorkpage(IWorkpageDispatcher workpageDispatcher,
                               IWorkpageContainer workpageContainer, 
                               WorkpageStartInfo startInfo)
     {
         if (startInfo.getOpenMultipleInstances() == false)
         {
             IWorkpage wp = workpageContainer.getWorkpageForId(startInfo.getId());
             if (wp != null)
             {
                 workpageContainer.switchToWorkpage(wp);
                 return wp;
             }
         }
         // create new page
         Workpage wp = new Workpage(workpageDispatcher,
                                    startInfo.getJspPage(),
                                    startInfo.getId(),
                                    startInfo.getText(),
                                    startInfo.getImage(),
                                    startInfo.isDecorated());
         wp.setPopupSupported(startInfo.isPopupSupported());
         wp.setSelectorTitle(startInfo.getSelectorTitle());
         wp.setIconURL(startInfo.getImage());
         for (String paramName: startInfo.getParamMap().keySet())
             wp.setParam(paramName,startInfo.getParamMap().get(paramName));
         // either add as workpage into the content area or open as popup
         if (startInfo.getOpenAsPopupDyDefault() == false)
             workpageContainer.addWorkpage(wp);
         else
             workpageContainer.addWorkpageAsPopup(wp);
         return wp;
     }
 }
 
 


Björn

PS: but - as mentioned above, mabye the fastest way to success is to just override the WorkplaceFunctionTree-method and do not care about "generic worgpage starting"...

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team