qx.Class.define("org.argeo.jcr.ria.views.TreeView", { 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 : { "zoom_in" : { label : "Zoom To Node", icon : "org.argeo.slc.ria/media-playback-start.png", shortcut : null, enabled : true, menu : "Context", toolbar : "context", callback : function(e) { var selection = this.tree.getSelection(); if(!selection.length) return; var path = selection[0].getJcrNode().getPath(); this.getDataModel().requireContextChange(path); }, selectionChange : function(viewId, selection){ if(viewId != "treeview") return; if(!selection || !selection.length) return; var treeNode = selection[0]; if(treeNode.getParent()!=null){ this.setEnabled(true); }else{ this.setEnabled(false); } } }, "zoom_out" : { label : "Zoom Out", icon : "org.argeo.slc.ria/media-playback-start.png", shortcut : null, enabled : true, menu : "Context", toolbar : "context", submenu : [], callback : function(e) { }, submenuCallback : function(commandId){ this.getDataModel().requireContextChange(commandId); }, selectionChange : function(viewId, selection){ if(viewId != "treeview") return; if(!selection || !selection.length) return; var treeNode = selection[0]; if(treeNode.getParent()!=null || treeNode.getJcrNode().itemIsRoot()){ this.setEnabled(false); return; } this.setEnabled(true); var nodePath = treeNode.getJcrNode().getPath(); var parts = nodePath.split("\/"); var pathes = []; parts.pop(); if(parts.length > 1){ var initLength = parts.length; for(var i=0;i