From: Charles du Jeu Date: Thu, 29 Apr 2010 10:47:37 +0000 (+0000) Subject: New layout, new views... X-Git-Tag: argeo-slc-2.1.7~1333 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=730d2bd9dcd58cf9ff28115174a2a43f2c1359cd;p=gpl%2Fargeo-slc.git New layout, new views... git-svn-id: https://svn.argeo.org/slc/trunk@3521 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/JcrBrowser.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/JcrBrowser.js index 0c01772d5..c997eaab5 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/JcrBrowser.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/JcrBrowser.js @@ -42,9 +42,9 @@ qx.Class.define("org.argeo.jcr.ria.JcrBrowser", viewsManager.getViewPanesContainer().add(this._tBar); this._splitPane = new qx.ui.splitpane.Pane("horizontal"); - var leftPane = new org.argeo.ria.components.ViewPane("treeview", "Tree View"); + var leftPane = new org.argeo.ria.components.TabbedViewPane("treeview", "Tree View"); this._splitPane.add(leftPane, 1); - var mainPane = new org.argeo.ria.components.ViewPane("fulltree", "Editor View"); + var mainPane = new org.argeo.ria.components.TabbedViewPane("editor", "Editor View", true); this._splitPane.add(mainPane, 2); viewsManager.registerViewPane(this._tBar); viewsManager.registerViewPane(mainPane); @@ -67,11 +67,17 @@ qx.Class.define("org.argeo.jcr.ria.JcrBrowser", var inputView = viewsManager.initIViewClass(org.argeo.jcr.ria.views.ContextNodeInputView, "toolbar", dataModel); inputView.load(); + /* var testView = viewsManager.initIViewClass(org.argeo.jcr.ria.views.PlainXmlViewer, "fulltree", dataModel); testView.load(); + */ + var listView = viewsManager.initIViewClass(org.argeo.jcr.ria.views.ListView, "editor", dataModel); + listView.load(); var treeView = viewsManager.initIViewClass(org.argeo.jcr.ria.views.TreeView, "treeview", dataModel); treeView.load(); + + dataModel.requireContextChange(); }, remove : function(viewsManager){ diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/model/DataModel.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/model/DataModel.js index 4432c8066..a8f75c0eb 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/model/DataModel.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/model/DataModel.js @@ -17,6 +17,11 @@ qx.Class.define("org.argeo.jcr.ria.model.DataModel", { check : "Array", event : "changeSelection", init : [] + }, + selectionSource : { + check : "Object", + init : null, + nullable : true } }, @@ -58,7 +63,11 @@ qx.Class.define("org.argeo.jcr.ria.model.DataModel", { this.fireDataEvent("changeContextNode", targetNode); }; targetNode.addListener("changeLoadState", observer, this); - targetNode.load(); + targetNode.load(1); + }, + setSelectionWithSource : function(selection, source){ + this.setSelectionSource(source); + this.setSelection(selection); } } diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/model/Node.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/model/Node.js index f8d59f7f7..81edc5218 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/model/Node.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/model/Node.js @@ -41,8 +41,10 @@ qx.Class.define("org.argeo.jcr.ria.model.Node", { _children : null, _properties : null, - load : function(){ - this.getNodeProvider().loadNode(this); + load : function(depth, filter){ + if(!depth) depth = 1; + if(!filter) filter = ''; + this.getNodeProvider().loadNode(this, depth, filter); }, remove : function(){ diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/provider/INodeProvider.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/provider/INodeProvider.js index fe81c569d..867ad611a 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/provider/INodeProvider.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/provider/INodeProvider.js @@ -1,6 +1,6 @@ qx.Interface.define("org.argeo.jcr.ria.provider.INodeProvider", { members : { initProvider : function(properties){}, - loadNode : function(path, nodeCallback, childCallback){} + loadNode : function(path, depth, filter){} } }); \ No newline at end of file diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/provider/XmlNodeProvider.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/provider/XmlNodeProvider.js index 41a830c83..19990d04f 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/provider/XmlNodeProvider.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/provider/XmlNodeProvider.js @@ -27,7 +27,7 @@ qx.Class.define("org.argeo.jcr.ria.provider.XmlNodeProvider", { * @param nodeCallback Function * @param childCallback Function */ - loadNode : function(node, nodeCallback, childCallback){ + loadNode : function(node, depth, filter){ if(node.getLoadState() == "loaded") return; if(this.getXmlDocLoaded()){ @@ -41,21 +41,23 @@ qx.Class.define("org.argeo.jcr.ria.provider.XmlNodeProvider", { } }else{ this.addListenerOnce("changeXmlDocLoaded", function(){ - this.loadNode(node, nodeCallback, childCallback); + this.loadNode(node, depth, filter); }, this); node.setLoadState("loading"); - this.loadXmlDoc(node); + this.loadXmlDoc(node, depth, filter); } }, - loadXmlDoc : function(node){ + loadXmlDoc : function(node, depth, filter){ var properties = this.getSettings(); if(!properties.xmlSrc && !properties.xmlString) return; if(properties.xmlSrc){ var request = new org.argeo.ria.remote.Request(properties.xmlSrc, 'GET', 'application/xml'); if(properties.dynamic && properties.pathParameter){ request.setParameter(properties.pathParameter, (node.getPath()|| "/")); - request.setParameter("depth", 1); + if(depth && depth != -1){ + request.setParameter("depth", depth); + } } request.addListener("completed", function(response){ this._xmlDoc = response.getContent(); diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/views/ContextNodeInputView.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/views/ContextNodeInputView.js index 5b94762c1..bf01cefbc 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/views/ContextNodeInputView.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/views/ContextNodeInputView.js @@ -45,7 +45,7 @@ qx.Class.define("org.argeo.jcr.ria.views.ContextNodeInputView", { this.set({ layout : new qx.ui.layout.HBox(), dataModel : dataModel, - padding: 10, + padding: 5, decorator : 'toolbar' }); @@ -60,6 +60,7 @@ qx.Class.define("org.argeo.jcr.ria.views.ContextNodeInputView", { this.selectionInput = new qx.ui.form.TextField(); this.selectionInput.setWidth(300); + this.selectionInput.setReadOnly(true); this.add(this.selectionInput); this._attachInputsToDM(); diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/views/ListView.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/views/ListView.js new file mode 100644 index 000000000..24ee64929 --- /dev/null +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/jcr/class/org/argeo/jcr/ria/views/ListView.js @@ -0,0 +1,137 @@ +qx.Class.define("org.argeo.jcr.ria.views.ListView", { + 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 : {} + }, + viewSelection : { + nullable:false, + check:"org.argeo.ria.components.ViewSelection" + }, + instanceId : { + init:"listView", + event : "changeInstanceId" + }, + instanceLabel : { + init:"List", + 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); + + var split = new qx.ui.splitpane.Pane("vertical"); + split.setDecorator(null); + this.add(split, {flex:1}); + + this.list = new qx.ui.form.List(); + split.add(this.list,1); + + this.propInput = new qx.ui.form.TextArea(); + split.add(this.propInput,1); + var call = new qx.util.DeferredCall(function(){ + qx.bom.element.Style.set(this.propInput.getContentElement().getDomElement(), "lineHeight", "1.8"); + }, this); + call.schedule(); + }, + /** + * The implementation should contain the real data loading (i.o. query...) + * @return {Boolean} + */ + load : function(){ + var dataModel = this.getDataModel(); + dataModel.addListener("changeSelection", function(event){ + if(dataModel.getSelectionSource() == this) return; + var selection = event.getData(); + this.list.removeAll(); + if(!selection.length) { + return; + } + var contextNode = selection[0]; + this._parseNode(contextNode); + }, this); + }, + + _parseNode : function (jcrNode){ + if(jcrNode.getLoadState() == "loaded"){ + this.list.removeAll(); + if(jcrNode.getParent()){ + this.list.add(this._initListItem(jcrNode.getParent(), "..")); + } + var children = jcrNode.getChildren(); + for(var i=0;i]*)>", "gi"); + var TAG_END_PATTERN = new RegExp("", "gi"); + var TAG_CLOSE_PATTERN = new RegExp("(/?>)", "gi"); + var TAG_ATTRIBUTE = new RegExp("\\s([0-9a-zA-Z:_]+)\\=\"([^\"]*)\"", "gi"); + // Not implemented yet + var TAG_COMMENT = new RegExp("()", "gi"); + var TAG_CDATA_START = new RegExp("(\\)", "gi"); + + xmlString = xmlString.replace(TAG_START_PATTERN, 'xml_div_begin<xml_tagname_begin$1xml_tagname_end$2>'); + xmlString = xmlString.replace(TAG_END_PATTERN, '</xml_tagname_begin$1xml_tagname_end>xml_div_end'); + xmlString = xmlString.replace(TAG_CLOSE_PATTERN, '>'); + + xmlString = xmlString.replace(TAG_ATTRIBUTE, ' xml_attname_begin$1xml_attname_end="xml_attvalue_begin$2xml_attvalue_end"'); + + //xmlString = qx.xml.String.escape(xmlString); + xmlString = xmlString.replace(new RegExp("(xml_div_begin)", "g"), '
'); + xmlString = xmlString.replace(new RegExp("(xml_div_end)", "g"), '
'); + xmlString = xmlString.replace(new RegExp("(xml_tagname_begin)", "g"), ''); + xmlString = xmlString.replace(new RegExp("(xml_tagname_end)", "g"), ''); + xmlString = xmlString.replace(new RegExp("(xml_attname_begin)", "g"), ''); + xmlString = xmlString.replace(new RegExp("(xml_attname_end)", "g"), ''); + xmlString = xmlString.replace(new RegExp("(xml_attvalue_begin)", "g"), ''); + xmlString = xmlString.replace(new RegExp("(xml_attvalue_end)", "g"), ''); + xmlString = '
' + xmlString + '
'; + this.htmlPane.setHtml(xmlString); + var call = new qx.util.DeferredCall(function(){ + var htmlDom = this.htmlPane.getContentElement().getDomElement(); + var spans = qx.bom.Selector.query("span", htmlDom); + for(var i=0;i]*)>", "gi"); - var TAG_END_PATTERN = new RegExp("", "gi"); - var TAG_CLOSE_PATTERN = new RegExp("(/?>)", "gi"); - var TAG_ATTRIBUTE = new RegExp("\\s([0-9a-zA-Z:_]+)\\=\"([^\"]*)\"", "gi"); - // Not implemented yet - var TAG_COMMENT = new RegExp("()", "gi"); - var TAG_CDATA_START = new RegExp("(\\)", "gi"); - - xmlString = xmlString.replace(TAG_START_PATTERN, 'xml_div_begin<xml_tagname_begin$1xml_tagname_end$2>'); - xmlString = xmlString.replace(TAG_END_PATTERN, '</xml_tagname_begin$1xml_tagname_end>xml_div_end'); - xmlString = xmlString.replace(TAG_CLOSE_PATTERN, '>'); - - xmlString = xmlString.replace(TAG_ATTRIBUTE, ' xml_attname_begin$1xml_attname_end="xml_attvalue_begin$2xml_attvalue_end"'); - - //xmlString = qx.xml.String.escape(xmlString); - xmlString = xmlString.replace(new RegExp("(xml_div_begin)", "g"), '
'); - xmlString = xmlString.replace(new RegExp("(xml_div_end)", "g"), '
'); - xmlString = xmlString.replace(new RegExp("(xml_tagname_begin)", "g"), ''); - xmlString = xmlString.replace(new RegExp("(xml_tagname_end)", "g"), ''); - xmlString = xmlString.replace(new RegExp("(xml_attname_begin)", "g"), ''); - xmlString = xmlString.replace(new RegExp("(xml_attname_end)", "g"), ''); - xmlString = xmlString.replace(new RegExp("(xml_attvalue_begin)", "g"), ''); - xmlString = xmlString.replace(new RegExp("(xml_attvalue_end)", "g"), ''); - xmlString = '
' + xmlString + '
'; - this.htmlPane.setHtml(xmlString); - var call = new qx.util.DeferredCall(function(){ - var htmlDom = this.htmlPane.getContentElement().getDomElement(); - var spans = qx.bom.Selector.query("span", htmlDom); - for(var i=0;i