...
Sample Code Snippet:
Code Block | ||
---|---|---|
| ||
cbxcanvas.lib.ApplicationContainer = Class(cbx.core.Component, { layoutManager: '', constructor: function(config){ this.wsManagerConfig = config; cbxcanvas.lib.ApplicationContainer.$super.call(this); this.createItems(); }, createItems: function() { var appContainerConfig = { "eleType":"div", "id":"application-container" }; var appContainerObj = new cbxcanvas.lib.layer(appContainerConfig).getLayer(); this.addItem(appContainerObj); delete appContainerConfig; /* Start process of creating the workspace and layout */ var wsContainerConfig; var wsArr = cbx.core.ws.metadata.getWorkspaces(); cbxcanvas.lib.workspacehandler.createWorkspaces(wsArr,this); }, /* Return the object of app container containing the workspaces*/ getAppContainer: function() { return this.getItem(0); } }); CLCR.registerCmp({'COMP_TYPE':'APPLICATION_CONTAINER'},cbxcanvas.lib.ApplicationContainer); It has to be noted in the above snippet that cbxcanvas.lib.workspacehandler.createWorkspaces() is a utility API which creates the workspace elements for the array of the workspaces passed, and finally appends to the parent element. Here is what this utility API is supposed to do. var workspaceContainerConfig = { "eleType": "div", "id" : wsArray[index].WORKSPACE_ID, "class": "workspace "+wsArray[index].WORKSPACE_ID, "style": { "display":"none" } }; var wcContainerObject = new cbxcanvas.lib.layer(workspaceContainerConfig).getLayer(); $(this.appContainer.getItem(0)).append($(wcContainerObject)); The following code snippet shows the usage of workspace selection handler: activateWorkspace: function(workspaceId,index,callBackFn,scope){ callBackFn = cbx.isFunction(callBackFn)?callBackFn:cbx.emptyFn; scope = scope?scope: this; var config = { WORKSPACE_ID:workspaceId, SYSTEM_WORKSPACE_IND:SYSTEM_WORKSPACE_IND }; /** * Pre workspace activate operations here */ cbx.core.ws.metadata.getWorkspaceManager().wsSelectionHandler(config,null,function(wsContainer){ /** * Post workspace activate operations here */ },scope); } |
...