Changeset 163


Ignore:
Timestamp:
04/29/13 21:11:55 (6 years ago)
Author:
nhoyt
Message:

Overview: This changeset provides the initial implementation of the Rule Details view, which involves handling a variety of new situations in ai-sidebar.js and adding two new files, view-details.js and .xul.

ai-sidebar.js

  • In showTransition fn. (triggered when you load a new page), if you're currently in the Rule Details view, set parent.AIS.currentView to the previousView, which will become the effective view when updateContext is called.
  • In init fn. (called when sidebar loads), if parent.AIS.currentView is set to the Rule Details view (i.e. you're reloading the sidebar and its last view was Rule Details), set parent.AIS.currentView to the previousView.
  • In updateView fn. handle the case when user clicks on Rule Details button (or double-clicks a rule) by calling setDetailsView fn.
  • In selectView fn. handle the case when user selects the previous view from which they selected Rule Details by calling selectPreviousView.
  • Added function selectPreviousView, which reverts to Rule Category or WCAG Guideline view from Rule Details view by setting the viewDeck index, which maintains the row selection state in previous view.
  • In clearCurrentView fn. handle the Rule Details case by calling clearDetailsView.

ai-sidebar.xul

  • Added reference to view-details.xul overlay.
  • Added ai-view-details overlay to deck element.
  • Moved Highlight widget to view-details.xul

ff-overlay.js

  • Added 'DETAILS' property to viewType enum.
  • Added viewConst and property 'DETAILS' for use as separate view value distinct from those in viewEnum.
  • Added previousView property to parent.AIS namespace object.
  • In onTabSelect fn. handle the case of being in Rule Details view by reverting to previous view in anticipation of the call to either toggleSidebar or updateContext.

view-category.xul

  • Added ondblclick attribute/handler to Rule Results tree.
  • Added oncommand value of selectView to Rule Details button.
  • Tweaked entity names for Back button and Rule Details button.

view-details.js

  • New file that contains fns. setDetailsView and clearDetailsView.

view-details.xul

  • New file that contains skeleton implementation of Rule Details view.

views-button.js

  • Added code to maintain the checked status of the menuitem corresponding to previousView when in Rule Details view.

ai-sidebar.dtd

  • Added button labels to ai-button.label.* group for entity naming consistency.
  • Added backToCategory, backToGuideline and noSelection entities.

ai-sidebar.properties

  • Added details-suffix property.

install.rdf

  • Updated version to 0.1.13.
Location:
trunk/proto-13
Files:
2 added
8 edited

Legend:

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

    r154 r163  
    2828 * @memberOf ainspectorSidebar 
    2929 * 
    30  * @desc Control the visibility of the progressmeter. 
     30 * @desc Indicate to the user that a page load transition is underway by (a) 
     31 *       clearing the data in the current view and (b) making the progressmeter 
     32 *       visible. Note: If the current view is Rule Details, we also revert the 
     33 *       value of currentView to previousView in anticipation of the call to 
     34 *       updateContext, which refreshes the view. 
    3135 */ 
    3236 
     
    3640  ainspectorSidebar.clearCurrentView(); 
    3741  ainspectorSidebar.showProgressMeter(); 
     42  if (parent.AIS.currentView === ainspector.viewConst.DETAILS) 
     43    parent.AIS.currentView = parent.AIS.previousView; 
    3844}; 
    3945 
     
    6672ainspectorSidebar.init = function () { 
    6773  // set default value for view 
    68   if (parent.AIS.currentView === null) parent.AIS.currentView = ainspector.viewEnum.SUMMARY; 
     74  if (parent.AIS.currentView === null) 
     75    parent.AIS.currentView = ainspector.viewEnum.SUMMARY; 
     76 
     77  if (parent.AIS.currentView === ainspector.viewConst.DETAILS) 
     78    parent.AIS.currentView = parent.AIS.previousView; 
    6979 
    7080  // instantiate progressListener 
     
    207217  var view = ainspector.viewEnum; 
    208218  switch (parent.AIS.currentView) { 
    209   case view.SUMMARY: 
    210     ainspectorSidebar.setSummaryView(); 
    211     break; 
    212   default: 
    213     ainspectorSidebar.rulesTable = ainspectorSidebar.getRulesData(); 
    214     ainspectorSidebar.sortRulesTable(); 
    215     ainspectorSidebar.setCategoryView(); 
    216     break; 
     219    case view.SUMMARY: 
     220      ainspectorSidebar.setSummaryView(); 
     221      break; 
     222    case ainspector.viewConst.DETAILS: 
     223      ainspectorSidebar.setDetailsView(); 
     224      break; 
     225    default: 
     226      ainspectorSidebar.rulesTable = ainspectorSidebar.getRulesData(); 
     227      ainspectorSidebar.sortRulesTable(); 
     228      ainspectorSidebar.setCategoryView(); 
     229      break; 
    217230  } 
    218231}; 
     
    223236 * @memberOf ainspectorSidebar 
    224237 * 
    225  * @desc Set the current view and update if necessary. 
     238 * @desc Set the current view and update if necessary. Since this fn. is called 
     239 *       from the Views menu, we have to handle the special case of selecting 
     240 *       the previous view when in Rule Details mode. 
    226241 */ 
    227242 
     
    229244  ainspector.logger.log.debug("selectView: " + ainspector.getViewName(viewConst)); 
    230245 
     246  if (parent.AIS.currentView === ainspector.viewConst.DETAILS && 
     247      viewConst === parent.AIS.previousView) { 
     248    ainspectorSidebar.selectPreviousView(); 
     249    return; 
     250  } 
     251 
    231252  if (viewConst !== parent.AIS.currentView) { 
     253    // Save the current view as previous view 
     254    parent.AIS.previousView = parent.AIS.currentView; 
     255 
    232256    // Uncheck the previously selected item 
    233257    var menuitem = ainspectorSidebar.getViewsMenuitem(parent.AIS.currentView); 
     
    241265 
    242266/** 
     267 * @function selectPreviousView 
     268 * 
     269 * @memberOf ainspectorSidebar 
     270 * 
     271 * @desc Go back to the Rule Category or WCAG Guideline view that was active 
     272 *       prior to the selection of the Rule Details view. By simply changing 
     273 *       the viewDeck index, the row selection state of the previous view is 
     274 *       maintained. Note: This function should only be called when the Rule 
     275 *       Details view is active. 
     276 */ 
     277 
     278ainspectorSidebar.selectPreviousView = function () { 
     279  // update currentView 
     280  parent.AIS.currentView = parent.AIS.previousView; 
     281 
     282  // update viewTitle 
     283  ainspectorSidebar.viewTitle.value = ainspectorSidebar.getViewTitle(parent.AIS.currentView); 
     284 
     285  // select rule category template 
     286  ainspectorSidebar.viewDeck.selectedIndex = ainspector.viewType.CATEGORY; 
     287}; 
     288 
     289/** 
    243290 * @function clearCurrentView 
    244291 * 
     
    253300  var view = ainspector.viewEnum; 
    254301  switch (parent.AIS.currentView) { 
    255   case view.SUMMARY: 
    256     ainspectorSidebar.clearSummaryView(); 
    257     break; 
    258   default: 
    259     ainspectorSidebar.clearCategoryView(); 
    260     break; 
     302    case view.SUMMARY: 
     303      ainspectorSidebar.clearSummaryView(); 
     304      break; 
     305    case ainspector.viewConst.DETAILS: 
     306      ainspectorSidebar.clearDetailsView(); 
     307      break; 
     308    default: 
     309      ainspectorSidebar.clearCategoryView(); 
     310      break; 
    261311  } 
    262312}; 
  • trunk/proto-13/chrome/content/ai-sidebar.xul

    r159 r163  
    66<?xul-overlay href="chrome://ai-sidebar/content/view-summary.xul"?> 
    77<?xul-overlay href="chrome://ai-sidebar/content/view-category.xul"?> 
     8<?xul-overlay href="chrome://ai-sidebar/content/view-details.xul"?> 
    89<?xul-overlay href="chrome://ai-sidebar/content/ai-context.xul"?> 
    910<!DOCTYPE page SYSTEM "chrome://ai-sidebar/locale/ai-sidebar.dtd"> 
     
    155156    <vbox id="ai-summary-view"/> 
    156157    <vbox id="ai-category-view"/> 
     158    <vbox id="ai-details-view"/> 
    157159  </deck> 
    158160 
     
    163165 
    164166  <vbox> 
    165     <hbox flex="1" align="baseline"> 
     167    <hbox flex="1"> 
    166168      <button 
    167169        label="&ai-button.label.preferences;" 
     
    169171        oncommand="ainspectorSidebar.openPreferencesWindow();"/> 
    170172      <button hidden="true" 
    171         label="&ai-button.label.report;" 
    172         tooltiptext="&ai-button.tooltip.report;"/> 
     173        label="&ai-button.label.reports;" 
     174        tooltiptext="&ai-button.tooltip.reports;"/> 
    173175      <spacer flex="3"/> 
    174       <description hidden="true">Highlight: </description> 
    175       <menulist id="ai-highlight-option" hidden="true" 
    176         flex="1" width="50" 
    177         persist="value label"> 
    178         <menupopup> 
    179           <menuitem label="All"      value="3"/> 
    180           <menuitem label="V/W"      value="2"/> 
    181           <menuitem label="Selected" value="1"/> 
    182           <menuitem label="None"     value="0"/> 
    183         </menupopup> 
    184       </menulist> 
    185176    </hbox> 
    186177  </vbox> 
  • trunk/proto-13/chrome/content/ff-overlay.js

    r157 r163  
    4646 
    4747// create constants for view types 
    48 ainspector.viewType = new OAA_WEB_ACCESSIBILITY_UTILS.Enum(['SUMMARY', 'CATEGORY']); 
     48ainspector.viewType = new OAA_WEB_ACCESSIBILITY_UTILS.Enum(['SUMMARY', 'CATEGORY', 'DETAILS']); 
     49 
     50// Important: value of DETAILS constant must be distinct from all values in viewEnum 
     51ainspector.viewConst = { 
     52  DETAILS: -1 
     53}; 
    4954 
    5055// create constant for tab attribute 
     
    5459parent.AIS = { 
    5560  currentView: null, 
     61  previousView: null, 
    5662  startTime: 0, 
    5763  startup: true 
     
    120126  var isVisible = parent.AIS.isSidebarVisible(); 
    121127  var shouldBeVisible = parent.gBrowser.selectedTab.getAttribute(ainspector.tabAttrName) == "true"; 
     128 
     129  if (parent.AIS.currentView === ainspector.viewConst.DETAILS) 
     130    parent.AIS.currentView = parent.AIS.previousView; 
     131 
    122132  if ((!isVisible && shouldBeVisible) || (isVisible && !shouldBeVisible)) 
    123133    parent.toggleSidebar('view-ai-sidebar'); 
  • trunk/proto-13/chrome/content/view-category.xul

    r160 r163  
    4242      sortDirection="descending" 
    4343      sortResource="ai-level-col" 
     44      ondblclick="ainspectorSidebar.selectView(ainspector.viewConst.DETAILS)" 
    4445      onselect="ainspectorSidebar.updateSelectedRuleInfo(this)"> 
    4546      <treecols> 
     
    123124      </hbox> 
    124125      <hbox> 
    125         <textbox id="ai-selected-rule" flex="4" multiline="true" readonly="true" rows="3" value="Nothing selected"/> 
     126        <textbox id="ai-selected-rule" 
     127          flex="4" multiline="true" readonly="true" 
     128          rows="3" value="&ai-label.noSelection;"/> 
    126129      </hbox> 
    127130    </vbox> 
     
    132135      <hbox> 
    133136        <button 
    134           label="&ai-label.backToSummary;" 
     137          label="&ai-button.label.back;" 
    135138          image="chrome://ai-sidebar/skin/back-button.png" 
    136139          tooltiptext="&ai-button.tooltip.backToSummary;" 
     
    139142        <spacer flex="4"/> 
    140143        <button id="ai-rule-details-button" 
    141           label="&ai-label.ruleDetails;" 
     144          label="&ai-button.label.ruleDetails;" 
    142145          tooltiptext="&ai-button.tooltip.ruleDetails;" 
    143           oncommand=""/> 
     146          oncommand="ainspectorSidebar.selectView(ainspector.viewConst.DETAILS)"/> 
    144147      </hbox> 
    145148    </vbox> 
  • trunk/proto-13/chrome/content/views-button.js

    r154 r163  
    136136 
    137137ainspectorSidebar.setViewsMenu = function () { 
    138   var menuitem = ainspectorSidebar.getViewsMenuitem(parent.AIS.currentView); 
     138  var menuitem = parent.AIS.currentView === ainspector.viewConst.DETAILS ? 
     139    ainspectorSidebar.getViewsMenuitem(parent.AIS.previousView) : 
     140    ainspectorSidebar.getViewsMenuitem(parent.AIS.currentView); 
    139141  if (menuitem) menuitem.setAttribute("checked", "true"); 
    140142  ainspectorSidebar.setViewsMenuOptions(); 
  • trunk/proto-13/chrome/locale/en-US/ai-sidebar.dtd

    r159 r163  
    66<!ENTITY ai-sidebar.view.modifierskey "shift accel"> 
    77 
    8 <!ENTITY ai-button.label.sort "Default Sort"> 
    9 <!ENTITY ai-button.label.preferences "Preferences"> 
    10 <!ENTITY ai-button.label.report "Report"> 
    11 <!ENTITY ai-button.label.views "Views"> 
     8<!ENTITY ai-button.label.back              "Back"> 
     9<!ENTITY ai-button.label.preferences       "Preferences"> 
     10<!ENTITY ai-button.label.reports           "Reports"> 
     11<!ENTITY ai-button.label.ruleDetails       "Rule Details"> 
     12<!ENTITY ai-button.label.sort              "Default Sort"> 
     13<!ENTITY ai-button.label.views             "Views"> 
    1214 
    13 <!ENTITY ai-button.tooltip.toggle "Show/Hide &ai-sidebar.title;"> 
    14 <!ENTITY ai-button.tooltip.sort "Apply default sorting"> 
    15 <!ENTITY ai-button.tooltip.preferences "Open Preferences dialog"> 
    16 <!ENTITY ai-button.tooltip.report "Generate HTML report"> 
    17 <!ENTITY ai-button.tooltip.views "Select rule category views"> 
    18 <!ENTITY ai-button.tooltip.ruleDetails "View Selected Rule Details"> 
    19 <!ENTITY ai-button.tooltip.backToSummary "Back to Summary view"> 
     15<!ENTITY ai-button.tooltip.backToCategory  "Back to Rule Category view"> 
     16<!ENTITY ai-button.tooltip.backToGuideline "Back to WCAG Guideline view"> 
     17<!ENTITY ai-button.tooltip.backToSummary   "Back to Summary view"> 
     18<!ENTITY ai-button.tooltip.preferences     "Open Preferences dialog"> 
     19<!ENTITY ai-button.tooltip.reports         "Generate HTML report"> 
     20<!ENTITY ai-button.tooltip.ruleDetails     "Selected Rule Details"> 
     21<!ENTITY ai-button.tooltip.sort            "Apply default sorting"> 
     22<!ENTITY ai-button.tooltip.toggle          "Show/Hide &ai-sidebar.title;"> 
     23<!ENTITY ai-button.tooltip.views           "Select Rule Category views"> 
    2024 
    2125<!-- views menu labels and accesskeys --> 
     
    7882<!ENTITY ai-label.ruleResults               "Rule Results"> 
    7983<!ENTITY ai-label.selectedRule              "Selected Rule"> 
    80 <!ENTITY ai-label.ruleDetails               "Rule Details"> 
    81 <!ENTITY ai-label.backToSummary             "Back"> 
     84<!ENTITY ai-label.noSelection               "nothing selected"> 
    8285 
    8386<!ENTITY ai-treecol.rule                    "Summary"> 
  • trunk/proto-13/chrome/locale/en-US/ai-sidebar.properties

    r154 r163  
    2525view.title.wcag-4-1  = 4.1 Compatible 
    2626 
     27view.title.details-suffix = \u0020Rule 
     28 
    2729info.definition  = DEFINITION:\u0020 
    2830info.result      = RESULT:\u0020 
  • trunk/proto-13/install.rdf

    r157 r163  
    1010        <em:name>AInspector Sidebar</em:name> 
    1111        <em:type>2</em:type> 
    12         <em:version>0.1.12</em:version> 
     12        <em:version>0.1.13</em:version> 
    1313 
    1414        <em:targetApplication> 
Note: See TracChangeset for help on using the changeset viewer.