Ignore:
Timestamp:
08/31/11 16:51:42 (13 years ago)
Author:
vmipsl
Message:

Interface _ plusieurs graphs possible sur le même quicklook

Location:
ether_megapoli/trunk/web/resources/js
Files:
3 edited

Legend:

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

    r89 r172  
    1111//******************************************************** 
    1212 
    13 var Button = Class.create({ 
     13var Button = Class.create( { 
    1414    initialize: function( param ) 
    1515    { 
     
    2121        this.classNameText = param.classNameText ? param.classNameText : false; 
    2222        this.callbackOnClick = param.onClick ? param.onClick : false; 
     23        this.callbackOnMouseOver = param.onMouseOver ? param.onMouseOver : false; 
     24        this.callbackOnMouseOut = param.onMouseOut ? param.onMouseOut : false; 
    2325        this.boolDisabled = false; 
    2426        this.boolSelected = false; 
     
    2628 
    2729        // Create button elements 
    28         this.divContainer = $(document.createElement("button")); 
    29         if(this.className) 
    30                 this.divContainer.className = this.className; 
     30        this.divContainer = $( document.createElement( "button" ) ); 
     31        if( this.className ) 
     32            this.divContainer.className = this.className; 
    3133        this.divContainer.atMe = this; 
    3234        this.divContainer.id = this.id; 
    3335        if( this.parent ) 
    34             this.parent.appendChild(this.divContainer); 
     36            this.parent.appendChild( this.divContainer ); 
    3537 
    36         this.divText = $(document.createElement("div")); 
    37         if(this.classNameText) 
    38                 this.divText.className = "button_text"; 
     38        this.divText = $( document.createElement( "div" ) ); 
     39        if( this.classNameText ) 
     40            this.divText.className = "button_text"; 
    3941        this.divText.innerHTML = this.value; 
    40         this.divContainer.appendChild(this.divText); 
    41          
     42        this.divContainer.appendChild( this.divText ); 
     43 
    4244        // Define button events 
    43         Event.observe(this.divContainer, 'click', this.onClick.bindAsEventListener(this)); 
    44         Event.observe(this.divContainer, 'mouseover', this.onHover.bindAsEventListener(this)); 
     45        Event.observe( this.divContainer, 'click', this.onClick.bindAsEventListener( this ) ); 
     46        Event.observe( this.divContainer, 'mouseover', this.onHover.bindAsEventListener( this ) ); 
     47        Event.observe( this.divContainer, 'mouseout', this.onOut.bindAsEventListener( this ) ); 
    4548    }, 
    4649 
     
    5154        return this.divContainer; 
    5255    }, 
    53      
     56 
    5457    isDisable : function() 
    5558    { 
    5659        return this.boolDisabled; 
    5760    }, 
    58      
     61 
    5962    isSelected: function() 
    6063    { 
    6164        return this.boolSelected; 
    6265    }, 
    63      
     66 
    6467    setValue : function( value ) 
    6568    { 
     
    6770        this.divText.innerHTML = this.value; 
    6871    }, 
    69      
     72 
    7073    setCallbackOnClick : function( value ) 
    7174    { 
    7275        this.callbackOnClick = value; 
    7376    }, 
    74      
     77 
    7578    // Actions ******************************************************** 
    7679 
     
    7881    { 
    7982        this.boolDisabled = true; 
    80         this.divContainer.addClassName("disable"); 
     83        this.divContainer.addClassName( "disable" ); 
    8184    }, 
    82      
     85 
    8386    enable : function() 
    8487    { 
    8588        this.boolDisabled = false; 
    86         this.divContainer.removeClassName("disable"); 
     89        this.divContainer.removeClassName( "disable" ); 
    8790    }, 
    88      
     91 
    8992    select : function( value ) 
    9093    { 
    9194        this.boolSelected = value; 
    9295        if( this.boolSelected ) 
    93             this.divContainer.addClassName("selected"); 
     96            this.divContainer.addClassName( "selected" ); 
    9497        else 
    95             this.divContainer.removeClassName("selected"); 
     98            this.divContainer.removeClassName( "selected" ); 
    9699    }, 
    97      
     100 
    98101    show : function() 
    99102    { 
     
    117120                this.callbackOnClick(); 
    118121        } 
    119         Event.stop(event); 
     122        Event.stop( event ); 
    120123    }, 
    121124 
    122125    onHover : function( event ) 
    123126    { 
    124         Event.stop(event); 
     127        if( !this.isDisable() && this.callbackOnMouseOver ) 
     128            this.callbackOnMouseOver(); 
     129 
     130        Event.stop( event ); 
     131    }, 
     132 
     133    onOut: function() 
     134    { 
     135        if( !this.isDisable() && this.callbackOnMouseOut ) 
     136            this.callbackOnMouseOut(); 
    125137    } 
    126 }); 
     138} ); 
  • ether_megapoli/trunk/web/resources/js/Select.js

    r131 r172  
    33// Display a Select 
    44// 
    5 // obj objParam: {id, [parent], [specificClass], [maxOptionSize], [isDisable], [isDisplayed], [arrayData]} 
     5// obj objParam: {id, [parent], [specificClass], [maxOptionSize], [isDisable], [isDisplayed]} 
    66//    int objParam.id: id of the dom element 
    77//    [dom objParam.parent]: in which dom element to draw the button 
     
    1010//    [int objParam.isDisable]: is the Select disable by default? 
    1111//    [int objParam.isDisplayed]: is the Select opened by default? 
    12 //    [arr objParam.arrayData]: array of data to display 
    1312// 
    1413// Public functions 
     
    3837        this.indexOption = 0; 
    3938        this.isHover = false; 
    40         this.arrayData = objectParameter.arrayData ? objectParameter.arrayData : $A(); 
    4139        this.arrayOptions = $A(); 
     40        this.className = objectParameter.className ? "select_container " + objectParameter.className : "select_container"; 
     41        this.classNameOption = objectParameter.classNameOption ? "select_choicelist " + objectParameter.classNameOption : "select_choicelist"; 
    4242 
    4343        // Select div 
    4444        this.divSelect = document.createElement( "div" ); 
    4545        this.divSelect.id = this.id; 
    46         this.divSelect.className = "select_container"; 
     46        this.divSelect.className = this.className; 
    4747 
    4848        this.divSelectLeft = document.createElement( "div" ); 
     
    6363        this.divOption = document.createElement( "div" ); 
    6464        this.divSelect.id = this.id; 
    65         this.divOption.className = "select_choicelist"; 
     65        this.divOption.className = this.classNameOption; 
    6666        this.parent.appendChild( this.divOption ); 
    6767 
     
    9090    }, 
    9191 
     92    getSize: function() 
     93    { 
     94      return this.arrayOptions.size(); 
     95    }, 
     96 
    9297    // private 
    9398    toggleOption:function() 
     
    139144 
    140145    // public 
     146    /** 
     147     * This method indicates if the itemValue is already in the array 
     148     */ 
     149    content: function( itemValue ) 
     150    { 
     151        var resu = false; 
     152        this.arrayOptions.each( function( divOption ) 
     153        { 
     154            if( divOption.itemValue == itemValue ) 
     155            { 
     156                resu = true; 
     157                throw $break; 
     158            } 
     159        }.bind( this ) ); 
     160        return resu; 
     161    }, 
     162 
     163    // public 
    141164    add: function( itemValue, itemName, callback ) 
    142165    { 
    143  
    144166        var divOption = document.createElement( "div" ); 
    145167        divOption.className = "select_item_middle"; 
     
    177199            this.arrayOptions = this.arrayOptions.without( divOption ); 
    178200        }.bind( this ) ); 
     201    }, 
     202 
     203    // public 
     204    /** 
     205     * This method changes only the content of the divSelect without add the item to the array 
     206     * @param itemValue 
     207     * @param itemName 
     208     * @param callback 
     209     */ 
     210    changeSelectMiddle: function( itemValue, itemName, callback ) 
     211    { 
     212        this.add( itemValue, itemName, callback ); 
     213        this.select( itemValue, callback ); 
     214        this.remove( itemValue ); 
    179215    }, 
    180216 
  • ether_megapoli/trunk/web/resources/js/etherClasses.js

    r130 r172  
    109109            if( objectParameter.isExpiredTitle ) 
    110110                this.isExpiredTitle = objectParameter.isExpiredTitle; 
     111            this.onMouseOverContainer = objectParameter.onMouseOverContainer ? objectParameter.onMouseOverContainer : false; 
     112            this.onMouseOutContainer = objectParameter.onMouseOutContainer ? objectParameter.onMouseOutContainer : false; 
    111113        } 
    112114    }, 
     
    137139    }, 
    138140 
    139     onClickContainer: function( event ) 
     141    onHoverContainer: function( event ) 
    140142    { 
    141143        if( !event || (event.detail == undefined || 1 == event.detail) ) 
     
    143145    }, 
    144146 
     147    onClickContainer: function( event ) 
     148    { 
     149        if( !event || (event.detail == undefined || 1 == event.detail) ) 
     150            this.executeListenersFunction(); 
     151    }, 
     152 
    145153    selectWithParameter: function( classNameValue ) 
    146154    { 
     
    167175        if( this.divContainer ) 
    168176            Event.observe( this.divContainer, 'click', this.onClickContainer.bindAsEventListener( this ) ); 
     177        if( this.divContainer && this.onMouseOverContainer ) 
     178            Event.observe( this.divContainer, 'mouseover', this.onMouseOverContainer.bindAsEventListener( this ) ); 
     179        if( this.divContainer && this.onMouseOutContainer ) 
     180            Event.observe( this.divContainer, 'mouseout', this.onMouseOutContainer.bindAsEventListener( this ) ); 
    169181    }, 
    170182 
Note: See TracChangeset for help on using the changeset viewer.