Changeset 208


Ignore:
Timestamp:
09/30/13 22:14:57 (6 years ago)
Author:
nhoyt
Message:

Added highlighting functionality.

Location:
trunk/proto-14
Files:
5 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/proto-14/chrome.manifest

    r183 r208  
    1 content   ai-sidebar                 chrome/content/ 
    2 locale    ai-sidebar   en-US         chrome/locale/en-US/ 
    3 skin      ai-sidebar   classic/1.0   chrome/skin/ 
     1content     ai-sidebar                      chrome/content/ 
     2locale      ai-sidebar      en-US           chrome/locale/en-US/ 
     3skin        ai-sidebar      classic/1.0     chrome/skin/ 
     4locale      ai-highlight    en-US           chrome/content/highlight/locale/en-US/ 
    45 
    5 overlay   chrome://browser/content/browser.xul         chrome://ai-sidebar/content/ff-overlay.xul 
    6 style     chrome://global/content/customizeToolbar.xul chrome://ai-sidebar/skin/ff-overlay.css 
     6overlay     chrome://browser/content/browser.xul            chrome://ai-sidebar/content/ff-overlay.xul 
     7style       chrome://global/content/customizeToolbar.xul    chrome://ai-sidebar/skin/ff-overlay.css 
  • trunk/proto-14/chrome/content/ai-sidebar.js

    r206 r208  
    111111  ainspectorSidebar.nlsProperties = document.getElementById('ainspector-sidebar-properties'); 
    112112 
     113  // load highlight module script 
     114  Components.classes["@mozilla.org/moz/jssubscript-loader;1"] 
     115    .getService(Components.interfaces.mozIJSSubScriptLoader) 
     116    .loadSubScript("chrome://ai-sidebar/content/highlight/highlight.js", ainspectorSidebar); 
     117 
     118  // initialize highlight module 
     119  var highlightProps = { 
     120    stringBundleId:    "ainspector-highlight-properties", 
     121    highlightDivClass: "ainspector-highlight", 
     122    offScreenDivClass: "ainspector-offscreen" 
     123  }; 
     124  ainspectorSidebar.highlightModule.initHighlight(highlightProps); 
     125 
    113126  // initialize user interface components 
     127  ainspectorSidebar.elementResultsTree  = document.getElementById("ainspector-element-results-tree"); 
     128  ainspectorSidebar.locationInfo        = document.getElementById("ainspector-location-info"); 
    114129  ainspectorSidebar.locationLabel       = document.getElementById("ainspector-location-label"); 
    115130  ainspectorSidebar.progressMeter       = document.getElementById("ainspector-progress-meter"); 
    116   ainspectorSidebar.locationInfo        = document.getElementById("ainspector-location-info"); 
    117131  ainspectorSidebar.ruleCategorySummary = document.getElementById("ainspector-rule-category-summary"); 
    118132  ainspectorSidebar.ruleCategoryTree    = document.getElementById("ainspector-rule-category-tree"); 
     
    302316 
    303317  if (viewConst !== parent.AINSPECTOR.currentView) { 
    304     // Save the current view as previous view 
     318    // save the current view as previous view 
    305319    parent.AINSPECTOR.previousView = parent.AINSPECTOR.currentView; 
    306320 
    307     // Uncheck the previously selected item 
     321    // remove highlighting 
     322    ainspectorSidebar.highlightModule.removeHighlight(content.document); 
     323 
     324    // uncheck the previously selected item 
    308325    var menuitem = ainspectorSidebar.getViewsMenuitem(parent.AINSPECTOR.currentView); 
    309326    if (menuitem) menuitem.removeAttribute("checked"); 
    310327 
    311     // Save the new selection and update the view 
     328    // save the new selection and update the view 
    312329    parent.AINSPECTOR.currentView = viewConst; 
    313330    ainspectorSidebar.updateView(); 
     
    332349  ainspector.log.debug("selectPreviousView: " + ainspector.getViewName(parent.AINSPECTOR.previousView)); 
    333350 
     351  // remove highlighting 
     352  ainspectorSidebar.highlightModule.removeHighlight(content.document); 
     353 
    334354  // update currentView 
    335355  parent.AINSPECTOR.currentView = parent.AINSPECTOR.previousView; 
     
    428448 
    429449ainspectorSidebar.onUnload = function () { 
     450  // remove highlighting 
     451  ainspectorSidebar.highlightModule.removeHighlight(content.document); 
     452 
    430453  // unregister progressListener 
    431454  parent.gBrowser.removeProgressListener(ainspectorSidebar.progressListener); 
  • trunk/proto-14/chrome/content/ai-sidebar.xul

    r194 r208  
    1616    <stringbundle id="ainspector-sidebar-properties" 
    1717      src="chrome://ai-sidebar/locale/ai-sidebar.properties"/> 
     18    <stringbundle id="ainspector-highlight-properties" 
     19      src="chrome://ai-highlight/locale/highlight.properties"/> 
    1820  </stringbundleset> 
    1921 
  • trunk/proto-14/chrome/content/element-results.js

    r207 r208  
    2828  SORT_COL_2:     "ainspector-elem-result-col", 
    2929  SORT_COL_3:     "ainspector-order-col" 
    30 } 
     30}; 
    3131 
    3232/** 
     
    110110      "ainspector-order-col":        nodeResult.getOrdinalPosition(), 
    111111      "ainspector-elem-result-col":  nodeResult.getResultValue(), 
    112       "ainspector-action-col":       nodeResult.getResultMessage() 
     112      "ainspector-action-col":       nodeResult.getResultMessage(), 
     113      nodeResult:                    nodeResult 
    113114    }); 
    114115  } 
     
    211212  ainspectorSidebar.sortElementResults(); 
    212213}; 
     214 
     215/** 
     216 * @function updateSelectedElement 
     217 * 
     218 * @memberOf ainspectorSidebar 
     219 * 
     220 * @desc Handle selection event in Element Results tree. 
     221 */ 
     222 
     223ainspectorSidebar.updateSelectedElement = function (tree) { 
     224  var index = tree.currentIndex; 
     225  var isRowSelected = tree.view.selection.isSelected(index); 
     226  var highlightOption = document.getElementById("ainspector-highlight-option").value; 
     227 
     228  if (isRowSelected && highlightOption === "1") { 
     229    var nodeResult = ainspectorSidebar.elementResultsTable[index].nodeResult; 
     230    ainspectorSidebar.highlightModule.highlightNodeResults(content.document, nodeResult); 
     231  } 
     232}; 
     233 
     234/** 
     235 * @function updateHighlight 
     236 * 
     237 * @memberOf ainspectorSidebar 
     238 * 
     239 * @desc Handle selection event in highlight options menulist. 
     240 */ 
     241 
     242ainspectorSidebar.updateHighlight = function () { 
     243  var ruleCategoryTree = ainspectorSidebar.ruleCategoryTree; 
     244  var index = ruleCategoryTree.currentIndex; 
     245  var isRowSelected = ruleCategoryTree.view.selection.isSelected(index); 
     246  var highlightOption = document.getElementById("ainspector-highlight-option").value; 
     247 
     248  // remove previous highlighting 
     249  ainspectorSidebar.highlightModule.removeHighlight(content.document); 
     250 
     251  switch (highlightOption) { 
     252    case "1": 
     253      ainspectorSidebar.updateSelectedElement(ainspectorSidebar.elementResultsTree); 
     254      break; 
     255    case "2": 
     256      if (isRowSelected) { 
     257        var filteredResults = []; 
     258        var nodeResults = ainspectorSidebar.ruleResultsTable[index].filteredResult.filtered_node_results; 
     259        for (var i = 0; i < nodeResults.length; i++) { 
     260          var nr = nodeResults[i]; 
     261          switch (nr.getResultValue()) { 
     262            case OpenAjax.a11y.RESULT_VALUE.VIOLATION: 
     263            case OpenAjax.a11y.RESULT_VALUE.WARNING: 
     264            case OpenAjax.a11y.RESULT_VALUE.MANUAL_CHECK: 
     265              filteredResults.push(nr); 
     266              break; 
     267            default: 
     268              break; 
     269          } 
     270        } 
     271        ainspectorSidebar.highlightModule.highlightNodeResults(content.document, filteredResults); 
     272      } 
     273      break; 
     274    case "3": 
     275      if (isRowSelected) { 
     276        var nodeResults = ainspectorSidebar.ruleResultsTable[index].filteredResult.filtered_node_results; 
     277        ainspectorSidebar.highlightModule.highlightNodeResults(content.document, nodeResults); 
     278      } 
     279      break; 
     280  } 
     281}; 
  • trunk/proto-14/chrome/content/view-category.js

    r207 r208  
    3939  SORT_COL_3:     "ainspector-level-col", 
    4040  SORT_COL_4:     "ainspector-required-col" 
    41 } 
     41}; 
    4242 
    4343/** 
  • trunk/proto-14/chrome/content/view-details.js

    r206 r208  
    4747  ainspectorSidebar.setDetailsRuleInfoContent(ruleResult); 
    4848 
     49  // update highlighting 
     50  ainspectorSidebar.updateHighlight(); 
     51 
    4952  // select rule details template 
    5053  ainspectorSidebar.viewDeck.selectedIndex = ainspector.viewType.DETAILS; 
  • trunk/proto-14/chrome/content/view-details.xul

    r206 r208  
    4141      </tabs> 
    4242      <tabpanels style="padding: 16px 0px 0px"> 
    43         <tabpanel height="100" style="background: white"> 
     43        <tabpanel height="251" style="background: white"> 
    4444          <tree id="ainspector-element-results-tree" width="381" 
    4545            rows="12" seltype="single" style="margin: 0" 
    4646            persist="sortDirection sortResource" 
    4747            sortDirection="descending" 
    48             sortResource="ainspector-elem-result-col"> 
     48            sortResource="ainspector-elem-result-col" 
     49            onselect="ainspectorSidebar.updateSelectedElement(this)"> 
    4950            <treecols> 
    5051              <treecol id="ainspector-element-col" 
     
    112113          flex="1" width="50" 
    113114          persist="value label" 
     115          oncommand="ainspectorSidebar.updateHighlight()" 
    114116          style="margin-right: 6px"> 
    115117          <menupopup> 
    116             <menuitem label="Selected" value="1"/> 
    117             <menuitem label="V/W"      value="2"/> 
    118             <menuitem label="All"      value="3"/> 
    119             <menuitem label="None"     value="0"/> 
     118            <menuitem label="&ai-label.highlight.selected;" value="1"/> 
     119            <menuitem label="&ai-label.highlight.v-w-mc;"   value="2"/> 
     120            <menuitem label="&ai-label.highlight.all;"      value="3"/> 
    120121          </menupopup> 
    121122        </menulist> 
  • trunk/proto-14/chrome/locale/en-US/ai-sidebar.dtd

    r206 r208  
    152152<!ENTITY ai-label.option.levels      "Levels: "> 
    153153<!ENTITY ai-label.option.recommended "Warnings: "> 
     154 
     155<!-- highlight options --> 
     156 
     157<!ENTITY ai-label.highlight.selected "Selected"> 
     158<!ENTITY ai-label.highlight.v-w-mc   "V/W/MC"> 
     159<!ENTITY ai-label.highlight.all      "All"> 
Note: See TracChangeset for help on using the changeset viewer.