Ignore:
Timestamp:
08/18/11 12:39:22 (13 years ago)
Author:
vmipsl
Message:

[Visualization] interface quite finish

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/web/resources/js/etherClasses.js

    r89 r130  
    22/* ****************** LIST ************************* */ 
    33/* ************************************************* */ 
    4 var ListItem = Class.create({ 
     4var ListItem = Class.create( { 
    55 
    66    initialize: function( plateforms, objectParameter ) 
    77    { 
    88        this.array = $A(); 
    9         $A(plateforms).each(function( jsonObject ) 
     9        $A( plateforms ).each( function( jsonObject ) 
    1010        { 
    11             this.addItem(jsonObject, objectParameter); 
    12         }.bind(this)); 
     11            this.addItem( jsonObject, objectParameter ); 
     12        }.bind( this ) ); 
    1313    }, 
    1414 
     
    1919        var objectItemNew = new Object(); 
    2020        objectItemNew.jsonElement = jsonElement; 
    21         objectItemNew.divItem = this.createItemDiv(objectItemNew.jsonElement, objectParameter); 
     21        objectItemNew.divItem = this.createItemDiv( objectItemNew.jsonElement, objectParameter ); 
    2222 
    23         this.array.push(objectItemNew); 
     23        this.array.push( objectItemNew ); 
    2424    }, 
    2525 
    2626    createItemDiv: function( itemHash, objectParameter ) 
    2727    { 
    28         return new Plateform(itemHash, objectParameter); 
     28        return new Plateform( itemHash, objectParameter ); 
    2929    }, 
    3030 
    3131    addOpenListener : function( func ) 
    3232    { 
    33         this.array.each(function( objectItem ) 
     33        this.array.each( function( objectItem ) 
    3434        { 
    35             objectItem.divItem.addOpenListener(func); 
    36         }); 
     35            objectItem.divItem.addOpenListener( func ); 
     36        } ); 
    3737    }, 
    3838 
     
    4141        if( 0 >= this.array.size() ) 
    4242        { 
    43             var divNoItem = $(document.createElement("div")); 
     43            var divNoItem = $( document.createElement( "div" ) ); 
    4444            divNoItem.id = idIfNoItem; 
    4545            divNoItem.textContent = textIfNoItem; 
    46             parentNode.appendChild(divNoItem); 
     46            parentNode.appendChild( divNoItem ); 
    4747        } 
    4848        else 
    49             this.array.each(function( item ) 
     49            this.array.each( function( item ) 
    5050            { 
    51                 item.divItem.display(parentNode); 
    52             }); 
     51                item.divItem.display( parentNode ); 
     52            } ); 
    5353    }, 
    5454 
    5555    displayWithPairImpair : function( parentNode, idIfNoItem, textIfNoItem ) 
    5656    { 
    57         Dom.clearContainer(parentNode); 
     57        Dom.clearContainer( parentNode ); 
    5858        if( 0 >= this.array.size() ) 
    5959        { 
    60             var divNoItem = $(document.createElement("div")); 
     60            var divNoItem = $( document.createElement( "div" ) ); 
    6161            divNoItem.id = idIfNoItem; 
    6262            divNoItem.textContent = textIfNoItem; 
    63             parentNode.appendChild(divNoItem); 
     63            parentNode.appendChild( divNoItem ); 
    6464        } 
    6565        else 
    6666        { 
    67                 var rowNumber = 0; 
    68             this.array.each(function( item ) 
     67            var rowNumber = 0; 
     68            this.array.each( function( item ) 
    6969            { 
    70                 if(rowNumber % 2 == 0) 
    71                     item.divItem.display(parentNode,"pair"); 
    72                 else 
    73                     item.divItem.display(parentNode,"impair"); 
    74                 rowNumber++; 
    75             }); 
     70                if( rowNumber % 2 == 0 ) 
     71                    item.divItem.display( parentNode, "pair" ); 
     72                else 
     73                    item.divItem.display( parentNode, "impair" ); 
     74                rowNumber++; 
     75            } ); 
    7676        } 
    7777    }, 
     
    8080    { 
    8181        var returnObj = false; 
    82         this.array.each(function( objItem ) 
     82        this.array.each( function( objItem ) 
    8383        { 
    8484            if( objItem.jsonElement.id == itemId ) 
    8585                returnObj = objItem; 
    86         }.bind(this)); 
     86        }.bind( this ) ); 
    8787 
    8888        return returnObj; 
    8989    } 
    9090 
    91 }); 
     91} ); 
    9292 
    9393/* ************************************************* */ 
    9494/* ****************** ITEM ************************* */ 
    9595/* ************************************************* */ 
    96 var Item = Class.create({ 
     96var Item = Class.create( { 
    9797 
    9898    initialize: function( jsonElement, objectParameter ) 
    9999    { 
    100         this.jsonElement = Object.clone(jsonElement); // Warning: This is only a shallow copy 
     100        this.jsonElement = Object.clone( jsonElement ); // Warning: This is only a shallow copy 
    101101        this.listeners = $A(); 
    102102 
     
    124124    createContainer: function ( containerName, classNameValue ) 
    125125    { 
    126         this.divContainer = $(document.createElement("div")); 
     126        this.divContainer = $( document.createElement( "div" ) ); 
    127127        this.divContainer.item = this; 
    128         if(classNameValue) 
    129         this.divContainer.className = classNameValue; 
     128        if( classNameValue ) 
     129            this.divContainer.className = classNameValue; 
    130130        this.divContainer.id = containerName + "_" + this.jsonElement.id; 
    131131    }, 
     
    134134    { 
    135135        this.parentNode = parentNode; 
    136         parentNode.appendChild(this.divContainer); 
     136        parentNode.appendChild( this.divContainer ); 
    137137    }, 
    138138 
     
    146146    { 
    147147        if( classNameValue ) 
    148             this.divContainer.addClassName(classNameValue); 
     148            this.divContainer.addClassName( classNameValue ); 
    149149    }, 
    150150 
     
    152152    { 
    153153        if( classNameValue ) 
    154             this.divContainer.removeClassName(classNameValue); 
     154            this.divContainer.removeClassName( classNameValue ); 
    155155    }, 
    156156 
    157157    executeListenersFunction: function() 
    158158    { 
    159         this.listeners.each(function ( func ) 
     159        this.listeners.each( function ( func ) 
    160160        { 
    161             func(this); 
    162         }.bind(this)); 
     161            func( this ); 
     162        }.bind( this ) ); 
    163163    }, 
    164164 
     
    166166    { 
    167167        if( this.divContainer ) 
    168             Event.observe(this.divContainer, 'click', this.onClickContainer.bindAsEventListener(this)); 
     168            Event.observe( this.divContainer, 'click', this.onClickContainer.bindAsEventListener( this ) ); 
    169169    }, 
    170170 
    171171    addOpenListener: function( func ) 
    172172    { 
    173         this.listeners.push(func); 
     173        this.listeners.push( func ); 
    174174    }, 
    175175 
     
    179179            return; 
    180180 
    181         this.divName = $(document.createElement("div")); 
     181        this.divName = $( document.createElement( "div" ) ); 
    182182        this.divName.className = classNameValue; 
    183183        this.divName.innerHTML = this.jsonElement.name; 
    184184 
    185         this.divContainer.appendChild(this.divName); 
     185        this.divContainer.appendChild( this.divName ); 
     186    }, 
     187 
     188    getName: function () 
     189    { 
     190        return this.jsonElement.name; 
    186191    } 
    187 }); 
     192 
     193} ); 
Note: See TracChangeset for help on using the changeset viewer.