X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=server%2Forg.argeo.slc.ria%2Fsrc%2Fargeo-ria-lib%2Fslc%2Fclass%2Forg%2Fargeo%2Fslc%2Fria%2Fmonitor%2FDistListView.js;h=a444bdadbd3b4ee3e47094abd89804e0fb1eb013;hb=096964f665fc3b0e3d233b498b8b30823ae5fa36;hp=129d1a91a62974ac51b1b9c52bebb177952b881b;hpb=8c0984b6c89376160effcaa5cb73ec6a1f59208c;p=gpl%2Fargeo-slc.git diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/monitor/DistListView.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/monitor/DistListView.js index 129d1a91a..a444bdadb 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/monitor/DistListView.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/monitor/DistListView.js @@ -8,7 +8,20 @@ qx.Class.define("org.argeo.slc.ria.monitor.DistListView", { * See {@link org.argeo.ria.event.CommandsManager#definitions} for the keys to use for defining commands. */ commands : { - init : {} + init : { + "reload" : { + label : "Reload", + icon : "org.argeo.slc.ria/view-refresh.png", + shortcut : "control+h", + enabled : true, + menu : "Distributions", + toolbar : "list", + callback : function(e) { + this.load(); + }, + command : null + } + } }, viewSelection : { nullable:false, @@ -23,10 +36,10 @@ qx.Class.define("org.argeo.slc.ria.monitor.DistListView", { construct : function(){ this.base(arguments); - this.setLayout(new qx.ui.layout.Dock()); + this.setLayout(new qx.ui.layout.Canvas()); this.xmlStub = '' + '' + - '' + + 'toto' + '' + '' + '' + @@ -48,20 +61,68 @@ qx.Class.define("org.argeo.slc.ria.monitor.DistListView", { init : function(viewPane, data){ this.setView(viewPane); this.setViewSelection(new org.argeo.ria.components.ViewSelection(viewPane.getViewId())); - this.label = new qx.ui.basic.Label("Properties"); - this.add(this.label, {edge : "center"}); + this.tableModel = new qx.ui.table.model.Simple(); + this.tableModel.setColumns(["Name", "Version", "Modular Distribution", "Eclipse Update Site"], ["name","version","modularDistribution","eclipse"]); + this.list = new qx.ui.table.Table(this.tableModel, { + tableColumnModel: function(obj){ + return new qx.ui.table.columnmodel.Resize(obj) + } + }); + this.list.set({ + decorator:null, + statusBarVisible : false + }); + this.tableModel.setColumnEditable(2, true); + this.tableModel.setColumnEditable(3, true); + var columnModel = this.list.getTableColumnModel(); + columnModel.getBehavior().setWidth(0, "15%"); + columnModel.getBehavior().setWidth(1, "15%"); + columnModel.getBehavior().setWidth(2, "35%"); + columnModel.getBehavior().setWidth(3, "35%"); + var factory = function(cellInfo){ + var tField = new qx.ui.table.celleditor.TextField(); + tField.setValidationFunction(function(newValue, oldValue){return oldValue;}); + return tField; + }; + columnModel.setCellEditorFactory(2, new qx.ui.table.celleditor.Dynamic(factory)); + columnModel.setCellEditorFactory(3, new qx.ui.table.celleditor.Dynamic(factory)); + this.add(this.list, {top:0,left:0,width:'100%',height:'100%'}); }, /** * The implementation should contain the real data loading (i.o. query...) * @return {Boolean} */ load : function(){ - + this.tableModel.setData([]); + var req = org.argeo.slc.ria.SlcApi.getListModularDistributionsService(); + req.addListener("completed", function(response){ + this.parseData(response.getContent()); + }, this); + req.addListener("failed", function(){ + var xmlDoc = qx.xml.Document.fromString(this.xmlStub); + this.parseData(xmlDoc); + }, this); + req.send(); }, - updateData : function(node){ - this.label.setContent("Properties for : " + node.getLabel()); + parseData : function(xmlDoc){ + var data = []; + var descriptorPath = 'slc:object-list/slc:modular-distribution-descriptor'; + var namePath = '@name'; + var versionPath = '@version'; + var distribPath = 'slc:modulesDescriptors/slc:modulesDescriptor[@type="modularDistribution"]/@url'; + var eclipsePath = 'slc:modulesDescriptors/slc:modulesDescriptor[@type="eclipse"]/@url'; + var nodes = org.argeo.ria.util.Element.selectNodes(xmlDoc, descriptorPath); + for(var i=0;i