Changeset 17


Ignore:
Timestamp:
09/20/12 19:33:11 (6 years ago)
Author:
nhoyt
Message:

Renamed old updateView fn. to updateContext; added new updateView function; added ainspector.properties file; added menupopup in the sidebar's bottom toolbar named Select View; synchronized the toolbar with view selection from menupopup and when sidebar is closed and reopened.

Location:
trunk/proto-03
Files:
1 added
7 edited

Legend:

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

    r16 r17  
    1010var ainspector = ainspector || {}; 
    1111 
     12ainspector.updateView = function () { 
     13  if (ainspector.currentView === null) return; 
     14  ainspector.setToolbarState(true); 
     15  ainspectorSidebar.viewTitle.value = ainspector.getViewTitle(); 
     16}; 
     17 
    1218/** 
    1319 * @namespace ainspectorSidebar 
    1420 */ 
    15 var ainspectorSidebar = {}; 
     21var ainspectorSidebar = { 
     22  locationHref:  "", 
     23  locationLabel: null, 
     24  progressMeter: null, 
     25  summaryInfo:   null, 
     26  viewTitle:     null 
     27}; 
    1628 
    1729ainspectorSidebar.showTransition = function () { 
     
    2133}; 
    2234 
    23 ainspectorSidebar.updateView = function () { 
     35ainspectorSidebar.updateContext = function () { 
    2436  ainspectorSidebar.locationHref = window.content.location.href; 
    25   ainspector.logger.log.debug("updateView: " + ainspectorSidebar.locationHref); 
     37  ainspector.logger.log.debug("updateContext: " + ainspectorSidebar.locationHref); 
    2638  ainspectorSidebar.showSummary(); 
    2739}; 
    2840 
    2941ainspectorSidebar.onTabSelect = function () { 
    30   ainspectorSidebar.updateView(); 
     42  ainspectorSidebar.updateContext(); 
    3143}; 
    3244 
     
    3547  OAA_WEB_ACCESSIBILITY_UTILS.getProgressListener( 
    3648    ainspectorSidebar.showTransition, 
    37     ainspectorSidebar.updateView); 
     49    ainspectorSidebar.updateContext); 
    3850 
    3951ainspectorSidebar.onLoad = function () { 
     
    4456 
    4557  // initialize user interface components 
    46   ainspectorSidebar.locationLabel = document.getElementById("aiLocationLabel"); 
    47   ainspectorSidebar.progressMeter = document.getElementById("aiProgressMeter"); 
    48   ainspectorSidebar.summaryInfo   = document.getElementById("aiSummaryInfo"); 
    49   ainspectorSidebar.updateView(); 
     58  ainspectorSidebar.locationLabel = document.getElementById("ai-location-label"); 
     59  ainspectorSidebar.progressMeter = document.getElementById("ai-progress-meter"); 
     60  ainspectorSidebar.summaryInfo   = document.getElementById("ai-summary-info"); 
     61  ainspectorSidebar.viewTitle     = document.getElementById("ai-view-title"); 
     62 
     63  ainspector.setToolbarState(true); 
     64  ainspectorSidebar.updateContext(); 
     65  ainspector.updateView(); 
    5066}; 
    5167 
    5268ainspectorSidebar.onUnload = function () { 
     69  ainspector.setToolbarState(false); 
    5370  ainspector.mainWindow.gBrowser.removeProgressListener(ainspectorSidebar.progressListener); 
    5471  ainspector.mainWindow.gBrowser.tabContainer.removeEventListener( 
  • trunk/proto-03/chrome/content/ai-sidebar.xul

    r16 r17  
    1515 
    1616  <spacer flex="1"/> 
    17   <label class="header indent" value="Testing"/> 
     17  <label id="ai-view-title" class="header indent" value="Testing"/> 
    1818 
    1919  <spacer flex="100"/> 
     
    2525      <toolbarbutton 
    2626        label="Report" tooltiptext="Generate HTML Report"/> 
     27      <spacer flex="5"/> 
     28      <toolbarbutton 
     29        label="Select View" tooltiptext="Select View" 
     30        type="menu"> 
     31        <menupopup> 
     32          <menuitem oncommand="ainspector.selectView(ainspector.viewEnum.STRUCTURE)"  
     33            label="&ainspector.buttonLabel.STRUCTURE;"/> 
     34          <menuitem oncommand="ainspector.selectView(ainspector.viewEnum.STYLES)" 
     35            label="&ainspector.buttonLabel.STYLES;"/> 
     36          <menuitem oncommand="ainspector.selectView(ainspector.viewEnum.IMAGES)" 
     37            label="&ainspector.buttonLabel.IMAGES;"/> 
     38          <menuitem oncommand="ainspector.selectView(ainspector.viewEnum.TABLES)" 
     39            label="&ainspector.buttonLabel.TABLES;"/> 
     40          <menuitem oncommand="ainspector.selectView(ainspector.viewEnum.LINKS)" 
     41            label="&ainspector.buttonLabel.LINKS;"/> 
     42          <menuitem oncommand="ainspector.selectView(ainspector.viewEnum.FORMS)" 
     43            label="&ainspector.buttonLabel.FORMS;"/> 
     44          <menuitem oncommand="ainspector.selectView(ainspector.viewEnum.WIDGETS)" 
     45            label="&ainspector.buttonLabel.WIDGETS;"/> 
     46          <menuitem oncommand="ainspector.selectView(ainspector.viewEnum.MEDIA)" 
     47            label="&ainspector.buttonLabel.MEDIA;"/> 
     48          <menuitem oncommand="ainspector.selectView(ainspector.viewEnum.LAYOUT)" 
     49            label="&ainspector.buttonLabel.LAYOUT;"/> 
     50          <menuitem oncommand="ainspector.selectView(ainspector.viewEnum.SUMMARY)" 
     51            label="&ainspector.buttonLabel.SUMMARY;"/> 
     52        </menupopup> 
     53      </toolbarbutton> 
    2754    </toolbar> 
    2855  </toolbox> 
  • trunk/proto-03/chrome/content/ff-overlay.js

    r16 r17  
    2929 
    3030ainspector.viewEnum = new OAA_WEB_ACCESSIBILITY_UTILS.Enum(ainspector.viewStrings); 
     31if (ainspector.currentView === null) ainspector.currentView = ainspector.viewEnum.STRUCTURE; 
    3132 
    3233ainspector.mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) 
     
    4344}; 
    4445 
     46ainspector.selectView = function (viewConst) { 
     47  ainspector.currentView = viewConst; 
     48  ainspector.logViewInfo(ainspector.currentView); 
     49  toggleSidebar('view-ai-sidebar', true); 
     50  ainspector.updateView(); 
     51}; 
     52 
    4553ainspector.logViewInfo = function (index) { 
    4654  var viewName = ainspector.viewStrings[index]; 
    4755  ainspector.logger.log.debug("view: " + viewName); 
     56}; 
     57 
     58ainspector.setToolbarState = function (flag) { 
     59  var button = ainspector.getToolbarButton(); 
     60  if (button) { 
     61    button.checked = flag; 
     62  } 
     63}; 
     64 
     65ainspector.getToolbarButton = function () { 
     66  if (ainspector.currentView === null) return null; 
     67 
     68  var views = ainspector.viewEnum; 
     69  var button = null; 
     70   
     71  switch (ainspector.currentView) { 
     72  case views.STRUCTURE: 
     73    button = document.getElementById("ai-structure-button"); 
     74    break; 
     75  case views.STYLES: 
     76    button = document.getElementById("ai-styles-button"); 
     77    break; 
     78  case views.IMAGES: 
     79    button = document.getElementById("ai-images-button"); 
     80    break; 
     81  case views.TABLES: 
     82    button = document.getElementById("ai-tables-button"); 
     83    break; 
     84  case views.LINKS: 
     85    button = document.getElementById("ai-links-button"); 
     86    break; 
     87  case views.FORMS: 
     88    button = document.getElementById("ai-forms-button"); 
     89    break; 
     90  case views.WIDGETS: 
     91    button = document.getElementById("ai-widgets-button"); 
     92    break; 
     93  case views.MEDIA: 
     94    button = document.getElementById("ai-media-button"); 
     95    break; 
     96  case views.LAYOUT: 
     97    button = document.getElementById("ai-layout-button"); 
     98    break; 
     99  case views.SUMMARY: 
     100    button = document.getElementById("ai-summary-button"); 
     101    break; 
     102  default: 
     103    break; 
     104  } 
     105 
     106  return button; 
     107}; 
     108 
     109ainspector.getViewTitle = function () { 
     110  if (ainspector.currentView === null) return; 
     111 
     112  var nls = ainspector.nlsProperties; 
     113  var views = ainspector.viewEnum; 
     114   
     115  switch (ainspector.currentView) { 
     116  case views.STRUCTURE: 
     117    return nls.getString('viewTitle.STRUCTURE'); 
     118    break; 
     119  case views.STYLES: 
     120    return nls.getString('viewTitle.STYLES'); 
     121    break; 
     122  case views.IMAGES: 
     123    return nls.getString('viewTitle.IMAGES'); 
     124    break; 
     125  case views.TABLES: 
     126    return nls.getString('viewTitle.TABLES'); 
     127    break; 
     128  case views.LINKS: 
     129    return nls.getString('viewTitle.LINKS'); 
     130    break; 
     131  case views.FORMS: 
     132    return nls.getString('viewTitle.FORMS'); 
     133    break; 
     134  case views.WIDGETS: 
     135    return nls.getString('viewTitle.WIDGETS'); 
     136    break; 
     137  case views.MEDIA: 
     138    return nls.getString('viewTitle.MEDIA'); 
     139    break; 
     140  case views.LAYOUT: 
     141    return nls.getString('viewTitle.LAYOUT'); 
     142    break; 
     143  case views.SUMMARY: 
     144    return nls.getString('viewTitle.SUMMARY'); 
     145    break; 
     146  default: 
     147    break; 
     148  } 
     149 
     150  return ''; 
    48151}; 
    49152 
     
    52155  ainspector.logger.enabled = true; 
    53156  ainspector.logger.level = ainspector.LOG_LEVEL.DEBUG; 
    54   ainspector.logger.log.debug("ainspector: load event"); 
     157 
     158  // get NLS stringbundle 
     159  ainspector.nlsProperties = document.getElementById('ainspector-properties'); 
    55160}; 
    56161 
    57 window.addEventListener("load",   ainspector.onLoad, false); 
    58 window.addEventListener("unload", function () { alert("ainspector unload event"); }, false); 
     162window.addEventListener("load", ainspector.onLoad, false); 
     163// window.addEventListener("unload", function () { alert("ainspector unload event"); }, false); 
  • trunk/proto-03/chrome/content/ff-overlay.xul

    r16 r17  
    44<overlay id="ai-sidebar-overlay" 
    55         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 
     6 
     7  <stringbundleset> 
     8    <stringbundle id="ainspector-properties" 
     9      src="chrome://ai-sidebar/locale/ainspector.properties"/> 
     10  </stringbundleset> 
    611 
    712  <script src="utilities/inspection.js"/> 
     
    2934        type="radio" 
    3035        group="ai-view-select" 
    31         oncommand="toggleSidebar('view-ai-sidebar', true)"> 
    32         <label value="&ainspector.view-label.abbr.STRUCTURE;"/> 
     36        oncommand="ainspector.selectView(ainspector.viewEnum.STRUCTURE)"> 
     37        <label value="&ainspector.buttonLabel.STRUCTURE;"/> 
    3338      </toolbarbutton> 
    3439      <toolbarbutton id="ai-styles-button" 
    3540        type="radio" 
    3641        group="ai-view-select" 
    37         oncommand="ainspector.logViewInfo(ainspector.viewEnum.STYLES)"> 
    38         <label value="&ainspector.view-label.abbr.STYLES;"/> 
     42        oncommand="ainspector.selectView(ainspector.viewEnum.STYLES)"> 
     43        <label value="&ainspector.buttonLabel.STYLES;"/> 
    3944      </toolbarbutton> 
    4045      <toolbarbutton id="ai-images-button" 
    4146        type="radio" 
    4247        group="ai-view-select" 
    43         oncommand=""> 
    44         <label value="&ainspector.view-label.abbr.IMAGES;"/> 
     48        oncommand="ainspector.selectView(ainspector.viewEnum.IMAGES)"> 
     49        <label value="&ainspector.buttonLabel.IMAGES;"/> 
    4550      </toolbarbutton> 
    4651      <toolbarbutton id="ai-tables-button" 
    4752        type="radio" 
    4853        group="ai-view-select" 
    49         oncommand=""> 
    50         <label value="&ainspector.view-label.abbr.TABLES;"/> 
     54        oncommand="ainspector.selectView(ainspector.viewEnum.TABLES)"> 
     55        <label value="&ainspector.buttonLabel.TABLES;"/> 
    5156      </toolbarbutton> 
    5257      <toolbarbutton id="ai-links-button" 
    5358        type="radio" 
    5459        group="ai-view-select" 
    55         oncommand=""> 
    56         <label value="&ainspector.view-label.abbr.LINKS;"/> 
     60        oncommand="ainspector.selectView(ainspector.viewEnum.LINKS)"> 
     61        <label value="&ainspector.buttonLabel.LINKS;"/> 
    5762      </toolbarbutton> 
    5863      <toolbarbutton id="ai-forms-button" 
    5964        type="radio" 
    6065        group="ai-view-select" 
    61         oncommand=""> 
    62         <label value="&ainspector.view-label.abbr.FORMS;"/> 
     66        oncommand="ainspector.selectView(ainspector.viewEnum.FORMS)"> 
     67        <label value="&ainspector.buttonLabel.FORMS;"/> 
    6368      </toolbarbutton> 
    6469      <toolbarbutton id="ai-widgets-button" 
    6570        type="radio" 
    6671        group="ai-view-select" 
    67         oncommand=""> 
    68         <label value="&ainspector.view-label.abbr.WIDGETS;"/> 
     72        oncommand="ainspector.selectView(ainspector.viewEnum.WIDGETS)"> 
     73        <label value="&ainspector.buttonLabel.WIDGETS;"/> 
    6974      </toolbarbutton> 
    7075      <toolbarbutton id="ai-media-button" 
    7176        type="radio" 
    7277        group="ai-view-select" 
    73         oncommand=""> 
    74         <label value="&ainspector.view-label.abbr.MEDIA;"/> 
     78        oncommand="ainspector.selectView(ainspector.viewEnum.MEDIA)"> 
     79        <label value="&ainspector.buttonLabel.MEDIA;"/> 
    7580      </toolbarbutton> 
    7681      <toolbarbutton id="ai-layout-button" 
    7782        type="radio" 
    7883        group="ai-view-select" 
    79         oncommand=""> 
    80         <label value="&ainspector.view-label.abbr.LAYOUT;"/> 
     84        oncommand="ainspector.selectView(ainspector.viewEnum.LAYOUT)"> 
     85        <label value="&ainspector.buttonLabel.LAYOUT;"/> 
    8186      </toolbarbutton> 
    8287      <toolbarseparator/> 
     
    8489        type="radio" 
    8590        group="ai-view-select" 
    86         oncommand="alert(ainspector.isSidebarVisible())"> 
    87         <label value="&ainspector.view-label.abbr.SUMMARY;"/> 
     91        oncommand="ainspector.selectView(ainspector.viewEnum.SUMMARY)"> 
     92        <label value="&ainspector.buttonLabel.SUMMARY;"/> 
    8893      </toolbarbutton> 
    8994    </toolbar> 
  • trunk/proto-03/chrome/content/summary.xul

    r12 r17  
    77 
    88  <vbox id="ai-summary"> 
    9     <hbox id="aiProgressMeter" minheight="16" hidden="true"> 
     9    <hbox id="ai-progress-meter" minheight="16" hidden="true"> 
    1010      <spacer flex="1"/> 
    1111        <progressmeter mode="undetermined" flex="12"/> 
    1212      <spacer flex="1"/> 
    1313    </hbox> 
    14     <hbox id="aiSummaryInfo"> 
     14    <hbox id="ai-summary-info"> 
    1515      <spacer flex="1"/> 
    16       <label id="aiLocationLabel" flex="12"/> 
     16      <label id="ai-location-label" crop="end" flex="12"/> 
    1717      <spacer flex="1"/> 
    1818    </hbox> 
  • trunk/proto-03/chrome/locale/en-US/ai-sidebar.dtd

    r16 r17  
    88<!-- view labels --> 
    99 
    10 <!ENTITY ainspector.view-label.abbr.STRUCTURE "Structure"> 
    11 <!ENTITY ainspector.view-label.full.STRUCTURE "Structure"> 
    12  
    13 <!ENTITY ainspector.view-label.abbr.STYLES "Styles"> 
    14 <!ENTITY ainspector.view-label.full.STYLES "Styles"> 
    15  
    16 <!ENTITY ainspector.view-label.abbr.IMAGES "Images"> 
    17 <!ENTITY ainspector.view-label.full.IMAGES "Images"> 
    18  
    19 <!ENTITY ainspector.view-label.abbr.TABLES "Tables"> 
    20 <!ENTITY ainspector.view-label.full.TABLES "Data Tables"> 
    21  
    22 <!ENTITY ainspector.view-label.abbr.LINKS "Links"> 
    23 <!ENTITY ainspector.view-label.full.LINKS "Links/Navigation"> 
    24  
    25 <!ENTITY ainspector.view-label.abbr.FORMS "Forms"> 
    26 <!ENTITY ainspector.view-label.full.FORMS "Form Controls"> 
    27  
    28 <!ENTITY ainspector.view-label.abbr.WIDGETS "Widgets"> 
    29 <!ENTITY ainspector.view-label.full.WIDGETS "Widgets/Scripts"> 
    30  
    31 <!ENTITY ainspector.view-label.abbr.MEDIA "Audio/Video"> 
    32 <!ENTITY ainspector.view-label.full.MEDIA "Audio/Video/Multimedia"> 
    33  
    34 <!ENTITY ainspector.view-label.abbr.LAYOUT "Layout"> 
    35 <!ENTITY ainspector.view-label.full.LAYOUT "Layout/Order"> 
    36  
    37 <!ENTITY ainspector.view-label.abbr.SUMMARY "Summary"> 
    38 <!ENTITY ainspector.view-label.full.SUMMARY "Summary"> 
     10<!ENTITY ainspector.buttonLabel.STRUCTURE "Structure"> 
     11<!ENTITY ainspector.buttonLabel.STYLES "Styles"> 
     12<!ENTITY ainspector.buttonLabel.IMAGES "Images"> 
     13<!ENTITY ainspector.buttonLabel.TABLES "Tables"> 
     14<!ENTITY ainspector.buttonLabel.LINKS "Links"> 
     15<!ENTITY ainspector.buttonLabel.FORMS "Forms"> 
     16<!ENTITY ainspector.buttonLabel.WIDGETS "Widgets"> 
     17<!ENTITY ainspector.buttonLabel.MEDIA "Audio/Video"> 
     18<!ENTITY ainspector.buttonLabel.LAYOUT "Layout"> 
     19<!ENTITY ainspector.buttonLabel.SUMMARY "Summary"> 
  • trunk/proto-03/modules/ainspector-common.js

    r16 r17  
    1212 
    1313var ainspector = { 
    14   currentView:   null, 
    15   locationHref:  "", 
    16   locationLabel: null 
     14  currentView: null, 
     15  nlsProperties: null 
    1716}; 
Note: See TracChangeset for help on using the changeset viewer.