X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=server%2Forg.argeo.slc.ria%2Fsrc%2Fargeo-ria-lib%2Fjcr%2Fclass%2Forg%2Fargeo%2Fjcr%2Fria%2Fviews%2FQueriesView.js;fp=server%2Forg.argeo.slc.ria%2Fsrc%2Fargeo-ria-lib%2Fjcr%2Fclass%2Forg%2Fargeo%2Fjcr%2Fria%2Fviews%2FQueriesView.js;h=0000000000000000000000000000000000000000;hb=f5619266b1acabf1cc375487818c3d6a6e0614dc;hp=9e66435418e0a8ff6583afb7d36198bf7b0bf32e;hpb=1973d521367cdfe1d467da2bb8a539284996bcf6;p=gpl%2Fargeo-slc.git diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/views/QueriesView.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/views/QueriesView.js deleted file mode 100644 index 9e6643541..000000000 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/views/QueriesView.js +++ /dev/null @@ -1,234 +0,0 @@ -qx.Class.define("org.argeo.jcr.ria.views.QueriesView", { - extend : qx.ui.container.Composite, - implement : [org.argeo.ria.components.IView], - - properties : { - /** - * The commands definition Map that will be automatically added and wired to the menubar and toolbar. - * See {@link org.argeo.ria.event.CommandsManager#definitions} for the keys to use for defining commands. - */ - commands : { - init : { - "refresh_query" : { - label : "Refresh", - icon : "org.argeo.jcr.ria/view-refresh.png", - shortcut : null, - enabled : true, - menu : "Query", - toolbar : null, - callback : function(e) { - var selection = this.tree.getSelection(); - if(!selection.length) return; - var treeNode = selection[0]; - this._submitQuery(treeNode); - }, - selectionChange : function(viewId, selection){ - this.setEnabled(false); - if(selection && selection.length && !selection[0].getJcrNode){ - this.setEnabled(true); - } - } - }, - "remove_query" : { - label : "Remove", - icon : "org.argeo.jcr.ria/edit-delete.png", - shortcut : null, - enabled : true, - menu : "Query", - toolbar : null, - callback : function(e) { - var selection = this.tree.getSelection(); - if(!selection.length) return; - var treeNode = selection[0]; - treeNode.getParent().remove(treeNode); - }, - selectionChange : function(viewId, selection){ - this.setEnabled(false); - if(selection && selection.length && !selection[0].getJcrNode){ - this.setEnabled(true); - } - } - } - } - }, - viewSelection : { - nullable:false, - check:"org.argeo.ria.components.ViewSelection" - }, - instanceId : { - init:"queriesView", - event : "changeInstanceId" - }, - instanceLabel : { - init:"Queries", - event : "changeInstanceLabel" - }, - dataModel : { - - } - }, - - construct : function(){ - this.base(arguments); - }, - - members : { - /** - * The implementation should contain the GUI initialisation. - * This is the role of the manager to actually add the graphical component to the pane, - * so it's not necessary to do it here. - * @param viewPane {org.argeo.ria.components.ViewPane} The pane manager - * @param data {Mixed} Any object or data passed by the initiator of the view - * @return {Boolean} - */ - init : function(viewPane, dataModel){ - this.setViewSelection(new org.argeo.ria.components.ViewSelection(viewPane.getViewId())); - this.setLayout(new qx.ui.layout.VBox()); - this.setDataModel(dataModel); - - this.radio = new qx.ui.form.RadioButtonGroup(new qx.ui.layout.HBox(5)); - var xPath = new qx.ui.form.RadioButton("XPath"); - xPath.setModel("xpath"); - var sql = new qx.ui.form.RadioButton("SQL"); - sql.setModel("sql"); - this.radio.add(xPath); - this.radio.add(sql); - - var topLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(5)); - topLayout.add(new qx.ui.basic.Label("Query (Ctrl+Enter to submit):")); - topLayout.add(new qx.ui.core.Spacer(), {flex:1}); - topLayout.add(this.radio); - topLayout.setPadding(0,2,2,2); - this.add(topLayout); - - this.textarea = new qx.ui.form.TextArea(); - this.textarea.setHeight(60); - this.textarea.setMarginBottom(5); - this.add(this.textarea); - this.textarea.addListener("keypress", function(e){ - if(e.getKeyIdentifier() == "Enter" && e.isCtrlOrCommandPressed()){ - this._submitQuery(); - } - }, this); - - - var resLabel = new qx.ui.basic.Label("Results"); - resLabel.setPadding(0, 2, 2, 2); - this.add(resLabel); - - this.tree = new qx.ui.tree.Tree(); - this.add(this.tree, {flex:1}); - }, - /** - * The implementation should contain the real data loading (i.o. query...) - * @return {Boolean} - */ - load : function(){ - var dataModel = this.getDataModel(); - - this.treeBase = new qx.ui.tree.TreeFolder("Queries"); - this.tree.setRoot(this.treeBase); - this.tree.setHideRoot(true); - this.treeBase.setOpen(true); - - this.tree.addListener("changeSelection", function(e){ - var sel = this.tree.getSelection(); - var selection = []; - var viewSelection = this.getViewSelection(); - viewSelection.clear(); - for(var i=0;i