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

impl tree : bodyMinWidth

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.