Changeset 15058


Ignore:
Timestamp:
03/06/10 11:58:53 (2 years ago)
Author:
sys
Message:

impl tree : bodyMinWidth

Location:
trunk/Xul_Commons
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Xul_Commons/content/scenariCommons/widgets/jsTree/jsTree.xbl.xml

    r15056 r15058  
    8080                        <method name="initColumns"> 
    8181                                <body><![CDATA[ 
     82                                try{ 
    8283                                        var vCdLists = this.getAttribute("columnsLists"); 
    8384                                        if(vCdLists) { 
     
    116117                                                Components.utils.import("resource://scenariCommons/widgets/jsTree/columns.jsm", vLib); 
    117118                                                vLib.columns.injectSplitters(vTreeCols); 
    118                                                 log.info("vTreeCols::::::::::::::::::::::::::\n"+log.getXml(vTreeCols)); 
     119                                                vLib.columns.computeBodyMinWidth(vTreeCols); 
    119120                                        } 
    120121                                        //Initialisation des CellBuilders. 
    121122                                        this.fView.initTree(); 
     123                                }catch(e){log.debug("jsTree.initColumns : "+e);} 
    122124                                ]]></body> 
    123125                        </method> 
  • trunk/Xul_Commons/content/scenariCommons/widgets/tree/tree.css

    r14843 r15058  
    22@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); 
    33 
     4/** 
     5 * fichier css à inclure en amont du widget tree (dans le xbl container ou dans la page xul). 
     6 */ 
    47 
    58tree { 
  • trunk/Xul_Commons/content/scenariCommons/widgets/tree/tree.xml

    r14843 r15058  
    4747 
    4848<!-- 
    49  Implémentation du xul:tree avec une méthode supplémentaire canChangeSelect() pour pouvoir verrouiler 
    50  le changement de sélection. 
     49 Implémentation du xul:tree avec : 
     50 - une méthode supplémentaire canChangeSelect() pour pouvoir verrouiler 
     51   le changement de sélection. 
     52 - la gestion d'un attribut "bodyMinWidth" sur le noeud treecols permettant de forcer l'affichage 
     53   d'un scrollbar horizontal si la largeur du widget tree est inférieure à la valeur renseignée (en pixel). 
     54    
     55 ATTENTION : pour activer ces fonctionnalités, le css "chrome://scenariCommons/content/widgets/tree/tree.css" 
     56 doit être inclus dans le contexte amont du widget tree (dans le xbl container ou dans la page xul). 
    5157--> 
    5258<bindings id="treeBindings" 
     
    889895    <content orient="horizontal"> 
    890896      <xul:hbox class="tree-scrollable-columns" flex="1"> 
    891         <children includes="treecol|splitter"/> 
     897        <xul:hbox flex="1" xbl:inherits="minwidth=bodyMinWidth"> 
     898                <children includes="treecol|splitter"/> 
     899        </xul:hbox> 
    892900      </xul:hbox> 
    893901      <xul:treecolpicker class="treecol-image" fixed="true" xbl:inherits="tooltiptext=pickertooltiptext"/> 
  • trunk/Xul_Commons/modules/scenariCommons/commons/actions.jsm

    r14781 r15058  
    246246                vAccelKey = this.fAccelKeys[vIdx]; 
    247247                if(vAccelKey) { 
    248                         if(vAccelKey.getAction().isEnabled(pActionContext)) { 
     248                        if(vAccelKey.getAction().isVisible(pActionContext) && vAccelKey.getAction().isEnabled(pActionContext)) { 
    249249                                vAccelKey.getAction().execute(pEvent, pActionContext); 
    250250                                return 2; 
  • trunk/Xul_Commons/modules/scenariCommons/widgets/jsTree/columns.jsm

    r15056 r15058  
    8585        }, 
    8686         
     87        getWidth : function(pTreeCols){ 
     88                return this.fWidth || 0; 
     89        }, 
     90        setWidth : function(pWidth){ 
     91                this.fWidth = pWidth; 
     92                return this; 
     93        }, 
     94         
    8795        isHidden : function(pTreeCols){ 
    8896                return this.fHidden || false; 
     
    128136                vTreeCol.setAttribute("id", this.getId()); 
    129137                vTreeCol.setAttribute("label", this.getLabel(pTreeCols)); 
    130                 vTreeCol.setAttribute("flex", this.getFlex(pTreeCols)); 
    131                 if(this.isIgnoreInColumnPicker()) vTreeCol.setAttribute("ignoreincolumnpicker", "true"); 
    132                 if(this.isHidden()) vTreeCol.setAttribute("hidden", "true"); 
     138                if(this.getFlex(pTreeCols)>0) vTreeCol.setAttribute("flex", this.getFlex(pTreeCols)); 
     139                if(this.getWidth(pTreeCols)>0) vTreeCol.setAttribute("width", this.getWidth(pTreeCols)); 
     140                if(this.isIgnoreInColumnPicker(pTreeCols)) vTreeCol.setAttribute("ignoreincolumnpicker", "true"); 
     141                if(this.isHidden(pTreeCols)) vTreeCol.setAttribute("hidden", "true"); 
    133142                vTreeCol.fCellBuilderFactory = this.getCellBuilderFactory(pTreeCols); 
    134143                pTreeCols.appendChild(vTreeCol); 
     
    167176        } 
    168177} 
     178 
     179/** 
     180 * Additionne la largeur standard de toutes les colonnes et l'affecte comme 
     181 * largeur minimale de la zone de contnu de l'arbre forçant l'apparition  
     182 * d'une scrollbar horizontal si la lergeur du widget tree est insuffisante. 
     183 *  
     184 * ATTENTION : pour activer ces fonctionnalités, le css "chrome://scenariCommons/content/widgets/tree/tree.css" 
     185 * doit être inclus dans le contexte amont du widget tree (dans le xbl container ou dans la page xul). 
     186 */ 
     187columns.computeBodyMinWidth = function(pTreeCols){ 
     188        var vMinWidth = 0; 
     189        var vChild = pTreeCols.firstElementChild; 
     190        while(vChild) { 
     191                if(vChild.localName=="treecol") { 
     192                        var vW = vChild.getAttribute("width"); 
     193                        if(vW) vMinWidth += parseInt(vW); 
     194                } 
     195                vChild = vChild.nextElementSibling; 
     196        } 
     197        if(vMinWidth>0) pTreeCols.setAttribute("bodyMinWidth", vMinWidth);       
     198} 
Note: See TracChangeset for help on using the changeset viewer.