Changeset 732


Ignore:
Timestamp:
01/18/13 17:58:52 (11 years ago)
Author:
vmipsl
Message:

data access

Location:
ether_iasi/trunk
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ether_iasi/trunk/common/implementation/com/ether/DateHelper.java

    r710 r732  
    11package com.ether; 
     2 
     3import org.apache.commons.logging.Log; 
     4import org.apache.commons.logging.LogFactory; 
     5import org.jetbrains.annotations.Nullable; 
    26 
    37import java.text.DateFormat; 
     
    711import java.util.Date; 
    812import java.util.Locale; 
    9  
    10 import org.apache.commons.logging.Log; 
    11 import org.apache.commons.logging.LogFactory; 
    12 import org.jetbrains.annotations.Nullable; 
    1313 
    1414/** 
     
    132132 
    133133    @Nullable 
    134     public static Date parseDate( @Nullable final String date, final String format ) throws ParseException 
     134    public static Date parseDate( @Nullable final String date, final String format ) 
     135            throws ParseException 
    135136    { 
    136         if( date == null ) 
     137        if( date == null ) 
    137138            return null; 
    138139 
    139140        final SimpleDateFormat simpleDateFormat = new SimpleDateFormat( format ); 
    140         return simpleDateFormat.parse(date); 
     141        return simpleDateFormat.parse( date ); 
    141142    } 
    142143 
    143144    private static final Log LOGGER = LogFactory.getLog( DateHelper.class ); 
    144      
     145 
    145146    public static final String FRENCH_DATE_PATTERN_SHORT = "dd/MM/yyyy"; 
     147    public static final String FRENCH_DATE_PATTERN = "dd/MM/yyyy HH:mm"; 
    146148    public static final String ENGLISH_DATE_PATTERN_SHORT = "yyyy-MM-dd"; 
    147149    public static final String ENGLISH_DATE_PATTERN = "yyyy-MM-dd HH:mm"; 
  • ether_iasi/trunk/web/project/dataAccess.jsp

    r728 r732  
    3131    <ether:htmlJs jsFile="classesForJQuery/Select"/> 
    3232    <ether:htmlJs jsFile="classesForJQuery/Tab"/> 
     33    <ether:htmlJs jsFile="classesForJQuery/Radio"/> 
    3334    <ether:htmlJs jsFile="calendar/anytime"/> 
    3435 
     
    4344 
    4445    <div class="containerDataAccess"> 
    45         <div id="title" class="containerTitle"></div> 
     46        <div id="title" class="mainTitle"></div> 
    4647 
    47         <div class="containerAccess"> 
    48             <div class="title1"><spring:message code="label.access.level"/></div><BR/> 
    49             <div id="productLevel"></div> 
    50             <div id="productLevelComment"></div> 
    51         </div> 
     48        <div id="accessContent"> 
     49            <div class="containerAccess"> 
     50                <div class="subTitle"><spring:message code="label.access.level"/></div> 
     51                <BR/> 
    5252 
    53         <div id="spatial" class="containerAccess"> 
    54             <div class="title1"><spring:message code="label.access.spatial"/></div> 
    55         </div> 
     53                <div id="productLevel"></div> 
     54                <div id="productLevelComment"></div> 
     55            </div> 
    5656 
    57         <div id="temporal" class="containerAccess"> 
    58             <div class="title1"><spring:message code="label.access.temporal"/></div><BR/> 
    59             <spring:message code="label.access.date.begin"/> : <input type="text" id="beginDate" size="15"/> 
    60             <spring:message code="label.access.date.end"/> : <input type="text" id="endDate" size="15"/> 
     57            <div id="spatial" class="containerAccess"> 
     58                <div class="subTitle"><spring:message code="label.access.spatial"/></div> 
     59            </div> 
     60 
     61            <div id="temporal" class="containerAccess"> 
     62                <div class="subTitle"><spring:message code="label.access.temporal"/></div> 
     63                <BR/> 
     64                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
     65                <spring:message code="label.access.date.begin"/> : <input type="text" id="beginDate" size="15"/> 
     66                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
     67                <spring:message code="label.access.date.end"/> : <input type="text" id="endDate" size="15"/> 
     68            </div> 
     69 
     70            <div id="buttonDataAccess"></div> 
    6171        </div> 
    6272 
  • ether_iasi/trunk/web/project/dataAccess_script.jsp

    r728 r732  
    1010            this.containerTab = $( "#tab" ); 
    1111            this.containerTitle = $( "#title" ); 
     12            this.containterAccessContent = $( "#accessContent" ); 
    1213            this.containerProductLevel = $( "#productLevel" ); 
    1314            this.containerProductLevelComment = $( "#productLevelComment" ); 
    1415            this.containerSpatial = $( "#spatial" ); 
    1516            this.containerTemporal = $( "#temporal" ); 
     17            this.containerButton = $( "#buttonDataAccess" ); 
    1618            this.containerErrors = $( "#errors" ); 
    1719 
     
    2325            this.lastDate = formatDate( addHoursToDate( new Date(), 1 ) ); 
    2426 
    25             this.createTabs(); 
    2627            this.createProductLevels(); 
    2728            this.createTemporal(); 
     29            this.createTabs(); 
     30 
     31            var dataButton = new Button( {id:"dataButton", value:"<spring:message code="label.access.get"/>", parent:this.containerButton, className: "small get", onClick:jQuery.proxy( this.onClickData, this )} ); 
    2832        }, 
    2933 
     
    4145        createProductLevels: function() 
    4246        { 
    43             var divRadioBalloon = this.createRadio( "ballonRadio", "productLevel", "balloon", '<spring:message code="label.access.level.balloon"/>', jQuery.proxy( this.onClickRadio, [this, '<spring:message code="label.access.level.balloon.comment"/>'] ), true ); 
    44             this.containerProductLevel.append( divRadioBalloon ); 
    45             var divRadioClouds = this.createRadio( "cloudRadio", "productLevel", "cloud", '<spring:message code="label.access.level.clouds"/>', jQuery.proxy( this.onClickRadio, [this, '<spring:message code="label.access.level.clouds.comment"/>'] ), false ); 
    46             this.containerProductLevel.append( divRadioClouds ); 
    47             var divRadioTemp = this.createRadio( "tempRadio", "productLevel", "temp", '<spring:message code="label.access.level.temp"/>', jQuery.proxy( this.onClickRadio, [this, '<spring:message code="label.access.level.temp.comment"/>'] ), false ); 
    48             this.containerProductLevel.append( divRadioTemp ); 
    49             var divRadioCarbon = this.createRadio( "carbonRadio", "productLevel", "carbon", '<spring:message code="label.access.level.carbon"/>', jQuery.proxy( this.onClickRadio, [this, '<spring:message code="label.access.level.carbon.comment"/>'] ), false ); 
    50             this.containerProductLevel.append( divRadioCarbon ); 
    51         }, 
    52  
    53         createRadio: function( id, name, value, text, onClickRadio, checked ) 
    54         { 
    55             var divRadio = $( document.createElement( "div" ) ); 
    56             divRadio.addClass( "radioProductLevel" ); 
    57  
    58             var radio = $( document.createElement( "input" ) ); 
    59             radio.attr( {type: "radio", id:id, name:name, value:value, checked: checked} ); 
    60             divRadio.append( radio ); 
    61  
    62             var label = $( document.createElement( "label" ) ); 
    63             label.attr( {for:id} ); 
    64             label.html( text ); 
    65             divRadio.append( label ); 
    66  
    67             divRadio.bind( 'click', this, onClickRadio ); 
    68             if( checked ) 
    69                 divRadio.click(); 
    70             return divRadio; 
     47            this.radioBalloon = new Radio( {id:"ballonRadio", name:"productLevel", value:"balloon", parent:this.containerProductLevel, className:"radioProductLevel", text:'<spring:message code="label.access.level.balloon"/>', onClick:jQuery.proxy( this.onClickRadio, [this, '<spring:message code="label.access.level.balloon.comment"/>'] )} ); 
     48            this.radioCloud = new Radio( {id:"cloudRadio", name:"productLevel", value:"cloud", parent:this.containerProductLevel, className:"radioProductLevel", text:'<spring:message code="label.access.level.clouds"/>', onClick:jQuery.proxy( this.onClickRadio, [this, '<spring:message code="label.access.level.clouds.comment"/>'] )} ); 
     49            this.radioTemp = new Radio( {id:"tempRadio", name:"productLevel", value:"temp", parent:this.containerProductLevel, className:"radioProductLevel", text:'<spring:message code="label.access.level.temp"/>', onClick:jQuery.proxy( this.onClickRadio, [this, '<spring:message code="label.access.level.temp.comment"/>'] )} ); 
     50            this.radioCarbon = new Radio( {id:"carbonRadio", name:"productLevel", value:"carbon", parent:this.containerProductLevel, className:"radioProductLevel", text:'<spring:message code="label.access.level.carbon"/>', onClick:jQuery.proxy( this.onClickRadio, [this, '<spring:message code="label.access.level.carbon.comment"/>'] )} ); 
    7151        }, 
    7252 
     
    10181            this.beginDate = this.calendarConverter.parse( $( "#beginDate" ).val() ).getTime(); 
    10282            this.endDate = this.calendarConverter.parse( $( "#endDate" ).val() ).getTime(); 
    103  
    104             this.clearCalendarButton = new Button( {value:'<spring:message code="label.clear"/>', parent:this.containerTemporal, id:"button_clear_calendar", className:"small", onClick:jQuery.proxy( this.onClickClear, this )} ); 
    10583        }, 
    10684 
    10785        // REQUESTS ******************************************************** 
    108 //        requestQuickLooksBySelectValues: function() 
    109 //        { 
    110 //            $.ajax( { 
    111 //                url: "project?methodName=getQuicklookByValues&satellite=" + this.selectSatellites.getValue() + "&projection=" + this.selectProjections.getValue() + "&species=" + this.selectSpecies.getValue() + "&date=" + this.beginDate, 
    112 //                success:jQuery.proxy( this.handleQuickLooksBySelectValues, this ), 
    113 //                error: jQuery.proxy( this.showErrors, this ) 
    114 //            } ); 
    115 //        }, 
     86        requestDataAccessBySelectValues: function() 
     87        { 
     88            var radioValue = $( 'input[type=radio][name=productLevel]:checked' ).attr( 'value' ); 
     89            $.ajax( { 
     90                url: "project?methodName=getDataByValues&productLevel=" + radioValue + "&dateBegin=" + this.beginDate + "&dateEnd=" + this.endDate, 
     91                success:jQuery.proxy( this.handleDataAccessBySelectValues, this ), 
     92                error: jQuery.proxy( this.showErrors, this ) 
     93            } ); 
     94        }, 
    11695 
    11796 
    11897        // HANDLES ******************************************************** 
    119 //        handleQuickLooksBySelectValues: function( result ) 
    120 //        { 
    121 // 
    122 //            var plotName = jQuery.parseJSON( result ).plotNameResult; 
    123 //            this.containerQuickLookA.html( plotName ); 
    124 //        }, 
     98        handleDataAccessBySelectValues: function( result ) 
     99        { 
     100            var resu = jQuery.parseJSON( result ).resultTest; 
     101            alert( resu ); 
     102        }, 
    125103 
    126104 
     
    129107        { 
    130108            this.containerTitle.html( '<spring:message code="label.access.metopA.title"/>' ); 
     109            this.containterAccessContent.show(); 
     110            this.initFieldsAB(); 
    131111        }, 
    132112 
     
    134114        { 
    135115            this.containerTitle.html( '<spring:message code="label.access.metopB.title"/>' ); 
     116            this.containterAccessContent.show(); 
     117            this.initFieldsAB(); 
    136118        }, 
    137119 
     
    139121        { 
    140122            this.containerTitle.html( '<spring:message code="label.access.balloon.title"/>' ); 
     123            this.containterAccessContent.hide(); 
    141124        }, 
    142125 
     
    146129            var comment = this[1]; 
    147130            context.containerProductLevelComment.html( comment ); 
    148         }, 
    149  
    150         onClickClear: function() 
    151         { 
    152             $( "#beginDate" ).val( "" ); 
    153             this.beginDate = false; 
    154             $( "#endDate" ).val( "" ); 
    155             this.endDate = false; 
    156131        }, 
    157132 
     
    177152        }, 
    178153 
     154        onClickData : function() 
     155        { 
     156            this.requestDataAccessBySelectValues(); 
     157        }, 
     158 
    179159        // OTHERS ******************************************************** 
    180160        showErrors: function( result ) 
     
    182162            this.containerErrors.show(); 
    183163            this.containerErrors.html( result ); 
     164        }, 
     165 
     166        initFieldsAB: function() 
     167        { 
     168            this.radioBalloon.check(); 
     169            $( "#beginDate" ).val( this.firstDate ); 
     170            $( "#endDate" ).val( this.lastDate ); 
     171            this.beginDate = this.calendarConverter.parse( $( "#beginDate" ).val() ).getTime(); 
     172            this.endDate = this.calendarConverter.parse( $( "#endDate" ).val() ).getTime(); 
    184173        } 
    185174 
  • ether_iasi/trunk/web/resources/css/button.css

    r710 r732  
    3232 
    3333button[type] { 
    34     /* padding: 5px 10px 5px 7px;  Firefox */ 
     34/* padding: 5px 10px 5px 7px;  Firefox */ 
    3535    padding: 2px 10px 5px 7px; /* Firefox */ 
    3636    line-height: 17px; /* Safari */ 
     
    5454 
    5555/* STANDARD */ 
    56 button:hover { 
     56button:hover, button.get:hover { 
    5757    background-color: #dff4ff; 
    5858    border: 1px solid #c2e1ef; 
    5959    color: #336699; 
     60} 
     61 
     62/* GET */ 
     63button.get { 
     64    background-color: #dff4ff; 
     65    border: 1px solid #3167AD; 
     66    color: #0066FF; 
    6067} 
    6168 
     
    149156/* RED BUTTON */ 
    150157button.red_button { 
    151    /* background-color: #581700;*/ 
     158/* background-color: #581700;*/ 
    152159    background-color: #003D6C; 
    153160    height: 39px; 
  • ether_iasi/trunk/web/resources/css/ether.css

    r717 r732  
    88    font-size: 13px; 
    99    line-height: 1.7em; /*color: #333333;*/ 
    10     color: #04155D; 
     10/*color: #04155D;*/ 
     11    color: #595959; 
    1112    font-family: Trebuchet MS, Arial, san-serif; 
    1213} 
     
    7374    position: absolute; 
    7475    top: -13px; 
     76} 
     77 
     78.mainTitle { 
     79    color: #0066FF; 
     80    font-family: Arial, Helvetica, sans-serif; 
     81    font-size: 16pt; 
     82    font-weight: bold; 
     83} 
     84 
     85.subTitle { 
     86    color: #3167AD; 
     87    font-family: Arial, Helvetica, sans-serif; 
     88    font-size: 11pt; 
     89    font-weight: bold; 
     90    margin-left: 12px; 
    7591} 
    7692 
  • ether_iasi/trunk/web/resources/css/iasi.css

    r729 r732  
    6565 
    6666.containerAccess { 
    67     margin: 0 0 10px 0; 
     67    margin-top: 30px; 
    6868    float: left; 
    6969    width: 980px; 
     
    106106    -moz-border-radius: 4px; 
    107107    -webkit-border-radius: 4px; 
    108     border: solid 1px #3E647E; 
    109     color: #3E647E; 
     108    border: solid 1px #AAAAAA; 
     109    color: #AAAAAA; 
    110110    font-size: 11px; 
     111} 
     112 
     113#buttonDataAccess { 
     114    float: right; 
    111115} 
    112116 
     
    115119/** ***************************************************** **/ 
    116120.tab_class { 
    117     background: none repeat scroll 0 0 gray; 
     121    background: none repeat scroll 0 0 #AAAAAA; 
    118122    border-radius: 4px 4px 0 0; 
    119123    color: white; 
     
    128132.tab_class.activated { 
    129133    background: none repeat scroll 0 0 #EDEDED; 
    130     color: #04155D; 
     134    color: #3167AD; 
    131135} 
  • ether_iasi/trunk/web/resources/js/classesForJQuery/Radio.js

    r731 r732  
    66//******************************************************** 
    77 
    8 var Tab = Class.create( { 
     8var Radio = Class.create( { 
    99    initialize: function( param ) 
    1010    { 
    1111        // Init 
    12         this.numTab = param.numTab ? param.numTab : 1; 
    1312        this.id = param.id ? param.id : ""; 
    1413        this.parent = param.parent ? param.parent : false; 
    1514        this.value = param.value ? param.value : ""; 
    16         this.title = param.title ? param.title : false; 
    17         this.className = param.className ? param.className : "tab_class"; 
     15        this.name = param.name ? param.name : ""; 
     16        this.checked = param.checked ? param.checked : false; 
     17        this.text = param.text ? param.text : false; 
     18        this.className = param.className ? param.className : false; 
    1819        this.callbackOnClick = param.onClick ? param.onClick : false; 
    19         this.contextToSave = param.contextToSave ? param.contextToSave : false; 
    2020 
    2121        // Create tab elements 
    2222        this.divContainer = $( document.createElement( "div" ) ); 
    2323        this.divContainer.addClass( this.className ); 
    24         if( this.title ) 
    25             this.divContainer.attr( {id:this.id, title:this.title, name:this.numTab} ); 
    26         else 
    27             this.divContainer.attr( {id:this.id, name:this.numTab} ); 
    2824 
    29         this.divContainer.html( this.value ); 
     25        this.radio = $( document.createElement( "input" ) ); 
     26        this.radio.attr( {type: "radio", id:this.id, name:this.name, value:this.value, checked: this.checked} ); 
     27        this.divContainer.append( this.radio ); 
     28 
     29        var label = $( document.createElement( "label" ) ); 
     30        label.attr( {for:this.id} ); 
     31        label.html( this.text ); 
     32        this.divContainer.append( label ); 
    3033 
    3134        if( this.parent ) 
     
    3336 
    3437        // Define button events 
    35         if( this.contextToSave ) 
    36             this.divContainer.bind( 'click', [this, this.contextToSave], this.onClickEvent ); 
    37         else 
    38             this.divContainer.bind( 'click', this, this.onClickEvent ); 
    39  
    40  
     38        this.divContainer.bind( 'click', this, this.onClickEvent ); 
    4139    }, 
    4240 
     
    4745    }, 
    4846 
    49     setValue : function( value ) 
     47    // Actions ******************************************************** 
     48    check : function() 
    5049    { 
    51         this.value = value; 
    52         this.divText.html( this.value ); 
     50        this.radio.attr( {checked: true} ); 
     51        this.divContainer.click(); 
    5352    }, 
    5453 
    55     setCallbackOnClick : function( value ) 
     54    unckeck : function() 
    5655    { 
    57         this.callbackOnClick = value; 
    58     }, 
    59  
    60     // Actions ******************************************************** 
    61     active : function() 
    62     { 
    63         this.divContainer.addClass( "activated" ); 
    64     }, 
    65  
    66     inactive : function() 
    67     { 
    68         this.divContainer.removeClass( "activated" ); 
    69     }, 
    70  
    71     remove : function() 
    72     { 
    73         this.divContainer.remove(); 
    74  
     56        this.radio.attr( {checked: false} ); 
    7557    }, 
    7658 
     
    8062        var clickedTab = event.data; 
    8163 
    82         //tabs 
    83         $( "." + this.className ).removeClass( "activated" ); 
    84         clickedTab.divContainer.addClass( "activated" ); 
    85  
    8664        if( (undefined == event.detail || 1 == event.detail) && clickedTab.callbackOnClick ) 
    8765            clickedTab.callbackOnClick( event ); 
  • ether_iasi/trunk/web/src/com/ether/Controller.java

    r731 r732  
    7474        String plotNameA = ""; 
    7575        String plotNameB = ""; 
    76         if (satellite.equals( "metopa" ) || satellite.equals( "metopab" )) 
     76        if( satellite.equals( "metopa" ) || satellite.equals( "metopab" ) ) 
    7777            plotNameA = "iasi_" + species + "_" + projection + "_" + fmtDate + "_" + satellite + ".png"; 
    78         if (satellite.equals( "metopb" ) || satellite.equals( "metopab" )) 
     78        if( satellite.equals( "metopb" ) || satellite.equals( "metopab" ) ) 
    7979            plotNameB = "iasi_" + species + "_" + projection + "_" + fmtDate + "_" + satellite + ".png"; 
    8080 
     
    8484        return result; 
    8585 
     86    } 
     87 
     88    /** 
     89     * This method returns the data by product level and temporal and spatial values 
     90     * 
     91     * @param productLevel 
     92     * @param dateBegin 
     93     * @param dateEnd 
     94     * @return 
     95     * @throws WebException 
     96     */ 
     97    @ControllerMethod(jsonResult = true) 
     98    public JSONObject getDataByValues( @Mandatory @ParamName("productLevel") final String productLevel, 
     99                                       @Mandatory @ParamName("dateBegin") final String dateBegin, 
     100                                       @Mandatory @ParamName("dateEnd") final String dateEnd ) 
     101            throws WebException 
     102    { 
     103        final Calendar calendar = Calendar.getInstance(); 
     104        calendar.setTimeInMillis( Long.valueOf( dateBegin ) ); 
     105        final String formatedDateBegin = DateHelper.formatDate( calendar.getTime(), DateHelper.FRENCH_DATE_PATTERN ); 
     106        calendar.setTimeInMillis( Long.valueOf( dateEnd ) ); 
     107        final String formatedDateEnd = DateHelper.formatDate( calendar.getTime(), DateHelper.FRENCH_DATE_PATTERN ); 
     108 
     109        final JSONObject result = new JSONObject(); 
     110        result.put( "resultTest", productLevel + "_" + formatedDateBegin + "_" + formatedDateEnd ); 
     111        return result; 
    86112    } 
    87113 
Note: See TracChangeset for help on using the changeset viewer.