com.sage.swt.client.ui.builder
Class InstanceLoader

java.lang.Object
  extended by com.sage.swt.client.ui.builder.InstanceLoader

public class InstanceLoader
extends java.lang.Object

Loader used for loading an instance of a UI or popup form. If the instance is not the main UI instance, that instance is linked to its parent instance.


Constructor Summary
InstanceLoader(InstanceContext parentContext, UIDefinitionBuilder uiDefinitionBuilder, CommunicationEngineFactory communicationEngineFactory, DataEngineFactory dataEngineFactory, PreferenceStoreEngineFactory preferenceStoreEngineFactory, WidgetsEngineFactory widgetsEngineFactory, ActionsEngineFactory actionsEngineFactory, PropertyResolutionManagerFactory propertyResolutionManagerFactory, java.util.List<FeatureModule> featureModules, java.util.List<SwtActionFactory> actionFactories, GlobalCache globalCache, SwtErrorStack errorStack)
          Constructs an instance loader that will use the given factories and feature modules.
 
Method Summary
 void addActionFactory(SwtActionFactory actionFactory)
          Adds a SwtActionFactory to the factories that will be used by the UI for generating actions that will be bound to events in the UI.
 InstanceContext getParentContext()
          The parent context to link to a UI instance context created by this loader, or null if this loader is used for creating the main UI's context (which has no parent).
 void startLoad(java.lang.String portletCommunicationID, java.lang.String formID, boolean isPortal, java.lang.String webHelpPath, java.lang.String sessionID, java.lang.String contractPath, java.lang.String uiDefVersion, java.lang.String uiDefCategory, URLKey uiDefURLKey, boolean canHaveSameUIDefAsAncestor, com.google.gwt.user.client.ui.HasWidgets parentWidget, InstanceLoaderCallback callback)
           Starts the asynchronous load of the instance context.
 void startLoad(java.lang.String portletCommunicationID, java.lang.String formID, boolean isPortal, java.lang.String webHelpPath, java.lang.String sessionID, java.lang.String contractPath, java.lang.String uiDefVersion, java.lang.String uiDefCategory, URLKey uiDefURLKey, boolean canHaveSameUIDefAsAncestor, com.google.gwt.user.client.ui.HasWidgets parentWidget, SpinnerProgressControl loadingSpinner, java.lang.String portletObjectId, InstanceLoaderCallback callback)
          Starts the asynchronous load of the instance context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceLoader

public InstanceLoader(InstanceContext parentContext,
                      UIDefinitionBuilder uiDefinitionBuilder,
                      CommunicationEngineFactory communicationEngineFactory,
                      DataEngineFactory dataEngineFactory,
                      PreferenceStoreEngineFactory preferenceStoreEngineFactory,
                      WidgetsEngineFactory widgetsEngineFactory,
                      ActionsEngineFactory actionsEngineFactory,
                      PropertyResolutionManagerFactory propertyResolutionManagerFactory,
                      java.util.List<FeatureModule> featureModules,
                      java.util.List<SwtActionFactory> actionFactories,
                      GlobalCache globalCache,
                      SwtErrorStack errorStack)
Constructs an instance loader that will use the given factories and feature modules.

Parameters:
parentContext - The parent context to link to a UI instance context created by this loader, or null if this loader is used for creating the main UI's context (which has no parent).
uiDefinitionBuilder - The UI definition builder that this instance loader will use.
communicationEngineFactory - The communication engine factory that this instance loader will use.
dataEngineFactory - The data engine factory that this instance loader will use.
preferenceStoreEngineFactory - The preferencestore engine factory that this instance loader will use.
widgetsEngineFactory - The widgets engine factory that this instance loader will use.
actionsEngineFactory - The actions engine factory that this instance loader will use.
propertyResolutionManagerFactory - The property resolution manager factory that this instance loader will use.
featureModules - The feature modules that will interact with the instance context that this instance loader will load. This instance loader will invoke the feature modules in the order in which they are listed (which is basically the order in which they are added to the master builder).
actionFactories - A list of the SwtActionFactory that will be used to create actions that will be bound to events in the UI.
globalCache - The cache for storing external data-related definitions.
errorStack - The UI's stack of SWT errors.
Method Detail

startLoad

public void startLoad(java.lang.String portletCommunicationID,
                      java.lang.String formID,
                      boolean isPortal,
                      java.lang.String webHelpPath,
                      java.lang.String sessionID,
                      java.lang.String contractPath,
                      java.lang.String uiDefVersion,
                      java.lang.String uiDefCategory,
                      URLKey uiDefURLKey,
                      boolean canHaveSameUIDefAsAncestor,
                      com.google.gwt.user.client.ui.HasWidgets parentWidget,
                      InstanceLoaderCallback callback)

Starts the asynchronous load of the instance context. No "loading" spinner will be used. For preference store purposes, the portlet object ID will be inherited from the portlet ID of the loader's parent instance context (if that context exists). (In other words, a popup form uses this overload to load its instance, so it will share the portlet object ID of its parent, all the way up the ancestor chain until the main UI). If a UI is hosted within a URL portlet, its children (popup forms) should share the UI's non-empty portlet object ID. If the same UI is running standalone, it would have no portlet object ID, so its children will also have no portlet object IDs. The portal itself has no portlet object ID, so its children (such as its landing page) will have no portlet object IDs. Note that the landing page hosts URL portlet widgets, which themselves will generate portlet object IDs for the portlets hosted within them.

