Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Replaced 'cbx' and 'ct' with 'canvas'

Class Description: This class instantiates the Layout container and the workspace menus. It has to be noted that this class gets instantiated by the workspace manager, when a workspace gets activated, and hence it is internally dependent on the library to get instantiated.

Called By: cbx canvas.core.WSManager

Meta data to be considered: canvas.menuitems.metadata.getMenuTools(workspaceId) → This API returns a list of all the Workspace menus that are applicable for the workspace. The component developers may utilize this meta data to construct the workspace menus according to their UI.

...

Sample Code Snippet:

Code Block
languagejs
cbxcanvas.lib.workspaceContainer = Class(cbxcanvas.core.Component, 
{
	workspaceID: '',
	proportion: '',
	containerObj : null,
	constructor: function(config) 
	{
		cbxcanvas.lib.workspaceContainer.$super.call(this);
		this.workspaceID = config.WORKSPACE_ID;
		this.createContainer();
		if($("#"+this.workspaceID)[0])
		{
			$("#"+this.workspaceID)[0].style.display="block";
			this.createItems();
			$("#"+this.workspaceID).children().remove();
			$("#"+this.workspaceID).append(this.containerObj);
		}
		else
		{
			LOGGER.error("The workspace trying to be enabled is not a valid "
			+ "workspace for this channel.."
			+ " WORKSPACE ID: "+this.workspaceID);
		}
	},
	//Returns Workspace container object/
	getWSContainer: function() 
	{
		return this.getItem(0);
	},

	createContainer : function()
	{
		var wsContainerConfig =
		{
			"eleType":"div",
			"id":this.workspaceID+"_WORKSPACE_CONTAINER"
		};
		var container = new cbxcanvas.lib.layer(wsContainerConfig).getLayer();
		$(this.workspaceID).append(container);
		this.containerObj = container;
		this.addItem(this.containerObj)
	},
	createItems: function() 
	{
		var menuContainerConfig = 
		{
			"eleType":"div",
			"class":this.workspaceID+"_MENU_CONTAINER",
			"id":this.workspaceID+"_MENU_CONTAINER"
		}
		var menuContainer = new cbxcanvas.lib.layer(menuContainerConfig).getLayer();
		var menuItems = iportalcanvas.menuitems.metadata.getMenuTools(this.workspaceID);
		var layoutContainerConfig = 
		{
			"eleType":"div",
			"class":this.workspaceID+"_LAYOUT_CONTAINER",
			"id":this.workspaceID+"_LAYOUT_CONTAINER"
		}
		var subWorkspaceConf = 
		{
			"elem":layoutContainerParent,
			"workspaceId":this.workspaceID
		}

		/**/ * Instantiate layout manager on this Container 
*/
		this.layoutManager = new cbxcanvas.core.LayoutManager(subWorkspaceConf); 
	},

	getLayoutManagerObject: function() 
	{
		return this.layoutManager; 
	},
	
	getLayoutManagerDOM: function() 
	{
		return this.layoutManager.getContainer();
	},

	getWorkspaceWidgets: function() 
	{
		return this.layoutManager.getWidgetContainerComponent();
	},

	getWidgetContainer : function()
	{
		return this.layoutManager.widgetContainer;
	},

	getLayoutContainer : function()
	{
		return this.layoutManager.widgetContainer;
	}
});
CLCR.registerCmp({'COMP_TYPE':'WORKSPACE_CONTAINER'}, cbxcanvas.lib.workspaceContainer);

...