From: Charles du Jeu Date: Thu, 23 Jul 2009 11:38:02 +0000 (+0000) Subject: MonitorPerspective implementation X-Git-Tag: argeo-slc-2.1.7~1655 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=096964f665fc3b0e3d233b498b8b30823ae5fa36;p=gpl%2Fargeo-slc.git MonitorPerspective implementation git-svn-id: https://svn.argeo.org/slc/trunk@2731 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc-web/class/org/argeo/slc/web/MonitorPerspective.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc-web/class/org/argeo/slc/web/MonitorPerspective.js index 61f56e57b..12924780c 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc-web/class/org/argeo/slc/web/MonitorPerspective.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc-web/class/org/argeo/slc/web/MonitorPerspective.js @@ -29,8 +29,8 @@ qx.Class.define("org.argeo.slc.web.MonitorPerspective", initViewPanes : function(viewsManager){ this._splitPane = new qx.ui.splitpane.Pane("vertical"); - var mainPane = new org.argeo.ria.components.ViewPane("distrib", "Bundles"); - this._splitPane.add(mainPane, 5); + var mainPane = new org.argeo.ria.components.ViewPane("distrib", "Modular Distributions"); + this._splitPane.add(mainPane, 10); var uploadPane = new org.argeo.ria.components.ViewPane("upload", "Upload a distribution"); this._splitPane.add(uploadPane, 1); viewsManager.registerViewPane(mainPane); @@ -41,8 +41,8 @@ qx.Class.define("org.argeo.slc.web.MonitorPerspective", initViews : function(viewsManager){ var pView = viewsManager.initIViewClass(org.argeo.slc.ria.monitor.DistListView, "distrib"); - pView.load(); var view = viewsManager.initIViewClass(org.argeo.slc.ria.monitor.UploadView, "upload"); + pView.load(); view.load(); }, diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcApi.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcApi.js index d69830da2..b5604d4d5 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcApi.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcApi.js @@ -30,6 +30,9 @@ qx.Class.define("org.argeo.slc.ria.SlcApi", RELOAD_BUNDLE_SERVICE : "reloadBundle.service", AMQ_SERVICE : "amq", + LIST_MODULAR_DISTRIB_SERVICE : "listModularDistributions.service", + UPLOAD_MODULAR_DISTRIB_SERVICE : "uploadModularDistrib.service", + /** * Standard Request getter * @param serviceName {String} The name of the service to call (without base context) @@ -203,6 +206,23 @@ qx.Class.define("org.argeo.slc.ria.SlcApi", ); }, + /** + * List currently registered SlcExecutions. + * @param fireReloadEventType {String} Event type to trigger (optionnal) + * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update + * @return {qx.io.remote.Request} + */ + getListModularDistributionsService:function(fireReloadEventType, iLoadStatusables){ + return org.argeo.slc.ria.SlcApi.getServiceRequest( + org.argeo.slc.ria.SlcApi.LIST_MODULAR_DISTRIB_SERVICE, + fireReloadEventType, + iLoadStatusables + ); + }, + + getUploadModularDistributionsService : function(){ + return org.argeo.slc.ria.SlcApi.UPLOAD_MODULAR_DISTRIB_SERVICE; + }, /** * New SlcExecution 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"+qx.lang.String.stripTags(message)+""); + if(timer){ + qx.event.Timer.once(function(){ + this.messageLabel.setContent(""); + }, this, timer); + } }, /** * The implementation should contain the real data loading (i.o. query...) * @return {Boolean} */ - load : function(){ - + load : function(){ }, - updateData : function(node){ - this.label.setContent("Properties for : " + node.getLabel()); - }, /** * Whether this component is already contained in a scroller (return false) or not (return true). * @return {Boolean}