...
Code Block |
---|
{
"layoutManager":"The layout manager Object",
"workspaceID":"The ID of the Workspace currently active",
"layoutType":"The Layout Type of the Workspace",
"elem":"The parent element"
}
Sample Code Snippet:
canvas.lib.layoutContainer = Class(cbx.core.Component,{
layoutManager:null,
workspaceID:'',
constructor: function(config){
this.layoutManager = config.layoutManager;
this.workspaceID = config.workspaceID;
this.layoutId = config.layoutId;
this.layoutType = ct.metadata.getWorkSpaceById(this.workspaceID).WORKSPACE_LAYOUT
canvas.lib.layoutContainer.$super.call(this);
var layoutContainerObj = config.elem;
this.addItem(layoutContainerObj);
var that = this;
var layoutArr = cbx.core.ws.metadata.getLayoutsForWS(this.workspaceID);
var layoutContainer;
switch(this.layoutType){
case "STACK":
for ( var index = 0; index < layoutArr.length; index++) {
var rb = CRB.getBundle(layoutArr[index].LD_BUNDLE_KEY);
var title = rb[layoutArr[index].LAYOUT_DISPLAY_NM];
/**
* Render layoutContainer as stack
*/
}
break;
case "TAB" :
for ( var index = 0; index < layoutArr.length; index++) {
var rb = CRB.getBundle(layoutArr[index].LD_BUNDLE_KEY);
var title = rb[layoutArr[index].LAYOUT_DISPLAY_NM];
/**
* Render layoutContainer as tab
*/
}
break;
case "L-MENU" :
for ( var index = 0; index < layoutArr.length; index++) {
var rb = CRB.getBundle(layoutArr[index].LD_BUNDLE_KEY);
var title = rb[layoutArr[index].LAYOUT_DISPLAY_NM];
/**
* Render layoutContainer as L-MENU
*/
}
break;
case "R-MENU" :
for ( var index = 0; index < layoutArr.length; index++) {
var rb = CRB.getBundle(layoutArr[index].LD_BUNDLE_KEY);
var title = rb[layoutArr[index].LAYOUT_DISPLAY_NM];
/**
* Render layoutContainer as R-MENU
*/
}
break;
}
this.getItem(0).appendChild(layoutContainer);
},
getLayoutContainer: function() {
return this.getItem(0);
}
});
CLCR.registerCmp({'COMP_TYPE':'PARENT_LAYOUT_CONTAINER'}, canvas.lib.layoutContainer);
|
There
...
are
...
a
...
lot
...
of
...
ways
...
of
...
rendering
...
this,
...
and
...
the
...
library
...
developers
...
can
...
internally
...
user
...
CLCR
...
again
...
to
...
render
...
their
...
components
...
according
...
to
...
the
...
layout
...
types.
...
On
...
Activating
...
a
...
layout
...
(if
...
applicable),
...
the
...
library
...
developers
...
must
...
do
...
something
...
like
...
the
...
following:
...
Code Block | ||
---|---|---|
| ||
var that = this; layout.on('activate',function(){ var config ={ /** * You can pass on your scope to widget container here */ }; that.layoutManager.getWidgetContainer(config); }) |