NOTE: This overload is meant to be called for loading child instances (such as popup forms).

Parameters:
portletCommunicationID - The instance's portlet communication ID (which is used for IPC purposes).
formID - The instance's form ID (think of it as the instance's variable name), or "" if this is the main UI.
isPortal - Whether or not this instance is the Portal application.
webHelpPath - The base URL path of the Web Help for this application. This will be used by help widgets on this UI to construct the full path to the web help topic - by combining the base path with the path to the topic specified in the HelpID property of the help widget.
sessionID - The session ID for this instance.
contractPath - The contract portion of the SData path. For example, it might be "sdata/swtportal/accpac/AR2100" (no path separator at the end).
uiDefVersion - The version that the declarative UI definition belongs to (for example, "ar60a").
uiDefCategory - The category that the declarative UI definition belongs to (for example, "agedReceivables").
uiDefURLKey - The UI definition's URL key (which is created using the contract path and declarative definition name).
canHaveSameUIDefAsAncestor - Whether or not the instance context can come from the same UI definition (in terms of its URL) as an ancestor instance. In other words, this indicates whether or not cycles are allowed. Set this flag to true for popup forms (and similar widgets) because you can have cycles - for example, a popup for a contact's details can open another "details" popup for that contact's related contacts. Set this flag to false For layout portlets (and similar widgets) because they have to be "completely" built within the main HTML page.
parentWidget - The widget that the rootWidget of the InstanceContext will be added to after the InstanceContext gets built. If this is the main UI's context, this parentWidget is typically the RootPanel. If null, then the InstanceContext's rootWidget will not be attached to anything (and it will be the responsibility of the caller to attach the rootWidget to something on the UI).
callback - A required callback that lets the instance loader notify the caller when the instance context's load is done or when the loader encounters an error that prevents it from finishing that load.
Throws:
java.lang.IllegalStateException - The required callback is null. (Other problems are reported via the callback if it isn't null.)

startLoad

public void startLoad(java.lang.String portletCommunicationID,
                      java.lang.String formID,
                      boolean isPortal,
                      java.lang.String webHelpPath,
                      java.lang.String sessionID,
                      java.lang.String contractPath,
                      java.lang.String uiDefVersion,
                      java.lang.String uiDefCategory,
                      URLKey uiDefURLKey,
                      boolean canHaveSameUIDefAsAncestor,
                      com.google.gwt.user.client.ui.HasWidgets parentWidget,
                      SpinnerProgressControl loadingSpinner,
                      java.lang.String portletObjectId,
                      InstanceLoaderCallback callback)
Starts the asynchronous load of the instance context.

Parameters:
portletCommunicationID - The instance's portlet communication ID (which is used for IPC purposes).
formID - The instance's form ID (think of it as the instance's variable name), or "" if this is the main UI.
isPortal - Whether or not this instance is the Portal application.
webHelpPath - The base URL path of the Web Help for this application. This will be used by help widgets on this UI to construct the full path to the web help topic - by combining the base path with the path to the topic specified in the HelpID property of the help widget.
sessionID - The session ID for this instance.
contractPath - The contract portion of the SData path. For example, it might be "sdata/swtportal/accpac/AR2100" (no path separator at the end).
uiDefVersion - The version that the declarative UI definition belongs to (for example, "ar60a").
uiDefCategory - The category that the declarative UI definition belongs to (for example, "agedReceivables").
uiDefURLKey - The UI definition's URL key (which is created using the contract path and declarative definition name).
canHaveSameUIDefAsAncestor - Whether or not the instance context can come from the same UI definition (in terms of its URL) as an ancestor instance. In other words, this indicates whether or not cycles are allowed. Set this flag to true for popup forms (and similar widgets) because you can have cycles - for example, a popup for a contact's details can open another "details" popup for that contact's related contacts. Set this flag to false For layout portlets (and similar widgets) because they have to be "completely" built within the main HTML page.
parentWidget - The widget that the rootWidget of the InstanceContext will be added to after the InstanceContext gets built. If this is the main UI's context, this parentWidget is typically the RootPanel. If null, then the InstanceContext's rootWidget will not be attached to anything (and it will be the responsibility of the caller to attach the rootWidget to something on the UI).
loadingSpinner - The optional "loading" spinner.
portletObjectId - The instance's portlet Object ID (which is used for Preference Store purposes). If the portlet object ID is not specified (which would be the case for popup forms as we want them to have the same object ID as the main UI), it uses the portlet object ID of its parent (if the parent exists). Note the portal itself (and its child landing page) and UIs running standalone (in other words, not hosted within URL portlets) have no portlet object IDs.
callback - A required callback that lets the instance loader notify the caller when the instance context's load is done or when the loader encounters an error that prevents it from finishing that load.
Throws:
java.lang.IllegalStateException - The required callback is null. (Other problems are reported via the callback if it isn't null.)

getParentContext

public InstanceContext getParentContext()
The parent context to link to a UI instance context created by this loader, or null if this loader is used for creating the main UI's context (which has no parent).

Returns:
The parent context to link to a UI instance context.

addActionFactory

public void addActionFactory(SwtActionFactory actionFactory)
Adds a SwtActionFactory to the factories that will be used by the UI for generating actions that will be bound to events in the UI.

Parameters:
actionFactory - A SwtActionFactory that will be used by the UI for generating actions that will be bound to events in the UI.


Copyright © 2011 Sage Software, Inc. All rights reserved.