Use a specific renderer for status cell background management / Disable the mouse...
authorCharles du Jeu <charles.dujeu@gmail.com>
Mon, 8 Dec 2008 19:12:01 +0000 (19:12 +0000)
committerCharles du Jeu <charles.dujeu@gmail.com>
Mon, 8 Dec 2008 19:12:01 +0000 (19:12 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@1964 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/slc/web/Applet.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/slc/web/StatusCellRenderer.js [new file with mode: 0644]

index 8d1e794367ca5494abef4587a3d27ef46f3647dc..8c1943343f77eac1063ef43763a29150bf379683 100644 (file)
@@ -9,8 +9,10 @@ qx.Class.define("org.argeo.slc.web.Applet",
   construct : function(){
        this.base(arguments);
        this.setLayout(new qx.ui.layout.VBox());
-       this.passedStatus = "<div align=\"center\"><img src=\"resource/slc/dialog-ok.png\" height=\"16\" width=\"16\"></div>";
-       this.failedStatus = "<div align=\"center\"><img src=\"resource/slc/flag.png\" height=\"16\" width=\"16\"></div>";
+       //this.passedStatus = "<div align=\"center\"><img src=\"resource/slc/dialog-ok.png\" height=\"16\" width=\"16\"></div>";
+       //this.failedStatus = "<div align=\"center\"><img src=\"resource/slc/flag.png\" height=\"16\" width=\"16\"></div>";
+       this.passedStatus = "PASSED";
+       this.failedStatus = "FAILED";
   },
 
   properties : 
@@ -94,6 +96,7 @@ qx.Class.define("org.argeo.slc.web.Applet",
                }
                this.tree = new qx.ui.treevirtual.TreeVirtual(["Test", "State", "Message", "Id"]);
                this.tree.getTableColumnModel().setDataCellRenderer(0, new org.argeo.ria.util.TreeDataCellRenderer());
+               this.tree.getDataRowRenderer().setHighlightFocusRow(false); // Default row renderer
                this.tree.setRowHeight(18);
                this.tree.setStatusBarVisible(false);
                this.tree.setDecorator(new qx.ui.decoration.Background("#fff"));
@@ -125,11 +128,12 @@ qx.Class.define("org.argeo.slc.web.Applet",
                                }else{
                                        label = crtPath;
                                }
+                               var simpleResults = org.argeo.ria.util.Element.selectNodes(node, "slc:part-sub-list/slc:parts/slc:simple-result-part", NSMap);
+
                                var newId;
                                newId = model.addBranch(currentParentId, label, false);
                                
                                // Test Leaf Node
-                               var simpleResults = org.argeo.ria.util.Element.selectNodes(node, "slc:part-sub-list/slc:parts/slc:simple-result-part", NSMap);
                                if(!simpleResults || !simpleResults.length){
                                        addedPaths[crtPath] = newId;
                                        currentParentId = newId;
@@ -159,10 +163,10 @@ qx.Class.define("org.argeo.slc.web.Applet",
                var columnModel = this.tree.getTableColumnModel();
                var resize = columnModel.getBehavior();
                resize.set(0, {width:250, minWidth:250});
-               resize.set(1, {width:40});
+               resize.set(1, {width:55});
                resize.set(2, {width:"1*"});
-               resize.set(3, {width:100});
-               columnModel.setDataCellRenderer(1, new qx.ui.table.cellrenderer.Html());
+               resize.set(3, {width:150});
+               columnModel.setDataCellRenderer(1, new org.argeo.slc.web.StatusCellRenderer());
                
            this.tree.getSelectionManager().getSelectionModel().addListener("changeSelection", function(e){
                        var viewSelection = this.getView().getViewSelection();
diff --git a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/slc/web/StatusCellRenderer.js b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/slc/web/StatusCellRenderer.js
new file mode 100644 (file)
index 0000000..08ff509
--- /dev/null
@@ -0,0 +1,63 @@
+/* ************************************************************************
+
+   qooxdoo - the new era of web development
+
+   http://qooxdoo.org
+
+   Copyright:
+     2007 OpenHex SPRL, http://www.openhex.org
+
+   License:
+     LGPL: http://www.gnu.org/licenses/lgpl.html
+     EPL: http://www.eclipse.org/org/documents/epl-v10.php
+     See the LICENSE file in the project's top-level directory for details.
+
+   Authors:
+     * Dirk Wellmann (dw(at)piponline.net)
+
+************************************************************************ */
+
+/**
+ * This Cellrender is for test status use. It create green or red background
+ * cells depending on the status value (PASSED or FAILED).
+ */
+qx.Class.define("org.argeo.slc.web.StatusCellRenderer",
+{
+  extend : qx.ui.table.cellrenderer.Html,
+
+  construct : function(){
+       this.base(arguments);
+             var style =
+             [
+               ".slc-status-passed{background-color:#8fc98f;color:#008300;border-bottom:1px solid #cccccc;text-align:center;filter:alpha(opacity=80);opacity: 0.8;-moz-opacity:0.8;}",
+               ".slc-status-failed{background-color:#cb8f8f;color:#830000;border-bottom:1px solid #cccccc;text-align:center;filter:alpha(opacity=80);opacity: 0.8;-moz-opacity:0.8;}"
+             ];        
+             // Include stylesheet
+             qx.bom.Stylesheet.createElement(style.join(""));
+  },
+  
+  /*
+  *****************************************************************************
+     MEMBERS
+  *****************************************************************************
+  */
+
+  members :
+  {
+    // overridden
+    _getContentHtml : function(cellInfo) {
+      return (cellInfo.value || "");
+    },
+
+    // overridden
+    _getCellClass : function(cellInfo) {
+       if(cellInfo.value == "PASSED"){
+             return "qooxdoo-table-cell slc-status-passed";
+       }else if(cellInfo.value == "FAILED"){
+         return "qooxdoo-table-cell slc-status-failed";
+       }else{
+         return "qooxdoo-table-cell";
+       }
+    }
+  }
+});