Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/web-klick.de/dsh/90_akt/DEV1303/AutoQX/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/web-klick.de/dsh/90_akt/DEV1303/AutoQX/RequViewControl.js

/* ************************************************************************

   Copyright:

   License:

   Authors:

************************************************************************ */

/* ************************************************************************

#asset(autotest/*)

************************************************************************ */

/**
 * This class defines the logic needed for the requirement view.
 */
qx.Class.define("autotest.RequViewControl", {

extend         : qx.application.Standalone,

/**
 * The constructor handles the initializations for every requirement screen
 *
 * @param requirement_screen  - a qooxdoo container for the requirement tree etc
 * @param rpc_url             - a string containing the rpc url
 * @param rpc_service         - a string containing the rpc service (method to call)
 */
construct : function(requirement_screen, rpc_url, rpc_service, testTreeCtr, tabView) {
   // Call super class
   this.base(arguments);
   // include treevirtual mixin for the requirement tree
   qx.Class.include(qx.ui.treevirtual.TreeVirtual,qx.ui.treevirtual.MNode);
   // define given parameters as global for future reference
   this.requirement_screen=requirement_screen;
   this.rpc_url = rpc_url;
   this.rpc_service = rpc_service;
   this.testTreeCtr = testTreeCtr;
   this.tabView=tabView;
},

members : {


/**
 * initialization function which will be called each time the whole requirement
 *    screen needs to be reloaded (i.e. when another project is selected)
 *
 * @param requTree_path       - a string containing the requTree path in the backend
 * @param testproject_name    - a string containing the name of the project
 */
init : function(requTree_path,testproject_name) {
   this.info("init(): called init with params: ",requTree_path,testproject_name);

   //setup of the requirement screen container
   this.requirement_screen.removeAll();
   this.requirement_screen.setLayout (new qx.ui.layout.VBox(20));
   this.akt_requTree_path = requTree_path;

   //call rpc
   try {
      var rpc = new qx.io.remote.Rpc().set({Url: this.rpc_url, ServiceName: this.rpc_service});
      rpc.callAsync(qx.lang.Function.bind(this._init_setrequTree,this),
                           "report",this.akt_requTree_path,"","1");
   } catch(exc) {
      this.error("Exception during RPC call: ", exc);
   }

},

/**
 * helper function for the initialization method above.
 *    It handles the result from the rpc call
 * @param result  - the rpc result, could in theory contain any js object
 * @param exc     - the rpc exception, null if there was no exception
 */
_init_setrequTree : function(result, exc){
   if (exc != null) {
      this.error("_init_setrequTree(): RPC-Call failed " + exc);
      return;
   }
   this.info("_init_setrequTree(): got result:");
   for (var i in result){
      this.info("   ", result[i]);

   }
 //get columns (including architectures)
   var columns=["Item"];
   this.architectures={};
   this.requirements=[];
   this.columnLocations={};
   for (var i in result){
      var requ = result[i][1];
      var arch = result[i][0];
      var containsRequ = -1;
      var containsArch = -1;
      for (j in columns)            if (columns[j]==arch) containsArch = 1;
      for (j in this.requirements)  if (this.requirements[j]==requ) containsRequ = 1;

      if (containsArch==-1){
         columns.push(arch);
         this.architectures[arch]=columns.length-1;
      }
      if (containsRequ==-1){
         this.requirements.push(requ);
      }
   }
   for (var i in columns){
      if (columns[i]==="") columns[i]="no Architecture";
   }
   var count = columns.length;
   this.columnLocations["itemPath"]=count;
   count++;
   for (a in this.architectures){
      this.columnLocations[a]=count;
      count++;
   }
   cellRenderer = new autotest.TableRenderer();
   this.requTree = new qx.ui.treevirtual.TreeVirtual(columns, {defaultDataCellRenderer:cellRenderer}).set({minWidth: 500, rowHeight:20,height:Math.floor(qx.bom.Viewport.getHeight())-330});

   for (var i in this.requTree._getPaneScrollerArr()){
      this.requTree._getPaneScrollerArr()[i].setLiveResize(true);
   }

   this.dataModel      = this.requTree.getDataModel();
   this.requirement_screen.add(this.requTree);

 //set root items (requirements)
   var nodes ={};
   for (var i in result){
      if (result[i][1]!="ALL"){
         this.testItem=result[i][1];
         var containsItem=false, requId;
         for (var j in nodes) if (j==this.testItem) containsItem = true;

         if (!containsItem){
            requId  = this.dataModel.addBranch(null, this.testItem);
            nodes[this.testItem]=requId;
         }else  requId = nodes[this.testItem];

         this._appendChildren_setNodeDetail(requId, this.testItem+"::", result[i][3], result[i][5],result[i][0],result[i][4]);
      }
   }
   this.dataModel.setData();

   //for (var j=0; j<result.length;j++) this.requTree.nodeSetOpened(j, false);
   this.requTree.addListener("treeOpenWithContent",this.createChildren,  this);
   this.requTree.addListener("dblclick",this.switchToTestTree,  this);
   this.requTree.addListener("mousemove", this.saveMousePosition, this);
   this.requTree.columnLocations = this.columnLocations;
   this.requTree.architectures = this.architectures;

   ///**
   // * this part of the code overrides an internal function from the qooxdoo framework
   // * in order to enable popups with onmouseover without creating a new inheritance class
   // */
   this.requTree.setFocusedCell = function setFocusedCell(col, row, scrollVisible){
     if (!this.isEditing() && (col != this.__focusedCol || row != this.__focusedRow)){
       if (col === null) {col = 0;}
       this.__focusedCol = col;
       this.__focusedRow = row;
       var scrollerArr = this._getPaneScrollerArr();
       for (var i=0; i<scrollerArr.length; i++) {
         scrollerArr[i].setFocusedCell(col, row);
         //custom code begin
         /**/ if (!this.popup) this.popup = new qx.ui.popup.Popup(new qx.ui.layout.Canvas()).set({backgroundColor: "#FFFAD3"});
         /**/ if (col>0){
         /**/   this.popup.removeAll();
         /**/   var dataModel=this.getDataModel();
         /**/   var arch = dataModel.getColumnName(col);
         /**/   if (arch=="keine Architektur") arch="";
         /**/   var remark = dataModel.getColumnData(dataModel.getNode(row).nodeId, this.columnLocations[arch]);
         /**/   if (remark==undefined || remark=="") remark="none";
         /**/   this.popup.add(new qx.ui.basic.Label("Remark: "+remark));
         /**/   this.popup.show();
         /**/   this.popup.moveTo(this.mouseX+20,this.mouseY);
         /**/}else{
         /**/   this.popup.setVisibility("hidden");
         /**/}
         //custom code end
       }

       if (col !== null && scrollVisible) {
         this.scrollCellVisible(col, row);
       }
     }
   };
   ///**
   // * end of function override
   // */
},

/**
 * is called when a testItem in the tree is expanded
 *    e.getData() contains the node (testItem) that was expanded
 */
createChildren : function(e) {
   this.requTree.setEnabled(false);
   this.node      = e.getData();
   this.parent   = this.node.nodeId;
   this.testItem = this.node.label;
   var rpc = new qx.io.remote.Rpc().set({Url: this.rpc_url, ServiceName: this.rpc_service});
   this.info("createChildren: rpc call async for ", this.testItem);
   try {
      this.info("createChildren: sending rpc call with params: " ,"report",this.akt_requTree_path,this.node.columnData[this.columnLocations["itemPath"]],"1",":");
      rpc.callAsync(qx.lang.Function.bind(this.appendChildren,this),"report",this.akt_requTree_path,this.node.columnData[this.columnLocations["itemPath"]],"1",":");
   } catch(exc) {
      this.error("createChildren: Exception during RPC call, please check your RPC call: " ,"report",this.akt_requTree_path,this.node.columnData[10],"1",":", "\n" + exc);
   }

},

/**
 * helper function for the rpc call from createChildren()
 *    gets the children from the rpc call and appends them to the parent in the tree
 * @param result
 * @param exc
 */
appendChildren : function(result, exc){
   //form of result: [ arch, requ, itempath, result, error_prob, remark ]
   if (exc != null || result.indexOf("ERROR") !== -1) {
      if (result.indexOf("ERROR") !== -1) exc = result;
      this.error("appendChildren(): this.parent: ",this.parent,"; this.testItem: ", this.testItem,
                  ": RPC Call exception: " + exc );
      this.requTree.nodeSetOpened(this.parent, false);
      this.requTree.setEnabled(true);
      return;
   }

   this.info("appendChildren(): got result:");
   for (i in result) this.info("   ", result[i]);
   var items = result;

   if (this.parent != null) {
      this.dataModel.prune(this.parent, false);
   }

//iterate through the children and append them to the parent (using dataModel.addBranch(...))
   var nodes ={};
   for (var i = 0; i < items.length; i++) {
      var itemName = items[i][2].split("::").pop();
      var containsItem=false;
      for (j in nodes)            if (j==itemName) containsItem = true;
      if (this.requTree.nodeGetLabel(this.parent)!=itemName){
         var childId;
         if (!containsItem){
            childId  = this.dataModel.addBranch(this.parent, itemName);
            nodes[itemName]=childId;
            this._appendChildren_setNodeDetail(childId,items[i][2],items[i][3],items[i][5],items[i][0],items[i][4]);
         }else{
            childId = nodes[itemName];
            this.info("childId: "+childId+ " column: "+(this.architectures[items[i][0]]-1)+" architecture result "+ items[i][4]);
            this._appendChildren_setNodeDetail(childId,items[i][2],items[i][3],items[i][5],items[i][0],items[i][4]);
         }
      }
   }
   if (items.length==0 || (items.length==1 && this.requTree.nodeGetLabel(this.parent)==items[0][2].split("::").pop())){
      this.dataModel.addBranch(this.parent, "loading...");
      this.requTree.nodeSetOpened(this.parent, false);
   }
   this.dataModel.setData();
   this.requTree.setEnabled(true);
   //call the same children in testTree
   var itemPath = this.node.columnData[this.columnLocations["itemPath"]].split("::");
   itemPath.shift();
   itemPath=itemPath.join("::");
   var newParent=this.testTreeCtr.nodeDictionary[itemPath];
   if (itemPath!="" && newParent!=undefined){
      this.testTreeCtr.parent=newParent;
      var rpc = new qx.io.remote.Rpc().set({Url: this.rpc_url, ServiceName: this.rpc_service});
      rpc.callAsync(qx.lang.Function.bind(this.testTreeCtr.appendChildren,this.testTreeCtr),"report",this.akt_requTree_path,itemPath,"-1");
   }

},

/**
 * helper function for appendchildren, which sets the node detail such as the color and column data
 * @param nodeId
 * @param options
 */
_appendChildren_setNodeDetail : function(nodeId, itemPath,result,remark,arch,error_prob){
   this.dataModel.setColumnData(nodeId, this.columnLocations["itemPath"], itemPath);
   this.dataModel.addBranch(nodeId, "loading...");
   this.dataModel.setColumnData(nodeId, this.architectures[arch],result+" / "+Math.round(error_prob*100)/100);
   this.dataModel.setColumnData(nodeId, this.columnLocations[arch],remark);
},

/**
 * function for switching back to TestTree after double-clicking on an item
 * @param e event data
 */
switchToTestTree : function(e){
  var selectedNode = this.requTree.getSelectedNodes().shift();
  var itemPath = selectedNode.columnData[this.columnLocations["itemPath"]].split("::");
  itemPath.shift();
  itemPath=itemPath.join("::");
  if (itemPath!=""){
     var testTreeTargetNode = this.testTreeCtr.nodeDictionary[itemPath];
     this.testTreeCtr.testTree.getSelectionModel().resetSelection();
     this.testTreeCtr.testTree.nodeSetSelected(testTreeTargetNode,true);
     var e = {};
     e.getColumn = function getColumn(){return 0; };
     this.testTreeCtr.cellClicked(e);
     this.tabView.setSelection([this.testTreeCtr.testtree_screen]);
  }
},

saveMousePosition: function(e){
   this.requTree.mouseX = e.getDocumentLeft();
   this.requTree.mouseY = e.getDocumentTop();
},

//***********************************************************************************************

endofclass : null

} });

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net