Ignore:
Timestamp:
03/10/10 18:47:48 (2 years ago)
Author:
sys
Message:

tabs views : menu sur touche menu contextuel & ctrl+space

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Xul_Core/content/scenariCore/widgets/matrix/matrix.xbl.xml

    r15067 r15093  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<!-- 
    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   --> 
     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          --> 
    4141 
    4242<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"> 
     
    136136         
    137137        <!-- 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                --> 
    144144        <binding id="slot-base"> 
    145145                <resources> 
     
    172172                                ]]></getter> 
    173173                                <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; 
    187187                                ]]></setter> 
    188188                        </property> 
     
    211211                                <parameter name="pView"/> 
    212212                                <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); 
    227222                                                                vStructChanged = true; 
    228223                                                        } 
    229                                                         if(vView.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; 
    232227                                                                        vStructChanged = true; 
    233228                                                                } 
    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); 
    238240                                                                } 
    239                                                                 this.fFillTabSvc.fillTab(vTab, vView); 
     241                                                                //log.debug("vTab::::::::"+dom.getXml(vTab)); 
    240242                                                        } 
    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                                        } 
    262262                                ]]></body> 
    263263                        </method> 
    264264                         
    265265                        <!-- 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                                --> 
    269269                        <method name="fillTab"> 
    270270                                <parameter name="pTab"/> 
    271271                                <parameter name="pView"/> 
    272272                                <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                                        } 
    282282                                ]]></body> 
    283283                        </method> 
     
    288288                                <parameter name="pEvent"/> 
    289289                                <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                                        } 
    297297                                ]]></body> 
    298298                        </method> 
     
    303303                                <parameter name="pSelectedView"/> 
    304304                                <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                                        } 
    344344                                ]]></body> 
    345345                        </method> 
     
    357357                                                this.dispatchEvent(vEvent); 
    358358                                        } 
    359                         ]]></body> 
     359                                ]]></body> 
    360360                        </method> 
    361361                        <!-- Interne. Navigation entre les views du slot. --> 
     
    374374                         
    375375                        <!-- 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                                --> 
    378378                        <method name="searchPreviousSelectedView"> 
    379379                                <body><![CDATA[ 
     
    400400                                <parameter name="pView"/> 
    401401                                <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; 
    432415                                                                this.parentNode.onMatrixUpdates(); 
    433416                                                        } 
    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                                        } 
    439439                                ]]></body> 
    440440                        </method> 
    441441                         
    442442                        <!-- 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. 
    445445--> 
    446446                        <method name="dispatchChange"> 
     
    510510         
    511511        <!-- Slot des views secondaires offrant des fonctions dédiées. 
    512         --> 
     512                --> 
    513513        <binding id="slotFeatures" extends="#slot-base"> 
    514514                <content orient="vertical" flex="1"> 
     
    552552                                <parameter name="pOverflow"/> 
    553553                                <body><![CDATA[ 
    554                                 if(this.fListenOverflow) this.redraw(); 
     554                                        if(this.fListenOverflow) this.redraw(); 
    555555                                ]]></body> 
    556556                        </method> 
     
    593593                                <parameter name="pRoot"/> 
    594594                                <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                                        } 
    604604                                ]]></body> 
    605605                        </method> 
    606606                        <method name="clearButtonsBars"> 
    607607                                <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); 
    610610                                ]]></body> 
    611611                        </method> 
     
    637637                        <stylesheet src="chrome://scenariCore-platform/content/widgets/matrix/matrix.xbl.css"/> 
    638638                </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"/> 
    650650                </content> 
    651651                <implementation> 
    652652                        <field name="fView">null</field> 
    653653                        <field name="fSlot">document.getBindingParent(this)</field> 
    654                         <field name="fOptionMnu">document.getAnonymousElementByAttribute(this, "anonid", "optionMnu")</field> 
    655654                        <property name="selected" onget="return this.className.indexOf('selectedTab')&gt;=0"/> 
     655 
    656656                        <method name="showOptionMnu"> 
    657657                                <parameter name="pNode"/> 
    658658                                <body><![CDATA[ 
    659659                                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); 
    669662                                }catch(e){log.debug("slotTabContent.showOptionMnu : "+e);} 
    670663                                ]]></body> 
    671664                        </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> 
    672679                        <method name="doCommand"> 
    673680                                <body><![CDATA[ 
    674681                                        if(this.fView) this.fSlot.selectedView = this.fView; 
    675                         ]]></body> 
     682                                ]]></body> 
    676683                        </method> 
    677684                        <method name="closeTab"> 
    678685                                <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> 
    692699                        </method> 
    693700                </implementation> 
     
    702709                                this.fSlot.toggleMaximizeBlock(); 
    703710                        </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> 
    709711                        <handler event="keypress" keycode="VK_LEFT"> 
    710712                                var vDir = window.getComputedStyle(this.parentNode, null).direction; 
     
    715717                                this.fSlot.advanceSelectedView(vDir == 'ltr' ? 1 : -1); 
    716718                        </handler> 
     719                        <handler event="keypress" charcode=" " modifiers="control" phase="target" action="this.showOptionMnu(this);"/> 
    717720                </handlers> 
    718721        </binding> 
    719722         
    720723        <!-- 
    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                --> 
    723726        <binding id="slotResizer" extends="xul:splitter"> 
    724727                <resources> 
     
    732735         
    733736        <!-- 
    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ée 
    743                 - 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                --> 
    746749        <binding id="view-base"> 
    747750                <implementation> 
     
    754757                         
    755758                        <!-- Demande de fermeture de la view.  
    756                         Par défaut la view n'est pas physiquement supprimée, elle est simplement cachée 
    757                         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                                --> 
    760763                        <method name="closeView"> 
    761764                                <body><![CDATA[ 
     
    765768                         
    766769                        <!-- 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                                --> 
    769772                        <method name="closeViewByHiding"> 
    770773                                <body><![CDATA[ 
     
    782785                         
    783786                        <!-- 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                                --> 
    786789                        <method name="closeViewByRemove"> 
    787790                                <body><![CDATA[ 
     
    813816                         
    814817                        <!-- Demande l'ouverture de la view si elle est dans l'état closed.  
    815                         La view peut être programmatiquement fermée indépendamment  
    816                         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                                --> 
    819822                        <method name="openView"> 
    820823                                <body><![CDATA[ 
     
    836839                         
    837840                        <!-- @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 faire  
    840                         évoluer leur statut (disabled, checked...). Une fois cette méthode appelée, la view ne  
    841                         doit pas ajouter ou supprimer des boutons ou faire varier la dimension des boutons dans  
    842                         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                                --> 
    844847                        <!--  
    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                                --> 
    850853                </implementation> 
    851854        </binding> 
Note: See TracChangeset for help on using the changeset viewer.