12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490 |
- /*
- IBM Confidential
- OCO Source Materials
- IBM Cognos Products: uipe
- (C) Copyright IBM Corp. 2014
- The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has been deposited with the U.S. Copyright Office.
- */
- /**
- * @fileoverview Provides setting sheet capabilities.
- */
- /**
- * Indicates that the value is not valid. Used in validation of values entered in the setting sheet.
- * @final
- * @type Integer
- */
- C_SettingSheet.K_iNotValid = 1;
- /**
- * Indicates that the value is less then the minimum. Used in validation of values entered in the setting sheet.
- * @final
- * @type Integer
- */
- C_SettingSheet.K_iLessThanMin = 2;
- /**
- * Indicates that the value is more then the maximum. Used in validation of values entered in the setting sheet.
- * @final
- * @type Integer
- */
- C_SettingSheet.K_iGreaterThanMax = 3;
- /*
- * @constructor
- * @requires C_ListView
- * @param {DIV} v_divSettingSheet The container for the setting sheet.
- * @param {Node} v_nSettingSheet The settingSheet node.
- * @param {I_SettingSheetListener} v_oListener Listener.
- * @param {HTMLElement} v_elBlockerParent
- * @param {String} v_sClsInputBlocker
- */
- function C_SettingSheet( v_divSettingSheet, v_nSettingSheet, v_oListener )
- {
- /**
- * @private
- */
- G_HAL.F_VerifyDependencies( "C_ListView" );
- /**
- * @private
- */
- this.m_doc = document;
- /**
- * @private
- */
- this.m_oListener = v_oListener;
- /**
- * @private
- */
- this.m_sActiveSetting = "";
- /**
- * @private
- */
- this.m_oSettingToRow = {};
- /**
- * @private
- */
- this.m_oSettingValues = {};
- /**
- * @private
- */
- this.m_oCollapsedGroups = {};
- this.f_createTable( v_divSettingSheet );
- this.f_createTemplates();
- /**
- * @private
- */
- this.m_nSettingSheet = v_nSettingSheet;
- /**
- * @private
- */
- this.m_iIndentLength = parseInt( this.m_nSettingSheet.getAttribute( "indentLength" ) );
- /**
- * @private
- */
- this.m_sHighlightNonDefaultValues = this.m_nSettingSheet.getAttribute( "highlightNonDefaultValues" );
- this.Groups = [];
- this.m_oGroupAttributes = {};
- this.m_oSettingAttributes = {};
- this.m_oSubSettings = {};
- this.m_oSupportedSubSettings = {};
- this.m_oLabels = {};
- this.m_oSmallIcons = {};
- this.m_oExpandedSmallIcons = {};
- this.m_oTypes = {};
- this.m_oHasEmbeddedListView = {};
- this.m_oType = {};
- this.f_readSettings(U_XML.F_AppendNodeListToArray([], this.m_nSettingSheet.selectNodes(".")));
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_readSettings = function(v_aGroups)
- {
- //Note: Anything cached in this method, must be removed in f_deleteSettings
- var v_iGroupsLength = v_aGroups.length;
- for ( var v_iGroup = 0; v_iGroup < v_iGroupsLength; v_iGroup++ )
- {
- var v_nGroup = v_aGroups[ v_iGroup ];
- var v_oGroup = {};
- v_oGroup.Name = v_nGroup.getAttribute( "name" );
- //Groups must be uniquely named
- this.f_readAttributes( v_nGroup, this.m_oGroupAttributes, v_oGroup.Name );
- this.m_oLabels[v_oGroup.Name] = this.f_getLabelString( v_nGroup );
- this.m_oSmallIcons[v_oGroup.Name] = v_nGroup.getAttribute( "smallIcon" );
- this.m_oExpandedSmallIcons[v_oGroup.Name] = v_nGroup.getAttribute( "expandedSmallIcon" );
- if ( this.m_bShowGroupSmallIcons && !this.m_oSmallIcons[v_oGroup.Name] )
- {
- this.m_oSmallIcons[v_oGroup.Name] = G_HAL.M_sImagePath + "tv_folder.gif";
- this.m_oExpandedSmallIcons[v_oGroup.Name] = G_HAL.M_sImagePath + "tv_folder_expanded.gif";
- }
- v_oGroup.Settings = [];
- this.Groups.push( v_oGroup );
- var v_nlSettings = v_nGroup.selectNodes( "setting" );
- var v_iSettingsLength = v_nlSettings.length;
- for ( var v_iProp = 0; v_iProp < v_iSettingsLength; v_iProp++ )
- {
- var v_nSetting = v_nlSettings.item( v_iProp );
- var v_sSettingName = v_nSetting.getAttribute( "name" );
- var v_sType = v_nSetting.getAttribute( "dataType" );
- this.m_oType[v_sSettingName] = v_sType;
- this.m_oTypes[v_sSettingName] = v_sType;
- this.m_oLabels[v_sSettingName] = this.f_getLabelString( v_nSetting );
- this.m_oSmallIcons[v_sSettingName] = v_nSetting.getAttribute( "smallIcon" );
- v_oGroup.Settings.push( v_sSettingName );
- this.f_readAttributes( v_nSetting, this.m_oSettingAttributes, v_sSettingName );
- }
- }
- };
- C_SettingSheet.prototype.F_GetUpdatedSettings = function()
- {
- var v_oUpdatedSettings = {};
- for ( var i = 0; i < this.Groups[0].Settings.length; i++ )
- {
- var v_sName = this.Groups[0].Settings[i];
- var v_sValue = this.m_oSettingValues[v_sName];
- if ( v_sValue != this.F_GetSettingAttribute( v_sName, "defaultValue" ) )
- {
- v_oUpdatedSettings[v_sName] = v_sValue;
- }
- }
- return v_oUpdatedSettings;
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_getLabelString = function( n )
- {
- var v_sIdsLabel = n.getAttribute( "idsLabel" );
- if ( v_sIdsLabel )
- {
- var v_sLabel = G_ResManager.F_GetOptionalString( v_sIdsLabel );
- if ( !v_sLabel )
- {
- return n.getAttribute( "name" );
- }
- else
- {
- return v_sLabel;
- }
- }
- return n.getAttribute( "label" );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_readAttributes = function( n, v_oAttributes, v_sName )
- {
- v_oAttributes[v_sName] = {};
- var o = v_oAttributes[v_sName];
- var nl = n.attributes;
- var v_iLength = nl.length;
- for ( var i = 0; i < v_iLength; i++ )
- {
- var v_nAttr = nl.item( i );
- o[v_nAttr.name] = v_nAttr.value;
- }
- };
- /**
- * Gets an attribute of a setting.
- * @param {String} v_sSettingName The setting name.
- * @param {String} v_sAttributeName The attribute name.
- * @type String
- * @returns The attribute value for the setting.
- */
- C_SettingSheet.prototype.F_GetSettingAttribute = function( v_sSettingName, v_sAttributeName )
- {
- var o = this.m_oSettingAttributes[v_sSettingName];
- if ( o )
- {
- return o[v_sAttributeName];
- }
- };
- /**
- * Set whether {@link C_SettingSheet#F_Show} will create or update the UI.
- * @param {Boolean} b Whether or not to enable updating of the setting sheet.
- * @type void
- */
- C_SettingSheet.prototype.F_SetUpdate = function( b )
- {
- this.m_bUpdate = b;
- if ( !b )
- {
- this.F_Clear();
- }
- };
- /**
- * Returns the setting value.
- * @type String
- */
- C_SettingSheet.prototype.F_GetSettingValue = function( v_sName )
- {
- return this.m_oSettingValues[v_sName];
- };
- /**
- * Set locale to text container for language specific content
- * @param {String} v_sName The setting name.
- * @param {String} v_sLocale The locale value
- * @type void
- */
- C_SettingSheet.prototype.F_SetLocale = function( v_sName, v_sLocale )
- {
- if (v_sLocale)
- {
- this.F_GetFixedValueCell( v_sName ).setAttribute("lang", v_sLocale);
- }
- };
- /**
- * Shows a setting with an appropriate value. Ignore case is only used for settings that are drop down lists.
- * In that case, if ignore case is true, a case insensitive match will be used on values to find the correct list item.
- * @param {String} v_sName The setting name.
- * @param {String} v_sValue The setting value.
- * @type void
- */
- C_SettingSheet.prototype.F_ShowSetting = function( v_sName, v_sValue )
- {
- if ( v_sValue == null )
- {
- if ( this.m_oSettingValues[v_sName] == null )
- {
- v_sValue = this.F_GetSettingAttribute( v_sName, "defaultValue" );
- }
- else
- {
- v_sValue = this.m_oSettingValues[v_sName];
- }
- }
-
- this.m_oSettingValues[v_sName] = v_sValue;
- switch ( this.m_oTypes[v_sName] )
- {
- case "string":
- case "integer":
- this.f_showTextSetting( v_sName, v_sValue );
- break;
- case "boolean":
- this.f_showBooleanSetting( v_sName, ( typeof v_sValue == "boolean" ) ? ( v_sValue ? "true" : "false" ) : v_sValue );
- break;
- case "enum":
- this.f_showDropDownListSetting( v_sName, v_sValue );
- break;
- default:
- G_HAL.F_AlertError( "Unrecognized setting type '" + this.m_oTypes[v_sName] + "' for setting '" + v_sName + "'." );
- break;
- }
- if ( G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- if ( !this.m_bFirstTabindexSet )
- {
- var v_tdLabel = this.m_tbl.rows.item( 0 ).cells.item( 0 );
- v_tdLabel.setAttribute( "tabIndex", "0" );
- this.m_bFirstTabindexSet = true;
- }
- // TODO: Why does this need to be called for every setting added? Doesn't the call in f_createTable take care of this?
- this.f_setupAccessibility();
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_showTextSetting = function( v_sName, v_sValue )
- {
- if ( this.m_bUpdate )
- {
- this.f_updateTextSetting( v_sName, v_sValue );
- }
- else
- {
- this.f_addTextSetting( v_sName, v_sValue );
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_showBooleanSetting = function( v_sName, v_sValue )
- {
- if ( this.m_bUpdate )
- {
- this.f_updateBooleanSetting( v_sName, v_sValue );
- }
- else
- {
- this.f_addBooleanSetting( v_sName, v_sValue );
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_getSettingListView = function( v_sName, v_sValue, v_bPopulate )
- {
- if ( this.m_oType[v_sName] == "boolean" )
- {
- var v_nListView = G_ResManager.F_GetResource( "HAL_BOOLEAN_LISTVIEW" );
- if ( v_nListView )
- {
- return v_nListView;
- }
- var d = G_ResManager.F_GetResourcesDoc();
- v_nListView = d.documentElement.appendChild( d.createElement( "listView" ) );
- v_nListView.setAttribute( "id", "HAL_BOOLEAN_LISTVIEW" );
- var v_nListItems = v_nListView.appendChild( d.createElement( "listItems" ) );
- var v_nListItem = v_nListItems.appendChild( d.createElement( "listItem" ) );
- v_nListItem.setAttribute( "value", "false" );
- v_nListItem.setAttribute( "idsLabel", "IDS_HAL_PROPVAL_FALSE" );
- var v_nListItem = v_nListItems.appendChild( d.createElement( "listItem" ) );
- v_nListItem.setAttribute( "value", "true" );
- v_nListItem.setAttribute( "idsLabel", "IDS_HAL_PROPVAL_TRUE" );
- return G_ResManager.F_GetResource( "HAL_BOOLEAN_LISTVIEW" );
- }
- var v_nListView = this.f_createListViewByEnumValues( v_sName );
- return v_nListView ? v_nListView.cloneNode( true ) : null;
- };
- C_SettingSheet.prototype.f_createListViewByEnumValues = function( v_sName )
- {
- var d = G_ResManager.F_GetResourcesDoc();
- v_nListView = d.documentElement.appendChild( d.createElement( "listView" ) );
- v_nListView.setAttribute( "id", v_sName + "_ListView" );
- var v_nListItems = v_nListView.appendChild( d.createElement( "listItems" ) );
- var v_nEnumValues = this.m_nSettingSheet.selectNodes( ".//setting[@name='" + v_sName + "']/enumValues/enumValue" );
- for( var i = 0; i < v_nEnumValues.length; i++ )
- {
- var v_nEnumValue = v_nEnumValues.item( i );
- var v_nListItem = v_nListItems.appendChild( d.createElement( "listItem" ) );
- v_nListItem.setAttribute( "value", v_nEnumValue.getAttribute( "value" ) );
- v_nListItem.setAttribute( "idsLabel", v_nEnumValue.getAttribute( "idsLabel" ) );
- }
- return v_nListView;
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_showDropDownListSetting = function( v_sName, v_sValue )
- {
- var v_sDisplayValue = v_sValue;
- if ( v_sValue )
- {
- var v_nListView = this.f_getSettingListView( v_sName, v_sValue );
- if ( v_nListView )
- {
- var v_bIgnoreValueCase = ( this.F_GetSettingAttribute( v_sName, "ignoreValueCase" ) == "true" );
- var v_nListItem = C_ListView.F_FindListItem( v_nListView, "value", v_sValue, v_bIgnoreValueCase );
- if ( v_nListItem )
- {
- v_sDisplayValue = C_ListView.F_GetListItemLabel( v_nListItem );
- }
- }
- }
- if ( this.m_bUpdate )
- {
- this.f_updateDropDownListSetting( v_sName, v_sValue, v_sDisplayValue );
- }
- else
- {
- this.f_addDropDownListSetting( v_sName, v_sValue, v_sDisplayValue );
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_addTextSetting = function( v_sName, v_sValue )
- {
- var tr = this.f_appendSettingRow( "string", v_sName );
- var txt = this.F_GetFixedValueCell( v_sName ).firstChild;
- txt.onblur = C_SettingSheet.f_onInputBlur;
- txt.onfocus = C_SettingSheet.f_onInputFocus;
- txt.onchange = C_SettingSheet.f_onInputChange;
- this.f_updateTextSetting( v_sName, v_sValue );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_updateTextSetting = function( v_sName, v_sValue )
- {
- var txt = this.F_GetFixedValueCell( v_sName ).firstChild;
- txt.v_sDefaultValue = v_sValue;
- txt.value = v_sValue;
- this.f_highlightNonDefaultValue( v_sName, v_sValue, txt );
- this.f_updateSettingAriaLabel( v_sName, v_sValue );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_addBooleanSetting = function( v_sName, v_sValue )
- {
- var tr = this.f_appendSettingRow( "boolean", v_sName );
- this.f_updateBooleanSetting( v_sName, v_sValue );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_updateBooleanSetting = function( v_sName, v_sValue )
- {
- var td = this.F_GetFixedValueCell( v_sName );
- td.v_sSettingValue = v_sValue;
- td.innerText = G_ResManager.F_GetString( ( v_sValue == "true" ) ? "IDS_HAL_PROPVAL_TRUE" : "IDS_HAL_PROPVAL_FALSE" );
- this.f_highlightNonDefaultValue( v_sName, v_sValue, td );
- this.f_updateSettingAriaLabel( v_sName, td.innerText );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_addDropDownListSetting = function( v_sName, v_sValue, v_sDisplayValue )
- {
- var tr = this.f_appendSettingRow( "dropDownList", v_sName );
- this.f_updateDropDownListSetting( v_sName, v_sValue, v_sDisplayValue );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_updateDropDownListSetting = function( v_sName, v_sValue, v_sDisplayValue )
- {
- var td = this.F_GetFixedValueCell( v_sName );
- td.v_sSettingValue = v_sValue;
- td.innerText = v_sDisplayValue;
- this.f_highlightNonDefaultValue( v_sName, v_sValue, td );
- this.f_updateSettingAriaLabel( v_sName, v_sDisplayValue );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_highlightNonDefaultValue = function( v_sName, v_sValue, el )
- {
- if ( this.m_sHighlightNonDefaultValues )
- {
- var n = this.m_nSettingSheet.selectSingleNode( ".//setting[@name=" + v_sName.F_ToXPathString() + "]" );
- var v_sDefaultValue = n.getAttribute( "defaultValue" );
- if ( v_sDefaultValue !== null )
- {
- el.style.fontWeight = ( v_sDefaultValue == v_sValue ) ? "normal" : "bold";
- }
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_createTable = function( v_elContainer )
- {
- this.m_tbl = v_elContainer.appendChild( this.m_doc.createElement( "TABLE" ) );
- this.m_tbl.cellPadding = 0;
- this.m_tbl.cellSpacing = 0;
- this.m_tbl.className = "clsPropertySheet";
- this.m_tbl.h_oSettingSheet = this;
- this.m_tbl.style.tableLayout = "fixed";
- U_Accessibility.F_SetRoleForLayoutTable( this.m_tbl );
- this.f_attachEventHandlers();
- this.m_tbody = this.m_tbl.appendChild( this.m_doc.createElement( "TBODY" ) );
- this.f_setupAccessibility();
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_attachEventHandlers = function()
- {
- this.m_tbl.onmousedown = function( e ) { return this.h_oSettingSheet.f_onMouseDown( e ); };
- this.m_tbl.ondblclick = function( e ) { return this.h_oSettingSheet.f_onDblClick( e ); };
- this.m_tbl.onclick = function( e ) { return this.h_oSettingSheet.f_onClick( e ); };
- this.m_tbl.onkeydown = function( e ) { return this.h_oSettingSheet.F_OnKeyDown( e ); };
- this.f_setupAccessibilityEventHandler( true );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_createTemplates = function()
- {
- this.m_oTemplates = {};
- var v_trCommon = this.m_doc.createElement( "TR" );
- var v_tdLabel = v_trCommon.appendChild( this.m_doc.createElement( "TD" ) );
- v_tdLabel.className = "clsPropertySheetLabel_inactive";
- v_tdLabel.style.width = "100%";
- v_tdLabel.style.overflow = "hidden";
- v_tdLabel.style.textOverflow = "ellipsis";
- var v_tdValue = v_trCommon.appendChild( this.m_doc.createElement( "TD" ) );
- v_tdValue.className = "clsPropertySheetValue";
- v_tdValue.style.width = "190px";
- var v_tblCommonValue = this.m_doc.createElement( "TABLE" );
- v_tblCommonValue.className = "clsDialogText";
- v_tblCommonValue.cellPadding = 0;
- v_tblCommonValue.cellSpacing = 0;
- v_tblCommonValue.style.tableLayout = "fixed";
- v_tblCommonValue.style.overflow = "hidden";
- v_tblCommonValue.style.width = "100%";
- U_Accessibility.F_SetRoleForLayoutTable( v_tblCommonValue );
- var tr = v_tblCommonValue.appendChild( this.m_doc.createElement( "TBODY" ) ).appendChild( this.m_doc.createElement( "TR" ) );
- var td = tr.appendChild( this.m_doc.createElement( "TD" ) );
- td.style.whiteSpace = "nowrap";
- td.style.overflow = "hidden";
- td.style.textOverflow = "ellipsis";
- td.style.width = "100%";
- var v_tdCommonActionButton = this.m_doc.createElement( "TD" );
- v_tdCommonActionButton.style.display = "none";
- v_tdCommonActionButton.style.width = "18px";
- var v_btnDotDotDot = v_tdCommonActionButton.appendChild( this.m_doc.createElement( "BUTTON" ) );
- v_btnDotDotDot.hideFocus = true;
- var v_imgDotDotDot = v_btnDotDotDot.appendChild( this.m_doc.createElement( "IMG" ) );
- //Change the dotdotdot.gif to a11y version when high contrast mode enabled.
- var v_sDotDotDotImageSrc = "../" + U_HighContrast.F_GetHighContrastImgIfNecessary( "hal/images/dotdotdot.gif" );
- v_imgDotDotDot.src = v_sDotDotDotImageSrc;
- if ( G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- var v_sADotiraLabel = G_ResManager.F_GetString( "IDS_HAL_AC_DOTDOTDOT" );
- v_trCommon.setAttribute( "role", "row" );
- v_tdLabel.setAttribute( "tabIndex", "-1" );
- v_tdLabel.setAttribute( "role", "gridcell" );
- v_tdValue.setAttribute( "role", "gridcell" );
- td.setAttribute( "tabIndex", "-1" );
- v_btnDotDotDot.setAttribute( "tabIndex", "-1" );
- v_btnDotDotDot.setAttribute( "aria-label", v_sADotiraLabel );
- v_imgDotDotDot.setAttribute( "alt", v_sADotiraLabel );
- }
- var tr = v_trCommon.cloneNode( true );
- this.m_oTemplates["info"] = tr;
- tr.firstChild.nextSibling.appendChild( v_tblCommonValue.cloneNode( true ) );
- var tr = this.m_oTemplates["info"].cloneNode( true );
- this.m_oTemplates["string"] = tr;
- // TR->TD->TABLE->TBODY->TR->TD
- var v_elInput = tr.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.appendChild( this.m_doc.createElement( "INPUT" ) );
- v_elInput.type = "text";
- v_elInput.style.height = "14px";
- v_elInput.style.width = "100%";
- v_elInput.style.border = "none";
- v_elInput.style.position = "relative";
- if ( G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- v_elInput.setAttribute( "tabIndex", "-1" );
- }
- var tr = this.m_oTemplates["info"].cloneNode( true );
- this.m_oTemplates["dropDownList"] = tr;
- // TR->TD->TABLE->TBODY->TR
- var v_tdActionButton = tr.firstChild.nextSibling.firstChild.firstChild.firstChild.appendChild( v_tdCommonActionButton.cloneNode( true ) );
- var v_sDrowdownImageSrc = "../" + U_HighContrast.F_GetHighContrastImgIfNecessary( "hal/images/dropdown.gif" );
- v_tdActionButton.firstChild.style.height = "18px";
- v_tdActionButton.firstChild.firstChild.src = v_sDrowdownImageSrc;
- var v_sDropDownAriaLabel = G_ResManager.F_GetString( "IDS_HAL_AC_DROPDOWN" );
- if ( G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- v_tdActionButton.firstChild.setAttribute( "aria-label", v_sDropDownAriaLabel );
- v_tdActionButton.firstChild.firstChild.setAttribute( "alt", v_sDropDownAriaLabel );
- }
- var tr = this.m_oTemplates["dropDownList"].cloneNode( true );
- this.m_oTemplates["boolean"] = tr;
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_appendSettingRow = function( v_sType, v_sName )
- {
- var tr = this.m_tbody.appendChild( this.m_oTemplates[v_sType].cloneNode( true ) );
- tr.v_sSettingType = v_sType;
- tr.v_bIsSettingRow = true;
- if ( v_sType != "Last" )
- {
- tr.v_sSettingName = v_sName;
- var v_tdLabel = tr.cells.item( 0 );
- v_tdLabel.innerText = this.m_oLabels[v_sName];
- if ( this.m_iIndentLength )
- {
- var v_sIndentLevel = this.F_GetSettingAttribute( v_sName, "indentLevel" );
- if ( v_sIndentLevel )
- {
- v_tdLabel.style.paddingLeft = ( parseInt( v_sIndentLevel, 10 ) * this.m_iIndentLength ) + "px";
- }
- }
- var v_bIsGroup = ( v_sType == "Group" );
- if ( ( this.m_bShowGroupSmallIcons && v_bIsGroup ) ||
- ( this.m_bShowLabelSmallIcons && !v_bIsGroup ) )
- {
- var td = tr.cells.item( v_bIsGroup ? 1 : 2 );
- var v_sSmallIcon = this.m_oExpandedSmallIcons[v_sName] || this.m_oSmallIcons[v_sName] || ( G_HAL.M_sImagePath + "blank.gif" );
- var img = td.insertBefore( document.createElement( "IMG" ), td.firstChild );
- img.src = G_HAL.F_GetImageURL( v_sSmallIcon );
- var v_sHeight = this.F_GetSettingAttribute( v_sName, "smallIconHeight" );
- img.style.height = ( v_sHeight == null ) ? "16px" : v_sHeight;
- var v_sWidth = this.F_GetSettingAttribute( v_sName, "smallIconWidth" );
- img.style.width = ( v_sWidth == null ) ? "16px" : v_sWidth;
- img.style.verticalAlign = "middle";
- img.style.margin = "1px 3px 1px 0px";
- }
- this.m_oSettingToRow[v_sName] = tr.rowIndex;
- if ( this.m_bCurrentGroupCollapsed )
- {
- tr.style.display = "none";
- }
- }
- if ( G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- var nl = tr.getElementsByTagName( "TD" );
- for( var i = 0 ; i < nl.length ;i++ )
- {
- var v_nTd = nl.item(i);
- if ( v_nTd.getAttribute( "role" ) )
- {
- v_nTd.setAttribute( "aria-label", this.m_oLabels[v_sName] || v_sName );
- }
- }
- }
- return tr;
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_getSettingRow = function( v_sName )
- {
- return this.m_tbl.rows.item( this.m_oSettingToRow[v_sName] );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_getLabelCell = function( v_sName )
- {
- return this.m_tbl.rows.item( this.m_oSettingToRow[v_sName] ).cells.item( 0 );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_getValueCell = function( v_sName )
- {
- return this.m_tbl.rows.item( this.m_oSettingToRow[v_sName] ).cells.item( 1 );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.F_GetFixedValueCell = function( v_sName )
- {
- return this.f_getValueCell( v_sName ).firstChild.rows.item( 0 ).cells.item( 0 );
- };
- /**
- * @private
- */
- C_SettingSheet.f_getSettingSheetFromChild = function( el )
- {
- var v_trSettingRow = el;
- while ( !v_trSettingRow.v_bIsSettingRow )
- {
- v_trSettingRow = v_trSettingRow.parentNode;
- }
- // TR->TBODY->TABLE
- return v_trSettingRow.parentNode.parentNode.h_oSettingSheet;
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_createInputBlocker = function( v_elBlockerParent, v_sClsInputBlocker )
- {
- this.m_divEventBlocker = v_elBlockerParent.appendChild( document.createElement( "DIV" ) );
- this.m_divEventBlocker.className = "clsBlocker" + ( v_sClsInputBlocker ? ( " " + v_sClsInputBlocker ) : "" );
- this.m_divEventBlocker.onmousedown = C_SettingSheet.f_blockerOnMouseDown;
- this.m_divEventBlocker.style.visibility = "hidden";
- this.m_divEventBlocker.v_sSettingSheetTableId = this.m_tbl.uniqueID;
- };
- /**
- * @private
- */
- C_SettingSheet.f_onInputFocus = function(e)
- {
- var v_currentInput = this;
- var v_oSettingSheet = C_SettingSheet.f_getSettingSheetFromChild( v_currentInput );
- v_oSettingSheet.m_bEditingText = true;
- };
- /**
- * @private
- */
- C_SettingSheet.f_onInputBlur = function(e)
- {
- var v_currentInput = this;
- var v_oSettingSheet = C_SettingSheet.f_getSettingSheetFromChild( v_currentInput );
- v_oSettingSheet.m_bEditingText = false;
- if ( !G_BrowserInfo.M_bIsIE )
- {
- G_Framework.F_OnTextBoxBlur(e);
- }
- };
- /**
- * @private
- */
- C_SettingSheet.f_onInputChange = function()
- {
- //G_Debug.F_Print( "f_onInputChange: " + this.value + "," + this.v_sDefaultValue );
- if ( this.value != this.v_sDefaultValue )
- {
- this.v_sDefaultValue = this.value;
- var v_trSettingRow = this;
- while ( !v_trSettingRow.v_bIsSettingRow )
- {
- v_trSettingRow = v_trSettingRow.parentNode;
- }
- var v_oSettingSheet = v_trSettingRow.parentNode.parentNode.h_oSettingSheet;
- v_oSettingSheet.f_processInput( v_trSettingRow.v_sSettingName, this.value );
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_onClick = function( e )
- {
- e = e || window.event;
- var v_elSrc = e.srcElement;
- if ( v_elSrc.tagName == "BUTTON" || (v_elSrc.tagName == "IMG" && v_elSrc.parentNode.tagName == "BUTTON"))
- {
- var v_trSettingRow = this.f_getSettingRowFromChild( v_elSrc );
- switch ( v_trSettingRow.v_sSettingType )
- {
- case "dropDownList":
- case "boolean":
- var v_sName = v_trSettingRow.v_sSettingName;
- var v_tdValueCell = this.f_getValueCell( v_sName );
- var v_tdFixedValueCell = this.F_GetFixedValueCell( v_sName );
- var v_sValue = v_tdFixedValueCell.v_sSettingValue;
- var v_nListView = this.f_getSettingListView( v_sName, v_sValue );
- this.F_ShowListView( v_sName, v_sValue, v_nListView );
- break;
- }
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_onMouseDown = function( e )
- {
- e = e || window.event;
- if ( G_HAL.M_oTestListener && G_HAL.M_oTestListener.F_TestListener_SettingSheetOnMouseDown )
- {
- G_HAL.M_oTestListener.F_TestListener_SettingSheetOnMouseDown( e, this );
- }
- var v_elSrc = e.srcElement;
- var v_trSettingRow = this.f_getSettingRowFromChild( v_elSrc );
- this.f_activateSetting( v_trSettingRow );
- e.cancelBubbble = true;
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_onDblClick = function( e )
- {
- e = e || window.event;
- if ( G_HAL.M_oTestListener && G_HAL.M_oTestListener.F_TestListener_SettingSheetOnDblClick )
- {
- G_HAL.M_oTestListener.F_TestListener_SettingSheetOnDblClick( e, this );
- }
- var v_elSrc = e.srcElement;
- var v_trSettingRow = this.f_getSettingRowFromChild( v_elSrc );
- if ( !G_BrowserInfo.M_bIsIE && ( v_trSettingRow.v_sSettingType == "Group" ) && ( v_elSrc.tagName == "IMG" ) )
- {
- // Ingore since the second onmousedown will toggle the group
- return;
- }
- this.f_doDblClick( v_trSettingRow );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_doDblClick = function( v_trSettingRow )
- {
- this.f_activateSetting( v_trSettingRow );
- switch ( v_trSettingRow.v_sSettingType )
- {
- case "dropDownList":
- case "boolean":
- if ( this.m_oListener.F_SettingSheet_OnCycleDropDownList )
- {
- var v_sName = v_trSettingRow.v_sSettingName;
- if ( this.F_GetSettingAttribute( v_sName, "disableCycle" ) != "true" )
- {
- var v_sValue = this.F_GetFixedValueCell( v_sName ).v_sSettingValue;
- var v_nListView = this.f_getSettingListView( v_sName, v_sValue );
- this.m_oListener.F_SettingSheet_OnCycleDropDownList( this, v_sName, v_sValue, v_nListView );
- }
- }
- break;
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.F_OnKeyDown = function( e )
- {
- e = e || window.event;
- if ( G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- this.f_handleAccessibilityKeyDown( e );
- return;
- }
- //G_Debug.F_Print( "F_OnKeyDown:" + event.keyCode )
- switch ( e.keyCode )
- {
- case U_DOM.K_iKeyTab:
- U_DOM.F_CancelEvent( e );
- break;
- case U_DOM.K_iKeyDelete:
- if ( !this.m_bEditingText && this.m_sActiveSetting )
- {
- this.m_oListener.F_SettingSheet_OnSettingDelete( this, this.m_sActiveSetting );
- }
- break;
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.F_OnKeyPress = function( e )
- {
- if ( G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- //handle in keydown event
- return;
- }
- e = e || window.event;
- //G_Debug.F_Print( "F_OnKeyPress:" + event.keyCode )
- switch ( e.keyCode )
- {
- case U_DOM.K_iKeyEnter:
- //G_Debug.F_Print( "m_sActiveSetting:" + this.m_sActiveSetting )
- if ( this.m_sActiveSetting )
- {
- var v_trSettingRow = this.f_getSettingRow( this.m_sActiveSetting );
- switch ( v_trSettingRow.v_sSettingType )
- {
- case "string":
- this.f_deactivateSetting();
- break;
- default:
- this.f_doDblClick( v_trSettingRow );
- }
- }
- break;
- case U_DOM.K_iKeyEscape:
- this.f_deactivateSetting();
- break;
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_activateSetting = function( v_trSettingRow )
- {
- if ( v_trSettingRow.v_sSettingType == "Last" )
- {
- return;
- }
- if ( this.m_sActiveSetting != v_trSettingRow.v_sSettingName )
- {
- this.f_deactivateSetting();
- this.m_sActiveSetting = v_trSettingRow.v_sSettingName;
- this.f_getLabelCell( this.m_sActiveSetting ).className.replace( "clsPropertySheetLabel_inactive", "clsPropertySheetLabel_active" );
- switch ( v_trSettingRow.v_sSettingType )
- {
- case "string":
- if ( !G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- // not to automatically change focus
- this.F_GetFixedValueCell( this.m_sActiveSetting ).firstChild.focus();
- }
- break;
- case "dropDownList":
- case "boolean":
- this.F_GetFixedValueCell( this.m_sActiveSetting ).nextSibling.style.display = "";
- if ( G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- this.f_getLabelCell( this.m_sActiveSetting ).focus();
- }
- break;
- }
- if ( this.m_oListener.F_SettingSheet_OnSettingActivated )
- {
- this.m_oListener.F_SettingSheet_OnSettingActivated( this, this.m_sActiveSetting );
- }
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_deactivateSetting = function()
- {
- if ( this.m_sActiveSetting )
- {
- this.f_getLabelCell( this.m_sActiveSetting ).className.replace( "clsPropertySheetLabel_active", "clsPropertySheetLabel_inactive" );
- var v_trSettingRow = this.f_getSettingRow( this.m_sActiveSetting );
- switch ( v_trSettingRow.v_sSettingType )
- {
- case "string":
- var txt = this.F_GetFixedValueCell( this.m_sActiveSetting ).firstChild;
- if ( txt.value != txt.v_sDefaultValue )
- {
- txt.v_sDefaultValue = txt.value;
- this.f_processInput( this.m_sActiveSetting, txt.value );
- }
- txt.blur();
- break;
- case "dropDownList":
- case "boolean":
- this.F_GetFixedValueCell( this.m_sActiveSetting ).nextSibling.style.display = "none";
- break;
- }
- if ( this.m_oListener.F_SettingSheet_OnSettingDeactivated )
- {
- this.m_oListener.F_SettingSheet_OnSettingDeactivated( this, this.m_sActiveSetting );
- }
- this.m_sActiveSetting = "";
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_getSettingRowFromChild = function( el )
- {
- for ( ; el && ( el != this.m_tbl ); el = el.parentNode )
- {
- if ( ( el.tagName == "TR" ) && el.v_bIsSettingRow )
- {
- return el;
- }
- }
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_processInput = function( v_sName, v_sValue )
- {
- var v_sDataType = this.F_GetSettingAttribute( v_sName, "dataType" );
- if ( v_sDataType && !( v_sValue === "" ) )
- {
- var v_sMin = this.F_GetSettingAttribute( v_sName, "min" );
- var v_sMax = this.F_GetSettingAttribute( v_sName, "max" );
- switch ( v_sDataType )
- {
- case "integer":
- if ( !v_sValue.match( /^-?\d+$/ ) )
- {
- this.f_onSettingFailedValidation( C_SettingSheet.K_iNotValid, v_sName, v_sValue );
- return;
- }
- if ( this.f_processNumericInput( v_sName, v_sValue, parseInt( v_sValue, 10 ), parseInt( v_sMin ), parseInt( v_sMax ) ) )
- {
- this.F_OnSettingChange( v_sName, v_sValue );
- }
- return;
- }
- }
- this.F_OnSettingChange( v_sName, v_sValue );
- };
- C_SettingSheet.prototype.f_onSettingFailedValidation = function( v_eValidationResult, v_sName, v_sValue, v_vMin, v_vMax )
- {
- switch (v_eValidationResult)
- {
- case C_SettingSheet.K_iNotValid:
- F_MsgBoxResLater( ( this.F_GetSettingAttribute( v_sName, "dataType" ) == "integer" ) ? "IDS_ERR_INVALID_INTEGER" : "IDS_ERR_INVALID_DECIMAL" );
- break;
- case C_SettingSheet.K_iLessThanMin:
- F_MsgBoxLater( G_ResManager.F_GetString( "IDS_HAL_ERR_INVALID_MIN", Number.F_ToLocalizedString( v_vMin ) ) );
- break;
- case C_SettingSheet.K_iGreaterThanMax:
- F_MsgBoxLater( G_ResManager.F_GetString( "IDS_HAL_ERR_INVALID_MAX", Number.F_ToLocalizedString( v_vMax ) ) );
- }
- this.f_onSettingFailedValidationChange( v_sName );
- };
- C_SettingSheet.prototype.F_OnSettingChange = function( v_sProp, v_sValue )
- {
- if( this.m_oListener && this.m_oListener.F_HighlightSettings )
- {
- this.m_oListener.F_HighlightSettings( this.F_GetFixedValueCell( v_sProp ), this.F_GetSettingAttribute( v_sProp, "defaultValue" ) != v_sValue );
- }
- this.F_SetUpdate( true );
- this.F_ShowSetting( v_sProp, v_sValue );
- };
- C_SettingSheet.prototype.f_onSettingFailedValidationChange = function( v_sProp, v_sValue )
- {
- this.F_SetUpdate( true );
- this.F_ShowSetting( v_sProp, v_sValue );
- };
- /**
- * @private
- */
- C_SettingSheet.prototype.f_processNumericInput = function( v_sProp, v_sValue, v_vValue, v_vMin, v_vMax )
- {
- if ( isNaN( v_vValue ) )
- {
- this.f_onSettingFailedValidation( C_SettingSheet.K_iNotValid, v_sProp, v_sValue, v_vMin, v_vMax );
- return false;
- }
- if ( !isNaN( v_vMin ) && ( v_vValue < v_vMin ) )
- {
- this.f_onSettingFailedValidation( C_SettingSheet.K_iLessThanMin, v_sProp, v_sValue, v_vMin, v_vMax );
- return false;
- }
- if ( !isNaN( v_vMax ) && ( v_vValue > v_vMax ) )
- {
- this.f_onSettingFailedValidation( C_SettingSheet.K_iGreaterThanMax, v_sProp, v_sValue, v_vMin, v_vMax );
- return false;
- }
-
- return true;
- };
- /**
- * Shows the list view for a drop down or drop down list setting.
- * @param {String} v_sName The setting name.
- * @param {String} v_sValue The setting value.
- * @param {Node} v_nListView The listView node.
- * @param {Integer} v_iHeight Height of the listView.
- * @param {Integer} v_iWidth Width of the listView.
- * @type void
- */
- C_SettingSheet.prototype.F_ShowListView = function( v_sName, v_sValue, v_nListView, v_iHeight, v_iWidth, v_bAutoWidth )
- {
- var td = this.f_getValueCell( v_sName );
- D_SettingSheetListView.F_Show( this, td, v_sName, v_sValue, v_nListView, v_iHeight, v_iWidth, true );
- };
- C_SettingSheet.prototype.f_setupAccessibility = function()
- {
- if ( !G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- return;
- }
- this.m_tbl.setAttribute( "role", "treegrid" );
- this.m_tbl.setAttribute( "aria-label", G_ResManager.F_GetString( "IDS_AC_SETTINGSHEET_TABLE" ) );
- };
- C_SettingSheet.prototype.f_updateSettingAriaLabel = function( v_sName, v_sDisplayValue )
- {
- if ( !G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- return;
- }
- var v_tdValue = this.F_GetFixedValueCell( v_sName );
- switch ( this.m_oTypes[v_sName] )
- {
- case "string":
- var v_sAriaLabel = ( this.m_oTypes[v_sName] == "string" ) ? "IDS_HAL_AC_PROPERTY_TEXT" : "IDS_HAL_AC_PROPERTY_DROPDOWN";
- v_sDisplayValue = v_sDisplayValue || G_ResManager.F_GetString( v_sAriaLabel );
- v_tdValue.firstChild.setAttribute( "aria-label", v_sDisplayValue );
- break;
- case "boolean":
- case "dropDownList":
- v_tdValue.setAttribute( "aria-label", v_sDisplayValue );
- break;
- }
- };
- C_SettingSheet.prototype.f_setupAccessibilityEventHandler = function( v_bAdd )
- {
- if ( !G_HAL.M_oLibraries["hal"]["enableAccessibility"] || !this.m_tbl )
- {
- return;
- }
- if ( !this.m_fnOnFocusCallback )
- {
- this.m_fnOnFocusCallback = this.f_onFocus.F_CreateMethodCallback( this );
- }
- // Accessibility is only suspported on FF
- if ( v_bAdd )
- {
- // focus and blur events don't bubble, so we have to capture it
- U_Accessibility.F_AddFocusAndBlurEventListener( this.m_tbl, this.m_fnOnFocusCallback, null );
- }
- else
- {
- U_Accessibility.F_RemoveFocusAndBlurEventListener( this.m_tbl, this.m_fnOnFocusCallback, null );
- }
- };
- C_SettingSheet.prototype.f_onFocus = function( e )
- {
- if ( !G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- return;
- }
- e = e || window.event;
- var v_elSrc = e.srcElement;
- var v_trSettingRow = this.f_getSettingRowFromChild( v_elSrc );
- this.f_activateSetting( v_trSettingRow );
- if ( this.m_elLastFocus )
- {
- this.m_elLastFocus.setAttribute( "tabIndex", "-1" );
- }
- v_elSrc.setAttribute( "tabIndex", "0" );
- this.m_elLastFocus = v_elSrc;
- };
- C_SettingSheet.prototype.f_clearAccessibility = function()
- {
- if ( !G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- return;
- }
- this.m_elLastFocus = null;
- };
- C_SettingSheet.prototype.f_getActionButton = function( v_sName )
- {
- var v_elButtonTD;
- var v_elValueCellTable = this.f_getValueCell( v_sName ).firstChild;
- if ( v_elValueCellTable )
- {
- v_elButtonTD = v_elValueCellTable.rows.item( 0 ).cells.item( 1 );
- }
- return v_elButtonTD ? v_elButtonTD.firstChild : null;
- };
- /*
- * @public
- */
- C_SettingSheet.prototype.F_GetFocusableElements = function( v_sSettingName )
- {
- if ( !G_HAL.M_oLibraries["hal"]["enableAccessibility"] )
- {
- return null;
- }
- var v_aFocus = [];
- v_aFocus.push( this.f_getLabelCell( v_sSettingName ) );
- var v_elValue;
- var v_trSettingRow = this.f_getSettingRow( v_sSettingName );
- switch ( v_trSettingRow.v_sSettingType )
- {
- case "string":
- v_elValue = this.F_GetFixedValueCell( v_sSettingName ).firstChild;
- break;
- case "dropDownList":
- case "boolean":
- v_elValue = this.F_GetFixedValueCell( v_sSettingName );
- break;
- }
- if ( v_elValue )
- {
- v_aFocus.push( v_elValue );
- }
- var v_elButton = this.f_getActionButton( v_sSettingName );
- if ( v_elButton )
- {
- v_aFocus.push( v_elButton );
- }
- return v_aFocus;
- };
- C_SettingSheet.prototype.f_handleAccessibilityKeyDown = function( e )
- {
- if ( !G_HAL.M_oLibraries["hal"]["enableAccessibility"] || !this.m_sActiveSetting )
- {
- return;
- }
- var v_srcEle = e.srcElement;
- switch ( e.keyCode )
- {
- case U_DOM.K_iKeyArrowUp:
- U_DOM.F_CancelEvent( e );
- var v_iRow = this.m_oSettingToRow[this.m_sActiveSetting];
- var v_iNumberOfRows = this.m_tbl.rows.length;
- for ( var i = v_iRow - 1; i >= 0; i-- )
- {
- var v_elPreviousRow = this.m_tbl.rows.item( i );
- if ( v_elPreviousRow && v_elPreviousRow.style.display != "none")
- {
- var v_aFocus = this.F_GetFocusableElements( v_elPreviousRow.v_sSettingName );
- if ( v_aFocus && v_aFocus.length > 0 )
- {
- v_aFocus[0].focus();
- return;
- }
- }
- }
- break;
- case U_DOM.K_iKeyArrowDown:
- U_DOM.F_CancelEvent( e );
- var v_iRow = this.m_oSettingToRow[this.m_sActiveSetting];
- var v_iNumberOfRows = this.m_tbl.rows.length;
- for ( var i = v_iRow + 1; i < v_iNumberOfRows; i++ )
- {
- var v_elNextRow = this.m_tbl.rows.item( i );
- if ( v_elNextRow && v_elNextRow.style.display != "none")
- {
- var v_aFocus = this.F_GetFocusableElements( v_elNextRow.v_sSettingName );
- if ( v_aFocus && v_aFocus.length > 0 )
- {
- v_aFocus[0].focus();
- return;
- }
- }
- }
- break;
- case U_DOM.K_iKeyArrowLeft:
- U_DOM.F_CancelEvent( e );
- var v_aFocus = this.F_GetFocusableElements( this.m_sActiveSetting );
- for ( var i = v_aFocus.length - 1; i >= 0; i-- )
- {
- if ( v_aFocus[i] == v_srcEle && v_aFocus[i-1] )
- {
- v_aFocus[i-1].focus();
- return;
- }
- }
- break;
- case U_DOM.K_iKeyArrowRight:
- U_DOM.F_CancelEvent( e );
- var v_aFocus = this.F_GetFocusableElements( this.m_sActiveSetting );
- for ( var i = 0; i < v_aFocus.length; i++ )
- {
- if ( v_aFocus[i] == v_srcEle && v_aFocus[i+1] )
- {
- v_aFocus[i+1].focus();
- return;
- }
- }
- break;
- case U_DOM.K_iKeySpace:
- case U_DOM.K_iKeyEnter:
- // for button, browser actually fire a onclick event
- if ( this.m_sActiveSetting && v_srcEle.nodeName != "BUTTON" )
- {
- var v_trSettingRow = this.f_getSettingRow( this.m_sActiveSetting );
- this.f_doDblClick( v_trSettingRow );
- U_DOM.F_CancelEvent( e );
- }
- break;
- case U_DOM.K_iKeyDelete:
- if ( !this.m_bEditingText && this.m_sActiveSetting )
- {
- this.m_oListener.F_SettingSheet_OnSettingDelete( this, this.m_sActiveSetting );
- U_DOM.F_CancelEvent( e );
- }
- break;
- }
- };
- G_HAL.F_VerifyDependencies( "C_Dialog" );
- /**
- * @private
- */
- var D_SettingSheetListView = new C_Dialog( "D_SettingSheetListView" );
- /**
- * @private
- */
- D_SettingSheetListView.F_Show = function( v_oSettingSheet, td, v_sName, v_sValue, v_nListView, v_iHeight, v_iWidth, v_bAutoWidth )
- {
- if ( !this.m_divListView )
- {
- this.m_divListView = this.F_GetDlgItem( "divListView" );
- }
- this.m_oSettingSheet = v_oSettingSheet;
- var doc = document;
- this.m_sSettingName = v_sName;
- var v_sHeight = isNaN( v_iHeight ) ? ( ( v_nListView.selectNodes( "listItems/listItem" ).length > 8 ) ? "1.2in" : "" ) : ( v_iHeight + "px" );
- this.m_divListView.style.height = v_sHeight;
- if ( isNaN( v_iWidth ) )
- {
- v_iWidth = td.offsetWidth - 1;
- }
- var v_sWidth = ( Math.max( 60, v_iWidth ) + "px" );
- if ( G_BrowserInfo.M_bIsIE )
- {
- this.m_divListView.style.width = v_sWidth;
- }
- else
- {
- this.m_divListView.style.width = "auto";
- this.m_divListView.style.minWidth = v_sWidth;
- }
- if (v_bAutoWidth)
- {
- this.m_divListView.style.overflow = "visible";
- this.m_divListView.style.overflowY = "auto";
- }
- else
- {
- this.m_divListView.style.overflow = "";
- this.m_divListView.style.overflowY = "";
- }
- v_nListView.setAttribute( "allowCtrlDeselect", "false" );
- this.m_oListView = new C_ListView( this.m_divListView, v_nListView, this );
- if ( v_sValue == null )
- {
- this.m_oListView.F_ClearSelections( true );
- }
- this.M_fnSuper_Show( td );
- if ( v_sValue != null )
- {
- this.m_oListView.F_SelectByValue( v_sValue, true, false );
- }
- };
- /**
- * @private
- */
- D_SettingSheetListView.F_Dialog_OnAfterVisible = function()
- {
- if ( G_BrowserInfo.M_bIsIE && ( this.m_oListView.F_GetListViewNode().getAttribute( "view" ) == "report" ) )
- {
- this.m_divListView.style.paddingBottom = ( this.m_divListView.scrollWidth > this.m_divListView.offsetWidth ) ? "16px" : "";
- }
- this.F_EnsureDialogIsVisible();
- this.m_divListView.focus();
- };
- /**
- * @private
- */
- D_SettingSheetListView.F_Dialog_OnAfterHide = function()
- {
- if ( this.m_oListView )
- {
- this.m_oListView.F_Detach();
- delete this.m_oListView;
- }
- delete this.m_oSettingSheet;
- };
- /**
- * @private
- */
- D_SettingSheetListView.F_ListView_OnItemClick = function( v_oListView, v_nListItem, v_iMouseButton )
- {
- if (v_nListItem.getAttribute("selectable") == "false")
- {
- return;
- }
- setTimeout( this.F_Hide.F_CreateMethodCallback( this ), 0 );
- var v_sValue = v_nListItem.getAttribute( "value" );
- if ( v_sValue == null )
- {
- v_sValue = C_ListView.F_GetListItemLabel( v_nListItem );
- }
- this.m_oSettingSheet.F_OnSettingChange( this.m_sSettingName, v_sValue );
- // var v_oListener = this.m_oSettingSheet.m_oListener;
- // setTimeout( v_oListener.F_SettingSheet_OnSettingChange.F_CreateMethodCallback( v_oListener, this.m_oSettingSheet, this.m_sSettingName, v_sValue ), 0 );
- };
|