Changeset 179


Ignore:
Timestamp:
05/15/13 19:18:58 (6 years ago)
Author:
nhoyt
Message:

ai-sidebar.js

  • added comments for import of preferences.js
  • added test in selectPreviousView to ensure currentView is DETAILS

ff-overlay.js, evaluation.js, general.js

  • comments for import statements

view-category.js

  • added handleRCTreeEvent fn. for handling dblclick and keypress events in Rule Category tree of rule results

view-category.js

  • added ondblclick and onkeypress attributes to tree element
Location:
trunk/proto-13/chrome/content
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/proto-13/chrome/content/ai-sidebar.js

    r177 r179  
    77 
    88Components.utils.import("chrome://ai-sidebar/content/ai-common.js"); 
     9 
     10// import PrefListener and PrefUtils objects 
    911Components.utils.import("chrome://ai-sidebar/content/utilities/preferences.js", ainspector); 
    1012 
     
    284286 
    285287ainspectorSidebar.selectPreviousView = function () { 
     288  if (parent.AINSPECTOR.currentView !== ainspector.viewConst.DETAILS) return; 
     289 
    286290  ainspector.logger.log.debug("selectPreviousView: " + ainspector.getViewName(parent.AINSPECTOR.previousView)); 
    287291 
  • trunk/proto-13/chrome/content/ff-overlay.js

    r178 r179  
    55 */ 
    66 
     7// create ainspector top-level namespace 
    78Components.utils.import("chrome://ai-sidebar/content/ai-common.js"); 
     9 
     10// import logger and LOG_LEVEL 
    811Components.utils.import("chrome://ai-sidebar/content/utilities/logging.js", ainspector); 
    912 
    10 // namespace container for utilities 
     13// create namespace for utilities imports 
    1114ainspector.utils = {}; 
    1215 
     
    2326ainspector.viewType = new ainspector.utils.Enum(['SUMMARY', 'CATEGORY', 'DETAILS']); 
    2427 
    25 // IMPORTANT: value of DETAILS constant must be distinct from all values in viewEnum 
     28// create special constant for details view 
     29// IMPORTANT: value must be distinct from those in viewEnum 
    2630ainspector.viewConst = { DETAILS: -1 }; 
    2731 
  • trunk/proto-13/chrome/content/preferences/evaluation.js

    r176 r179  
    66 
    77Components.utils.import("chrome://ai-sidebar/content/ai-common.js"); 
     8 
     9// import PrefListener and PrefUtils objects 
    810Components.utils.import("chrome://ai-sidebar/content/utilities/preferences.js", ainspector); 
    911 
  • trunk/proto-13/chrome/content/preferences/general.js

    r176 r179  
    66 
    77Components.utils.import("chrome://ai-sidebar/content/ai-common.js"); 
     8 
     9// import PrefListener and PrefUtils objects 
    810Components.utils.import("chrome://ai-sidebar/content/utilities/preferences.js", ainspector); 
    911 
  • trunk/proto-13/chrome/content/view-category.js

    r178 r179  
    329329  } 
    330330}; 
     331 
     332/** 
     333 * @function handleRCTreeEvent 
     334 * 
     335 * @memberOf ainspectorSidebar 
     336 * 
     337 * @desc Handle dblclick and keypress events when row is selected. If user 
     338 *       double-clicks a row, or presses return, enter or spacebar when a 
     339 *       row is selected, go to Rule Details view. 
     340 */ 
     341 
     342ainspectorSidebar.handleRCTreeEvent = function (event) { 
     343  var tree = ainspectorSidebar.ruleCategoryTree; 
     344  var tbo = tree.treeBoxObject; 
     345  var index = tree.currentIndex; 
     346  var isRowSelected = tree.view.selection.isSelected(index); 
     347 
     348  // do nothing when no row is selected 
     349  if (!isRowSelected) return; 
     350 
     351  switch (event.type) { 
     352    case "dblclick": 
     353      // user must dblclick on an actual row 
     354      var row = { }, col = { }, child = { }; 
     355      tbo.getCellAt(event.clientX, event.clientY, row, col, child); 
     356      if (row.value !== -1) 
     357        ainspectorSidebar.selectView(ainspector.viewConst.DETAILS); 
     358      break; 
     359    case "keypress": 
     360      // handle return (13), enter (3) and spacebar (32) keypress 
     361      if (event.keyCode === 13  || event.keyCode === 3 || event.charCode === 32) 
     362        ainspectorSidebar.selectView(ainspector.viewConst.DETAILS); 
     363      break; 
     364  } 
     365}; 
  • trunk/proto-13/chrome/content/view-category.xul

    r174 r179  
    4242      sortDirection="descending" 
    4343      sortResource="ainspector-level-col" 
    44       onselect="ainspectorSidebar.updateSelectedRuleInfo(this)"> 
     44      onselect="ainspectorSidebar.updateSelectedRuleInfo(this)" 
     45      ondblclick="ainspectorSidebar.handleRCTreeEvent(event)" 
     46      onkeypress="ainspectorSidebar.handleRCTreeEvent(event)"> 
    4547      <treecols> 
    4648        <treecol id="ainspector-rule-col" 
Note: See TracChangeset for help on using the changeset viewer.