Changeset 6488


Ignore:
Timestamp:
09/08/06 16:50:30 (5 years ago)
Author:
sam
Message:

maj scDragMgr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Wsp_Modeling/spaces/gen/modelBuilder/bs.doss/_common/sm/webSiteGenerator/scDragMgr.js

    r6481 r6488  
    9090        // vContainer.labelsToAdd = [{label:vLabel1}, {label:vLabel2, x:23, y:65}] - "x:23, y:65" issu de saveLabelPos((pLabel)) 
    9191        repopulateContainers : function (pKey) { 
    92                 //TODO 
     92                this.dragdrop.repopulateContainers(pKey); return this 
    9393        }, 
    9494         
     
    110110        // Fix a constraint box in which the label can be dragged 
    111111        setConstraintBox : function (pLabel, pNode) { 
    112                 // FIXME: Disable on Konqueror type browsers as this they cannot support this for the moment 
     112                // FIXME: Disable on Konqueror type browsers as they cannot support this for the moment 
    113113                if (navigator.userAgent.toLowerCase().indexOf("khtml") != -1) return 
    114114                this.dragdrop.setConstraintBox(pLabel, pNode); return this 
     
    117117        // Returns a string rep of the label's position 
    118118        saveLabelPos : function (pLabel) { 
    119                 //TODO 
    120                 return "" 
     119                return this.dragdrop.saveLabelPos(pLabel) 
    121120        } 
    122121} 
     
    181180        fUndef : "undefined", 
    182181 
    183         serializeList : function(list) { 
    184                 var items = list.getElementsByTagName("li") 
    185                 var array = new Array() 
    186                 for (var i = 0, n = items.length; i < n; i++) { 
    187                         var item = items[i] 
    188  
    189                         array.push(scDragMgr.utilities._identifier(item)) 
    190                 } 
    191                 return array.join('|') 
    192         }, 
    193  
    194         inspectListOrder : function(id) { 
    195                 alert(scDragMgr.utilities.serializeList(document.getElementById(id))) 
    196         }, 
    197  
    198         getDropContainers : function (pRootNode, pKey) { 
    199                 var vContainers = new Array() 
    200                 vContainers = scDragMgr.dragdrop.getZones(pRootNode, pKey) 
    201                 vContainers.concat(scDragMgr.dragsort.getContainers(pRootNode, pKey)) 
    202                 return vContainers 
    203         }, 
    204  
    205182        logError : function(pLog) { 
    206183                if(window.console) { 
     
    210187                } 
    211188        }, 
    212  
    213  
    214189         
    215190        restoreListOrder : function(listID) { 
     
    428403        toString : function() { 
    429404                return "(" + this.x + "," + this.y + ")" 
     405        }, 
     406 
     407        toHash : function() { 
     408                return {"x":this.x,"y":this.y} 
    430409        }, 
    431410 
     
    860839        }, 
    861840 
     841        // EXTERNAL - CONTAINER - Resets the content of all containers with the labels contained in  
     842        // vContainer.labelsToAdd = [{label:vLabel1}, {label:vLabel2, x:23, y:65}] - "x:23, y:65" issu de saveLabelPos((pLabel)) 
     843        repopulateContainers : function (pKey) { 
     844                try { 
     845                        var vCatchment = scDragMgr.dragdrop.fFirstCatchments[pKey] 
     846                        while (vCatchment != null) { 
     847                                this._emptyLabels(vCatchment.fContainer) 
     848                                vCatchment = vCatchment.fNextCatchment 
     849                        } 
     850                        vCatchment = scDragMgr.dragdrop.fFirstCatchments[pKey] 
     851                        while (vCatchment != null) { 
     852                                this._populate(vCatchment.fContainer) 
     853                                vCatchment = vCatchment.fNextCatchment 
     854                        } 
     855                } catch (vError) { 
     856                        scDragMgr.utilities.logError("dragdrop.repopulateContainers: "+vError) 
     857                } 
     858        }, 
     859         
    862860        // EXTERNAL - LABEL - Make a dragdrop label 
    863861        makeDraggableLabel : function(pKey, pLabel, pHandle) { 
     
    924922                } 
    925923        }, 
     924 
     925        // EXTERNAL - LABEL - Returns a string rep of the label's position 
     926        saveLabelPos : function (pLabel) { 
     927                try { 
     928                        var vPos = scDragMgr.coordinates.topLeftOffset(pLabel) 
     929                        var vRetVal = 'x:'+vPos.x 
     930                        vRetVal += ',y:'+vPos.y 
     931                        return vRetVal 
     932                } catch (vError) { 
     933                        scDragMgr.utilities.logError("dragdrop.saveLabelPos: "+vError) 
     934                } 
     935        }, 
     936 
     937        // INTERNAL functions ======================================================== 
     938        // INTERNAL - CONTAINER - Empty all draggable labels contained in pContainer 
     939        _emptyLabels : function(pContainer) { 
     940                if  (typeof pContainer != scDragMgr.utilities.fUndef) { 
     941                        var vChild = pContainer.firstChild 
     942                        while (vChild != null) { 
     943                                if  (vChild.fIsDraggable) { 
     944                                        var vNextChild = vChild.nextSibling 
     945                                        pContainer.removeChild(vChild) 
     946                                        vChild = vNextChild 
     947                                } else vChild = vChild.nextSibling 
     948                        } 
     949                } 
     950        }, 
     951        // INTERNAL - CONTAINER - Populate pContainer with all draggable labels found in pContainer.labelsToAdd 
     952        _populate : function(pContainer) { 
     953                if  (typeof pContainer != scDragMgr.utilities.fUndef && pContainer.labelsToAdd) { 
     954                        for (var i = 0, n = pContainer.labelsToAdd.length; i < n; i++) { 
     955                                if (pContainer.labelsToAdd[i] && pContainer.labelsToAdd[i].label) { 
     956                                        var vLabel = pContainer.labelsToAdd[i].label 
     957                                        pContainer.appendChild(vLabel) 
     958                                        if (pContainer.fCatchment.fDropMode == 'inBulk') { 
     959                                                // FIXME : inBulk repositionning 
     960                                                scDragMgr.coordinates.create(0, 0).reposition(vLabel) 
     961                                        } else scDragMgr.coordinates.create(0, 0).reposition(vLabel) 
     962                                } 
     963                        } 
     964                        pContainer.fCatchment.xUpdateGui() 
     965                        pContainer.labelsToAdd = null 
     966                } 
     967        }, 
    926968         
    927         // INTERNAL functions ======================================================== 
    928969        // INTERNAL update acontainer GUI (show/hide ifEmpty etc) 
    929970        _UpdateGui : function() { 
     
    10071048                var vCoordinates = scDragMgr.coordinates 
    10081049                var vXmouse = pDragEvent.transformedMouseOffset 
    1009                  
    10101050                var vPrevious = vHelpers.previousItem(vItem, vItem.nodeName) 
    10111051                while (vPrevious != null) { 
     
    10211061                        return 
    10221062                } 
    1023  
    10241063                var vNext = vHelpers.nextItem(vItem, vItem.nodeName) 
    10251064                while (vNext != null) { 
Note: See TracChangeset for help on using the changeset viewer.