1
InstanceLayout=function(params)
3
//setting Layout Properties
5
this.sourceEl = params.sourceEl;
6
this.targetEl = params.targetEl;
7
this.instanceMgr = new InstanceManager();
9
this.canvas = new GCanvas({
11
scrollEl : 'canvas-container',
18
var canvas = this.canvas;
19
this.canvas.listeners = {
20
onDoubleClick : function (type, phase) {
21
canvas.setActivePhase(phase);
25
var mgr = this.instanceMgr;
27
this.tools = new ToolWidget({ id: this.id + '.tools',
28
orientation: 'vertical',
29
tools: [ { class : 'add', label: 'New Instance', handler : function() {alert('New Instanace is a ToDo!')}},
30
{ class : 'share', label: 'Share', handler : function() { alert('Share is a ToDo!') }} ]
33
this.client = new GClient(guser.getSession());
34
var client = this.client;
36
// We configure the actions to take when a instance is selected
37
this.instanceList = new InstanceListWidget({ listeners : { rowselect: function(sm, rowIdx, r) {
38
mgr.instance = r.data;
39
var modelRef = r.data.modelversion.modelref.href;
40
var modelId = modelRef.substring(modelRef.lastIndexOf('/')+1);
41
var modelVersion = r.data.modelversion.version;
42
mgr.model = client.getModel(modelId, modelVersion,
44
canvas.load(obj, r.data.id_trace.value);
49
//diag.model = r.data;
54
var instanceList = this.instanceList;
56
this.instanceMgr.listeners = {
57
onDelete : function () {
58
//we should sync this visually instead of performing calls..
59
client.getInstanceList(function(obj) {
60
instanceList.load(obj.model);
66
InstanceLayout.prototype.render = function(){
67
//document.getElementById(this.targetEl).innerHTML = document.getElementById(this.sourceEl).innerHTML;
68
this.tools.render('w_toolbar');
70
this.client.getInstanceList(function(obj) {
71
widget.instanceList.load(obj.instanceList);
72
widget.instanceList.render('content-work');