- Timestamp:
- 03/10/10 18:47:48 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Xul_Core/content/scenariCore/widgets/matrix/matrix.xbl.xml
r15067 r15093 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <!-- 3 * LICENCE[[4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1/CeCILL 2.O5 *6 * The contents of this file are subject to the Mozilla Public License Version7 * 1.1 (the "License"); you may not use this file except in compliance with8 * the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/9 *10 * Software distributed under the License is distributed on an "AS IS" basis,11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License12 * for the specific language governing rights and limitations under the13 * License.14 *15 * The Original Code is kelis.fr code.16 *17 * The Initial Developer of the Original Code is18 * sylvain.spinelli@kelis.fr19 *20 * Portions created by the Initial Developer are Copyright (C) 2009-201021 * the Initial Developer. All Rights Reserved.22 *23 * Contributor(s):24 * samuel.monsarrat@kelis.fr25 *26 *27 * Alternatively, the contents of this file may be used under the terms of28 * either of the GNU General Public License Version 2 or later (the "GPL"),29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),30 * or the CeCILL Licence Version 2.0 (http://www.cecill.info/licences.en.html),31 * in which case the provisions of the GPL, the LGPL or the CeCILL are applicable32 * instead of those above. If you wish to allow use of your version of this file33 * only under the terms of either the GPL or the LGPL, and not to allow others34 * to use your version of this file under the terms of the MPL, indicate your35 * decision by deleting the provisions above and replace them with the notice36 * and other provisions required by the GPL or the LGPL. If you do not delete37 * the provisions above, a recipient may use your version of this file under38 * the terms of any one of the MPL, the GPL, the LGPL or the CeCILL.39 * ]]LICENCE40 -->3 * LICENCE[[ 4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1/CeCILL 2.O 5 * 6 * The contents of this file are subject to the Mozilla Public License Version 7 * 1.1 (the "License"); you may not use this file except in compliance with 8 * the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ 9 * 10 * Software distributed under the License is distributed on an "AS IS" basis, 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 12 * for the specific language governing rights and limitations under the 13 * License. 14 * 15 * The Original Code is kelis.fr code. 16 * 17 * The Initial Developer of the Original Code is 18 * sylvain.spinelli@kelis.fr 19 * 20 * Portions created by the Initial Developer are Copyright (C) 2009-2010 21 * the Initial Developer. All Rights Reserved. 22 * 23 * Contributor(s): 24 * samuel.monsarrat@kelis.fr 25 * 26 * 27 * Alternatively, the contents of this file may be used under the terms of 28 * either of the GNU General Public License Version 2 or later (the "GPL"), 29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 30 * or the CeCILL Licence Version 2.0 (http://www.cecill.info/licences.en.html), 31 * in which case the provisions of the GPL, the LGPL or the CeCILL are applicable 32 * instead of those above. If you wish to allow use of your version of this file 33 * only under the terms of either the GPL or the LGPL, and not to allow others 34 * to use your version of this file under the terms of the MPL, indicate your 35 * decision by deleting the provisions above and replace them with the notice 36 * and other provisions required by the GPL or the LGPL. If you do not delete 37 * the provisions above, a recipient may use your version of this file under 38 * the terms of any one of the MPL, the GPL, the LGPL or the CeCILL. 39 * ]]LICENCE 40 --> 41 41 42 42 <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xbl="http://www.mozilla.org/xbl"> … … 136 136 137 137 <!-- Slot. Code commun aux slots de features et aux slots de contents. 138 Attributs :139 slotTabLocalName : nom de balise xul pour créer des tabs.140 fillTabSvc : code du service à utiliser pour renseigner l'onglet en fonction de la view associée.141 Ce service doit contenir une méthode fillTab(pTab, pView)142 autoCollapse : "false" ne masque pas automatiquement ce slot si il est ne contient plus d'onglets visibles.143 -->138 Attributs : 139 slotTabLocalName : nom de balise xul pour créer des tabs. 140 fillTabSvc : code du service à utiliser pour renseigner l'onglet en fonction de la view associée. 141 Ce service doit contenir une méthode fillTab(pTab, pView) 142 autoCollapse : "false" ne masque pas automatiquement ce slot si il est ne contient plus d'onglets visibles. 143 --> 144 144 <binding id="slot-base"> 145 145 <resources> … … 172 172 ]]></getter> 173 173 <setter><![CDATA[ 174 var vSelectedIndex = -1;175 if(val && val.nodeType==1) for (var vView = val; vView != null; vView = vView.previousElementSibling) {176 vSelectedIndex++;177 }178 if(this.fDeck.selectedIndex != vSelectedIndex) {179 //L'index dans le desk a changé.180 //log.info("L'index dans le desk a changé:::"+this.fDeck.selectedIndex+"/"+vSelectedIndex);181 this.fDeck.selectedIndex = vSelectedIndex;182 } else if(val !== this.fLastViewShown){183 //L'index ne bouge pas mais la view a changée.184 this.setNewViewShown(val);185 }186 return val;174 var vSelectedIndex = -1; 175 if(val && val.nodeType==1) for (var vView = val; vView != null; vView = vView.previousElementSibling) { 176 vSelectedIndex++; 177 } 178 if(this.fDeck.selectedIndex != vSelectedIndex) { 179 //L'index dans le desk a changé. 180 //log.info("L'index dans le desk a changé:::"+this.fDeck.selectedIndex+"/"+vSelectedIndex); 181 this.fDeck.selectedIndex = vSelectedIndex; 182 } else if(val !== this.fLastViewShown){ 183 //L'index ne bouge pas mais la view a changée. 184 this.setNewViewShown(val); 185 } 186 return val; 187 187 ]]></setter> 188 188 </property> … … 211 211 <parameter name="pView"/> 212 212 <body><![CDATA[ 213 try { 214 var vSelectedView = this.selectedView; 215 var vView = this.firstElementChild; 216 var vTab = this.fTabsContainer.firstElementChild; 217 var vStructChanged = false; 218 while(vView) { 219 if(!vTab) { 220 vTab = document.createElementNS(dom.XULNS, this.fSlotTabLocalName); 221 this.fTabsContainer.appendChild(vTab); 222 vStructChanged = true; 223 } 224 if(vTab.fView !== vView || pView === vView){ 225 if(vTab.fView !== vView) { 226 vTab.fView = vView; 213 try { 214 var vSelectedView = this.selectedView; 215 var vView = this.firstElementChild; 216 var vTab = this.fTabsContainer.firstElementChild; 217 var vStructChanged = false; 218 while(vView) { 219 if(!vTab) { 220 vTab = document.createElementNS(dom.XULNS, this.fSlotTabLocalName); 221 this.fTabsContainer.appendChild(vTab); 227 222 vStructChanged = true; 228 223 } 229 if(v View.getAttribute("closed")=="true"){230 if( !vTab.hidden) {231 vTab. hidden = true;224 if(vTab.fView !== vView || pView === vView){ 225 if(vTab.fView !== vView) { 226 vTab.fView = vView; 232 227 vStructChanged = true; 233 228 } 234 } else { 235 if(vTab.hidden) { 236 vTab.hidden = false; 237 vStructChanged = true; 229 if(vView.getAttribute("closed")=="true") { 230 if(!vTab.hidden) { 231 vTab.hidden = true; 232 vStructChanged = true; 233 } 234 } else { 235 if(vTab.hidden) { 236 vTab.hidden = false; 237 vStructChanged = true; 238 } 239 this.fFillTabSvc.fillTab(vTab, vView); 238 240 } 239 this.fFillTabSvc.fillTab(vTab, vView);241 //log.debug("vTab::::::::"+dom.getXml(vTab)); 240 242 } 241 //log.debug("vTab::::::::"+dom.getXml(vTab)); 242 } 243 vView = vView.nextElementSibling; 244 if(vTab) vTab = vTab.nextElementSibling; 245 } 246 while(vTab) { 247 //Il reste des onglets sans view, on vire. 248 var vNext = vTab.nextElementSibling; 249 this.fTabsContainer.removeChild(vTab); 250 vTab = vNext; 251 vStructChanged = true; 252 } 253 if(vSelectedView === pView && pView.getAttribute("closed")=="true") { 254 //La view vient d'etre masquée, on cherche un autre onglet. 255 this.selectedView = this.searchPreviousSelectedView(); 256 } else if(vStructChanged){ 257 this.redrawSructTabs(vSelectedView); 258 } 259 }catch(e){ 260 log.debug("slot.onViewDefinitionUpdates::"+e); 261 } 243 vView = vView.nextElementSibling; 244 if(vTab) vTab = vTab.nextElementSibling; 245 } 246 while(vTab) { 247 //Il reste des onglets sans view, on vire. 248 var vNext = vTab.nextElementSibling; 249 this.fTabsContainer.removeChild(vTab); 250 vTab = vNext; 251 vStructChanged = true; 252 } 253 if(vSelectedView === pView && pView.getAttribute("closed")=="true") { 254 //La view vient d'etre masquée, on cherche un autre onglet. 255 this.selectedView = this.searchPreviousSelectedView(); 256 } else if(vStructChanged){ 257 this.redrawSructTabs(vSelectedView); 258 } 259 }catch(e){ 260 log.debug("slot.onViewDefinitionUpdates::"+e); 261 } 262 262 ]]></body> 263 263 </method> 264 264 265 265 <!-- Renseigne l'onglet en fonction des propriétés de la view. 266 Cette méthode est surchargeable par un Svc dont le nom est spécifié267 en attribut "fillTabSvc".268 -->266 Cette méthode est surchargeable par un Svc dont le nom est spécifié 267 en attribut "fillTabSvc". 268 --> 269 269 <method name="fillTab"> 270 270 <parameter name="pTab"/> 271 271 <parameter name="pView"/> 272 272 <body><![CDATA[ 273 try {274 pTab.setAttribute("label", pView.getAttribute("label")||"");275 pTab.setAttribute("image", pView.getAttribute("iconUrl")||"");276 pTab.setAttribute("tooltiptext", pView.getAttribute("longDesc")||"");277 pTab.setAttribute("accesskey", pView.getAttribute("accesskey")||"");278 pTab.setAttribute("notClosable", ! (pView.getAttribute("closable")=="true"));279 }catch(e){280 log.debug("slot.fillTabSvc::"+e);281 }273 try { 274 pTab.setAttribute("label", pView.getAttribute("label")||""); 275 pTab.setAttribute("image", pView.getAttribute("iconUrl")||""); 276 pTab.setAttribute("tooltiptext", pView.getAttribute("longDesc")||""); 277 pTab.setAttribute("accesskey", pView.getAttribute("accesskey")||""); 278 pTab.setAttribute("notClosable", ! (pView.getAttribute("closable")=="true")); 279 }catch(e){ 280 log.debug("slot.fillTabSvc::"+e); 281 } 282 282 ]]></body> 283 283 </method> … … 288 288 <parameter name="pEvent"/> 289 289 <body><![CDATA[ 290 try {291 if(pEvent.originalTarget !== this.fDeck) return;292 pEvent.stopPropagation();293 this.setNewViewShown(this.selectedView);294 }catch(e){295 log.debug("slot.onSelectedView::"+e);296 }290 try { 291 if(pEvent.originalTarget !== this.fDeck) return; 292 pEvent.stopPropagation(); 293 this.setNewViewShown(this.selectedView); 294 }catch(e){ 295 log.debug("slot.onSelectedView::"+e); 296 } 297 297 ]]></body> 298 298 </method> … … 303 303 <parameter name="pSelectedView"/> 304 304 <body><![CDATA[ 305 try {306 var vTab = this.fTabsContainer.firstElementChild;307 while(vTab && vTab.hidden) vTab = vTab.nextElementSibling;308 var vPosition = "beforeCurrent";309 var vPrevTab = null;310 var vBeforeSelected = true;311 //this.fTabsContainer.className = vTab ? "" : "noTab";312 //Si un onglet était focusé ou aucun focus dans la fenetre, on déplacera le focus sur le nouveau tab.313 var vIsTabFocused = true;314 try { vIsTabFocused = (document.commandDispatcher.focusedElement.parentNode == this.fTabsContainer); } catch(e){}315 while(vTab) {316 var vNextTab = vTab.nextElementSibling;317 while(vNextTab && vNextTab.hidden) vNextTab = vNextTab.nextElementSibling;318 var vClasses = [];319 if(!vPrevTab) {320 vClasses.push("firstTab");321 } else if(vPrevTab.fView == pSelectedView){322 vClasses.push("justAfterSelected");323 }324 if(!vNextTab) {325 vClasses.push("lastTab");326 } else if(vNextTab.fView == pSelectedView){327 vClasses.push("justBeforeSelected");328 }329 if(vTab.fView == pSelectedView) {330 vClasses.push("selectedTab");331 vBeforeSelected = false;332 if (vIsTabFocused) window.setTimeout(function(pTab){pTab.focus();}, 0, vTab);333 if (this.fTabsBar) this.fTabsBar.ensureElementIsVisible(vTab);334 } else {335 vClasses.push(vBeforeSelected ? "beforeSelected" : "afterSelected" );336 }337 vTab.className = vClasses.join(" ");338 vPrevTab = vTab;339 vTab = vNextTab;340 }341 }catch(e){342 log.debug("slot.redrawSructTabs::"+e);343 }305 try { 306 var vTab = this.fTabsContainer.firstElementChild; 307 while(vTab && vTab.hidden) vTab = vTab.nextElementSibling; 308 var vPosition = "beforeCurrent"; 309 var vPrevTab = null; 310 var vBeforeSelected = true; 311 //this.fTabsContainer.className = vTab ? "" : "noTab"; 312 //Si un onglet était focusé ou aucun focus dans la fenetre, on déplacera le focus sur le nouveau tab. 313 var vIsTabFocused = true; 314 try { vIsTabFocused = (document.commandDispatcher.focusedElement.parentNode == this.fTabsContainer); } catch(e){} 315 while(vTab) { 316 var vNextTab = vTab.nextElementSibling; 317 while(vNextTab && vNextTab.hidden) vNextTab = vNextTab.nextElementSibling; 318 var vClasses = []; 319 if(!vPrevTab) { 320 vClasses.push("firstTab"); 321 } else if(vPrevTab.fView == pSelectedView){ 322 vClasses.push("justAfterSelected"); 323 } 324 if(!vNextTab) { 325 vClasses.push("lastTab"); 326 } else if(vNextTab.fView == pSelectedView){ 327 vClasses.push("justBeforeSelected"); 328 } 329 if(vTab.fView == pSelectedView) { 330 vClasses.push("selectedTab"); 331 vBeforeSelected = false; 332 if (vIsTabFocused) window.setTimeout(function(pTab){pTab.focus();}, 0, vTab); 333 if (this.fTabsBar) this.fTabsBar.ensureElementIsVisible(vTab); 334 } else { 335 vClasses.push(vBeforeSelected ? "beforeSelected" : "afterSelected" ); 336 } 337 vTab.className = vClasses.join(" "); 338 vPrevTab = vTab; 339 vTab = vNextTab; 340 } 341 }catch(e){ 342 log.debug("slot.redrawSructTabs::"+e); 343 } 344 344 ]]></body> 345 345 </method> … … 357 357 this.dispatchEvent(vEvent); 358 358 } 359 ]]></body>359 ]]></body> 360 360 </method> 361 361 <!-- Interne. Navigation entre les views du slot. --> … … 374 374 375 375 <!-- Recherche la précédente vue sélectionnée encore disponible ou retourne la 1ere view à défaut. 376 Utilisé par les views (see view-base#closeViewByRemove()).377 -->376 Utilisé par les views (see view-base#closeViewByRemove()). 377 --> 378 378 <method name="searchPreviousSelectedView"> 379 379 <body><![CDATA[ … … 400 400 <parameter name="pView"/> 401 401 <body><![CDATA[ 402 try{ 403 if(pView && pView.getAttribute("closed")=="true") pView.openView(); 404 this.redrawSructTabs(pView); 405 if(this.fLastViewShown) { 406 var vEvent = document.createEvent('Events'); 407 vEvent.initEvent("viewHidden", true, false); 408 this.fLastViewShown.dispatchEvent(vEvent); 409 } 410 if(pView !== this.fLastViewShown) this.dispatchChange(this.fLastViewShown, pView); 411 this.fLastViewShown = pView; 412 if(pView) { 413 if(this.collapsed) { 414 this.collapsed = false; 415 this.parentNode.onMatrixUpdates(); 416 } 417 //On mémorise sur la view un n° qui s'incrémente à chaque sélection. 418 pView._SlotHistoIdx = this.fSlotHistoIdx++; 419 var vEvent = document.createEvent('Events'); 420 vEvent.initEvent("viewShown", true, false); 421 pView.dispatchEvent(vEvent); 422 } else { 423 //Faute de dispatcher un event "viewShown", on informe this.noViewSelected() 424 this.noViewSelected(); 425 if(this.getAttribute("autoCollapse")!="false") { 426 //On évalue si tous les onglets sont masqués 427 var vTab = this.fTabsContainer.firstElementChild; 428 while(vTab && vTab.hidden) vTab = vTab.nextElementSibling; 429 if(!vTab) { 430 //On collapse le slot. 431 this.collapsed = true; 402 try{ 403 if(pView && pView.getAttribute("closed")=="true") pView.openView(); 404 this.redrawSructTabs(pView); 405 if(this.fLastViewShown) { 406 var vEvent = document.createEvent('Events'); 407 vEvent.initEvent("viewHidden", true, false); 408 this.fLastViewShown.dispatchEvent(vEvent); 409 } 410 if(pView !== this.fLastViewShown) this.dispatchChange(this.fLastViewShown, pView); 411 this.fLastViewShown = pView; 412 if(pView) { 413 if(this.collapsed) { 414 this.collapsed = false; 432 415 this.parentNode.onMatrixUpdates(); 433 416 } 434 } 435 } 436 }catch(e){ 437 log.debug("slot.setNewViewShown::"+e); 438 } 417 //On mémorise sur la view un n° qui s'incrémente à chaque sélection. 418 pView._SlotHistoIdx = this.fSlotHistoIdx++; 419 var vEvent = document.createEvent('Events'); 420 vEvent.initEvent("viewShown", true, false); 421 pView.dispatchEvent(vEvent); 422 } else { 423 //Faute de dispatcher un event "viewShown", on informe this.noViewSelected() 424 this.noViewSelected(); 425 if(this.getAttribute("autoCollapse")!="false") { 426 //On évalue si tous les onglets sont masqués 427 var vTab = this.fTabsContainer.firstElementChild; 428 while(vTab && vTab.hidden) vTab = vTab.nextElementSibling; 429 if(!vTab) { 430 //On collapse le slot. 431 this.collapsed = true; 432 this.parentNode.onMatrixUpdates(); 433 } 434 } 435 } 436 }catch(e){ 437 log.debug("slot.setNewViewShown::"+e); 438 } 439 439 ]]></body> 440 440 </method> 441 441 442 442 <!-- Interne. Diffuse un évènement informant du changement de view. 443 Non implémenté dans le slot de base.444 Voir les slotContents.443 Non implémenté dans le slot de base. 444 Voir les slotContents. 445 445 --> 446 446 <method name="dispatchChange"> … … 510 510 511 511 <!-- Slot des views secondaires offrant des fonctions dédiées. 512 -->512 --> 513 513 <binding id="slotFeatures" extends="#slot-base"> 514 514 <content orient="vertical" flex="1"> … … 552 552 <parameter name="pOverflow"/> 553 553 <body><![CDATA[ 554 if(this.fListenOverflow) this.redraw();554 if(this.fListenOverflow) this.redraw(); 555 555 ]]></body> 556 556 </method> … … 593 593 <parameter name="pRoot"/> 594 594 <body><![CDATA[ 595 try {596 while(pRoot.hasChildNodes()) pRoot.removeChild(pRoot.lastChild);597 var vView = this.selectedView;598 if(vView && ("buildSlotButtons" in vView)) {599 vView.buildSlotButtons(pRoot);600 }601 } catch(e){602 log.debug("buildSlotButtons failed : "+e);603 }595 try { 596 while(pRoot.hasChildNodes()) pRoot.removeChild(pRoot.lastChild); 597 var vView = this.selectedView; 598 if(vView && ("buildSlotButtons" in vView)) { 599 vView.buildSlotButtons(pRoot); 600 } 601 } catch(e){ 602 log.debug("buildSlotButtons failed : "+e); 603 } 604 604 ]]></body> 605 605 </method> 606 606 <method name="clearButtonsBars"> 607 607 <body><![CDATA[ 608 while(this.fButtonsBarBody.hasChildNodes()) this.fButtonsBarBody.removeChild(this.fButtonsBarBody.lastChild);609 while(this.fButtonsBar2.hasChildNodes()) this.fButtonsBar2.removeChild(this.fButtonsBar2.lastChild);608 while(this.fButtonsBarBody.hasChildNodes()) this.fButtonsBarBody.removeChild(this.fButtonsBarBody.lastChild); 609 while(this.fButtonsBar2.hasChildNodes()) this.fButtonsBar2.removeChild(this.fButtonsBar2.lastChild); 610 610 ]]></body> 611 611 </method> … … 637 637 <stylesheet src="chrome://scenariCore-platform/content/widgets/matrix/matrix.xbl.css"/> 638 638 </resources> 639 <content align="center" >640 < children>641 <xul:hbox anonid="tabLabel" class="tabLabel">642 <xul:image class="tabLabelIco" xbl:inherits="src=image"/>643 <xul:label class="tabLabelTxt small-margin" xbl:inherits="value=label"/>644 </xul:hbox>645 <xul:toolbarbutton anonid="closeBtn" class="closeBtn" hidden="true" xbl:inherits="hidden=notClosable" oncommand="document.getBindingParent(this).closeTab();" tooltiptext="Fermer cet onglet"/>646 <xul: popup anonid="optionMnu">647 <xul:menuitem anonid="optionMnu.closeTab" hidden="true" xbl:inherits="hidden=notClosable" label="Fermer cet onglet" oncommand="document.getBindingParent(this).closeTab();" tooltiptext=""/>648 </xul:popup>649 </children>639 <content align="center" contextmenu="_child"> 640 <xul:menupopup anonid="optionMnu" onpopupshowing="return document.getBindingParent(this).onPopupShowing(event);"> 641 <xul:menuitem anonid="optionMnu.closeTab" hidden="true" xbl:inherits="hidden=notClosable" label="Fermer cet onglet" oncommand="document.getBindingParent(this).closeTab();" tooltiptext=""/> 642 </xul:menupopup> 643 <xul:hbox anonid="tabLabel" class="tabLabel"> 644 <children> 645 <xul:image class="tabLabelIco" xbl:inherits="src=image"/> 646 <xul:label class="tabLabelTxt small-margin" xbl:inherits="value=label"/> 647 </children> 648 </xul:hbox> 649 <xul:toolbarbutton anonid="closeBtn" class="closeBtn" hidden="true" xbl:inherits="hidden=notClosable" oncommand="document.getBindingParent(this).closeTab();" tooltiptext="Fermer cet onglet"/> 650 650 </content> 651 651 <implementation> 652 652 <field name="fView">null</field> 653 653 <field name="fSlot">document.getBindingParent(this)</field> 654 <field name="fOptionMnu">document.getAnonymousElementByAttribute(this, "anonid", "optionMnu")</field>655 654 <property name="selected" onget="return this.className.indexOf('selectedTab')>=0"/> 655 656 656 <method name="showOptionMnu"> 657 657 <parameter name="pNode"/> 658 658 <body><![CDATA[ 659 659 try{ 660 var vShow = false; 661 var vMnuItems = this.fOptionMnu.children; 662 for(var i =0; i < vMnuItems.length; i++) { 663 if (vMnuItems[i].localName == "menuitem" && vMnuItems[i].getAttribute("hidden") != "true") { 664 vShow = true; 665 break; 666 } 667 } 668 if (vShow) this.fOptionMnu.openPopup(pNode, 'after_start', 0, 1, true, false); 660 var vMnu = document.getAnonymousElementByAttribute(this, "anonid", "optionMnu"); 661 vMnu.openPopup(pNode, 'after_start', 0, 1, true, false); 669 662 }catch(e){log.debug("slotTabContent.showOptionMnu : "+e);} 670 663 ]]></body> 671 664 </method> 665 <method name="onPopupShowing"> 666 <parameter name="pEvent"/> 667 <body><![CDATA[ 668 try{ 669 var vMnuItems = pEvent.target.children; 670 for(var i =0; i < vMnuItems.length; i++) { 671 if (vMnuItems[i].localName == "menuitem" && vMnuItems[i].getAttribute("hidden") != "true") { 672 return true; 673 } 674 } 675 return false; 676 }catch(e){log.debug("slotTabContent.onPopupShowing : "+e);} 677 ]]></body> 678 </method> 672 679 <method name="doCommand"> 673 680 <body><![CDATA[ 674 681 if(this.fView) this.fSlot.selectedView = this.fView; 675 ]]></body>682 ]]></body> 676 683 </method> 677 684 <method name="closeTab"> 678 685 <body><![CDATA[ 679 try {680 if(this.fView) {681 return this.fView.closeView();682 } else {683 //Onglet sans view, curieux, on redraw les onglets.684 log.debug("XXX tab with no view ?");685 this.fSlot.selectedView = this.fSlot.searchPreviousSelectedView();686 return true;687 }688 }catch(e){689 log.debug("slotTab.closeTab : "+e);690 }691 ]]></body>686 try { 687 if(this.fView) { 688 return this.fView.closeView(); 689 } else { 690 //Onglet sans view, curieux, on redraw les onglets. 691 log.debug("XXX tab with no view ?"); 692 this.fSlot.selectedView = this.fSlot.searchPreviousSelectedView(); 693 return true; 694 } 695 }catch(e){ 696 log.debug("slotTab.closeTab : "+e); 697 } 698 ]]></body> 692 699 </method> 693 700 </implementation> … … 702 709 this.fSlot.toggleMaximizeBlock(); 703 710 </handler> 704 <handler event="mousedown" button="2" phase="capturing"><![CDATA[705 event.stopPropagation();706 this.doCommand();707 this.showOptionMnu(document.getAnonymousElementByAttribute(this, "anonid", "tabLabel"));708 ]]></handler>709 711 <handler event="keypress" keycode="VK_LEFT"> 710 712 var vDir = window.getComputedStyle(this.parentNode, null).direction; … … 715 717 this.fSlot.advanceSelectedView(vDir == 'ltr' ? 1 : -1); 716 718 </handler> 719 <handler event="keypress" charcode=" " modifiers="control" phase="target" action="this.showOptionMnu(this);"/> 717 720 </handlers> 718 721 </binding> 719 722 720 723 <!-- 721 Objet exploité en interne pour permettre le resize des slots (insérés dynamiquement par la matrix).722 -->724 Objet exploité en interne pour permettre le resize des slots (insérés dynamiquement par la matrix). 725 --> 723 726 <binding id="slotResizer" extends="xul:splitter"> 724 727 <resources> … … 732 735 733 736 <!-- 734 Attributs d'une view exploités par le slot :735 - label : Titre court de la vue.736 - iconUrl : Url de l'icone de la vue.737 - longDesc : Description longue (tooltip).738 - closable : Si "true", la vue peut-être fermée (via un bouton "fermer" dans le slot).739 - closed : onglet masqué si closed="true".740 741 Les views sont les targets des events suivants :742 - viewShown : la view est affichée743 - viewHidden : la view est masquée (passée en second plan)744 - DOMNodeRemoved : la view est supprimée XXX à évaluer, quid si c'est le slot entier qui est supprimé ?745 -->737 Attributs d'une view exploités par le slot : 738 - label : Titre court de la vue. 739 - iconUrl : Url de l'icone de la vue. 740 - longDesc : Description longue (tooltip). 741 - closable : Si "true", la vue peut-être fermée (via un bouton "fermer" dans le slot). 742 - closed : onglet masqué si closed="true". 743 744 Les views sont les targets des events suivants : 745 - viewShown : la view est affichée 746 - viewHidden : la view est masquée (passée en second plan) 747 - DOMNodeRemoved : la view est supprimée XXX à évaluer, quid si c'est le slot entier qui est supprimé ? 748 --> 746 749 <binding id="view-base"> 747 750 <implementation> … … 754 757 755 758 <!-- Demande de fermeture de la view. 756 Par défaut la view n'est pas physiquement supprimée, elle est simplement cachée757 via l'attribut "closed".758 @return true si la demande a été réalisée (ou si était déjà clos).759 -->759 Par défaut la view n'est pas physiquement supprimée, elle est simplement cachée 760 via l'attribut "closed". 761 @return true si la demande a été réalisée (ou si était déjà clos). 762 --> 760 763 <method name="closeView"> 761 764 <body><![CDATA[ … … 765 768 766 769 <!-- Demande de fermeture de la view par masquage via l'attribut "closed". 767 @return true si la demande a été réalisée (ou si était déjà clos).768 -->770 @return true si la demande a été réalisée (ou si était déjà clos). 771 --> 769 772 <method name="closeViewByHiding"> 770 773 <body><![CDATA[ … … 782 785 783 786 <!-- Demande de fermeture de la view avec suppression physique de la view. 784 @return true si la demande a été réalisée (ou si était déjà clos).785 -->787 @return true si la demande a été réalisée (ou si était déjà clos). 788 --> 786 789 <method name="closeViewByRemove"> 787 790 <body><![CDATA[ … … 813 816 814 817 <!-- Demande l'ouverture de la view si elle est dans l'état closed. 815 La view peut être programmatiquement fermée indépendamment816 de l'attribut "closable" qui n'a qu'un effet sur l'IHM.817 @return true si la demande a été réalisée.818 -->818 La view peut être programmatiquement fermée indépendamment 819 de l'attribut "closable" qui n'a qu'un effet sur l'IHM. 820 @return true si la demande a été réalisée. 821 --> 819 822 <method name="openView"> 820 823 <body><![CDATA[ … … 836 839 837 840 <!-- @API [optionnel] Appelé par le slot pour construire la barre d'outils. 838 Cette méthode peut-etre appelée plusieurs fois suite à des changeemnts dans l'IHM.839 Des références aux derniers boutons créés peuvent être gardées par la view pour faire840 évoluer leur statut (disabled, checked...). Une fois cette méthode appelée, la view ne841 doit pas ajouter ou supprimer des boutons ou faire varier la dimension des boutons dans842 la toolbar (pourrait provoquer des sauts graphiques désagréables).843 -->841 Cette méthode peut-etre appelée plusieurs fois suite à des changeemnts dans l'IHM. 842 Des références aux derniers boutons créés peuvent être gardées par la view pour faire 843 évoluer leur statut (disabled, checked...). Une fois cette méthode appelée, la view ne 844 doit pas ajouter ou supprimer des boutons ou faire varier la dimension des boutons dans 845 la toolbar (pourrait provoquer des sauts graphiques désagréables). 846 --> 844 847 <!-- 845 <method name="buildSlotButtons">846 <parameter name="pToolbar"/>847 <body><![CDATA[]]></body>848 </method>849 -->848 <method name="buildSlotButtons"> 849 <parameter name="pToolbar"/> 850 <body><![CDATA[]]></body> 851 </method> 852 --> 850 853 </implementation> 851 854 </binding>
Note: See TracChangeset
for help on using the changeset viewer.