Ignore:
Timestamp:
07/03/12 17:02:35 (12 years ago)
Author:
vmipsl
Message:

Simulations
Process ncdump
Sérialisation jaxb

Location:
ether_megapoli/trunk/web
Files:
9 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/web/WEB-INF/megapoli.properties

    r528 r530  
    4040 
    4141# ParamÚtres pour la simulation 
    42 directory.simulation=/home_local/Simulations 
     42directory.simulation=/home_local/PROJETS/MEGAPOLI/Simulations 
  • ether_megapoli/trunk/web/backoffice/simulation-script.jsp

    r528 r530  
    33var interfaceBODataInsertion = Class.create( { 
    44 
    5     initialize: function( pathSimulationFiles ) 
     5    initialize: function( simulationFiles, simulationDirectories ) 
    66    { 
    77        // Values 
    8         this.files = pathSimulationFiles || null; 
     8        this.files = simulationFiles || null; 
     9        this.directories = simulationDirectories || null; 
    910 
    1011        // Containers 
     
    4142 
    4243        // Bind buttons 
    43 //        $( "#insert" ).bind( 'click', this, jQuery.proxy( this.onClickInsert, this ) ); 
     44        $( "#ncdumpButton" ).bind( 'click', this, jQuery.proxy( this.onClickLaunchNcDump, this ) ); 
    4445//        $( "#cleanLocalisationAndFlagButton" ).bind( 'click', this, jQuery.proxy( this.onClickCleanLocalisationAndFlag, this ) ); 
    4546    }, 
     
    5859    }, 
    5960 
     61    requestLaunchNcDump: function() 
     62    { 
     63        $.ajax( { 
     64            url: "backoffice?methodName=launchNCDumpInSimulationDirectory", 
     65            success:jQuery.proxy( this.handleLaunchNcDump, this ), 
     66            error: jQuery.proxy( this.showErrors, [this] ) 
     67        } ); 
     68    }, 
     69 
     70    requestInsertHeader: function( directoryName ) 
     71    { 
     72        $.ajax( { 
     73            url: "backoffice?methodName=insertHeader&directoryName=" + directoryName, 
     74            success:jQuery.proxy( this.handleInsertHeader, this ), 
     75            error: jQuery.proxy( this.showErrors, [this] ) 
     76        } ); 
     77    }, 
    6078 
    6179    // HANDLES ******************************************************** 
     
    6785    }, 
    6886 
     87    handleLaunchNcDump: function( result ) 
     88    { 
     89        this.files = jQuery.parseJSON( result ).simulationFiles; 
     90        this.directories = jQuery.parseJSON( result ).simulationDirectories; 
     91        this.displayFiles(); 
     92    }, 
     93 
     94    handleInsertHeader: function( result ) 
     95    { 
     96//        this.files = jQuery.parseJSON( result ).simulationFiles; 
     97//        this.directories = jQuery.parseJSON( result ).simulationDirectories; 
     98//        this.displayFiles(); 
     99    }, 
     100 
    69101    // DISPLAYS ******************************************************** 
    70102    displayFiles: function() 
    71103    { 
     104        this.containerFileList_left.empty(); 
     105        this.containerFileList_right.empty(); 
    72106        var number = this.files.length; 
     107        jQuery.each( this.directories, jQuery.proxy( function( i, directory ) 
     108        { 
     109            var divDirectory = $( document.createElement( "div" ) ); 
     110            var divDirectoryName = $( document.createElement( "div" ) ); 
     111            divDirectoryName.attr( {style:"float:left"} ); 
     112            divDirectoryName.html( "- " + directory + "  " ); 
     113            divDirectory.append( divDirectoryName ); 
     114 
     115            var button = $( document.createElement( "button" ) ); 
     116            button.addClass( "small negative" ); 
     117            button.html( interfaceTexts["bo.simulation.save.header"] ); 
     118            button.bind( 'click', [this, directory], jQuery.proxy( this.onClickInsertHeader, this ) ); 
     119            divDirectory.append( button ); 
     120 
     121            this.containerFileList_left.append( divDirectory ); 
     122        }, this ) ); 
     123 
    73124        jQuery.each( this.files, jQuery.proxy( function( i, file ) 
    74125        { 
    75             if( (number / 2) > i ) 
    76                 this.containerFileList_left.append( "&nbsp;&nbsp;-&nbsp;" + file + "<BR/>" ); 
    77             else 
    78                 this.containerFileList_right.append( "&nbsp;&nbsp;-&nbsp;" + file + "<BR/>" ); 
     126            this.containerFileList_right.append( "&nbsp;&nbsp;-&nbsp;" + file + "<BR/>" ); 
    79127        }, this ) ); 
    80  
    81128    }, 
    82129 
     
    193240    }, 
    194241 
    195     onClickRemove: function( dataset ) 
    196     { 
    197         this.dataset = dataset; 
    198  
    199         this.containerErrors.hide(); 
    200         this.hideRemove(); 
    201         this.hideMove(); 
    202         this.hideInsert(); 
    203  
    204         this.displayFilesMove(); 
    205  
    206         $( "#categoryNameInsert" ).val( this.dataset.categoryName ); 
    207         $( "#datasetNameInsert" ).val( this.dataset.name ); 
    208  
    209         if( window.confirm( interfaceTexts["bo.dataset.remove.confirm"] + " " + dataset.name + " ?" ) ) 
    210             this.requestRemoveDataset(); 
    211     }, 
    212  
    213     onClickMove: function() 
    214     { 
    215         this.containerErrors.hide(); 
    216         this.containerResultRemove.addClass( "disable" ); 
    217         this.hideMove(); 
    218         this.hideInsert(); 
    219         this.requestFilesMove(); 
    220     }, 
    221  
    222     onClickInsert: function() 
    223     { 
    224         this.containerErrors.hide(); 
    225         this.containerResultMove.addClass( "disable" ); 
    226         this.hideInsert(); 
    227  
    228         if( "" != $( "#categoryNameInsert" ).val() && "" != $( "#datasetNameInsert" ).val() && "" != $( "#versionInsert" ).val() ) 
    229             this.requestDatasetInsert(); 
    230         else 
    231             this.showErrors( interfaceTexts["bo.dataset.fields"] ); 
    232     }, 
    233  
    234     onClickCleanLocalisationAndFlag: function() 
    235     { 
    236         if( window.confirm( interfaceTexts["bo.cleanTables.confirm"] ) ) 
    237             this.requestCleanLocalisationAndFlag(); 
     242    onClickLaunchNcDump: function() 
     243    { 
     244        this.requestLaunchNcDump(); 
     245    }, 
     246 
     247    onClickInsertHeader: function( parameters ) 
     248    { 
     249        var context = parameters.data[0]; 
     250        var directoryName = parameters.data[1]; 
     251        this.requestInsertHeader( directoryName ); 
    238252    }, 
    239253 
  • ether_megapoli/trunk/web/backoffice/simulation.jsp

    r528 r530  
    3535            <div id="fileList_left" style="float:left"></div> 
    3636            <div id="fileList_right" style="float:right"></div> 
     37 
     38            <div class="containerButtons"> 
     39                <button id="ncdumpButton" class="small positive" style="float:right"><bean:message key="bo.simulation.launchNcDump"/></button> 
     40            </div> 
    3741        </div> 
    3842 
     
    106110        <script type="text/javascript"> 
    107111            var interfaceTexts = $A( "" ); 
     112            interfaceTexts["bo.simulation.save.header"] = '<bean:message key="bo.simulation.save.header"/>'; 
    108113 
    109             new interfaceBODataInsertion( ${pathSimulationFiles} ); 
     114            new interfaceBODataInsertion( ${simulationFiles}, ${simulationDirectories} ); 
    110115        </script> 
    111116 
  • ether_megapoli/trunk/web/resources/css/backoffice.css

    r520 r530  
    8686    margin-right: 11px; 
    8787} 
     88 
     89#fileList_left, #fileList_right { 
     90    margin: 0 40px; 
     91} 
  • ether_megapoli/trunk/web/resources/css/megapoli.css

    r528 r530  
    244244    width: 950px; 
    245245    margin-bottom: 10px; 
     246} 
     247 
     248.containerButtons { 
     249    float: right; 
     250    width: 800px; 
     251    margin-top: 12px; 
    246252} 
    247253 
  • ether_megapoli/trunk/web/src/ApplicationResources_en.properties

    r528 r530  
    658658bo.simulation.database=Simulations in database 
    659659bo.simulation.list=List of simulations 
     660bo.simulation.launchNcDump=Launch ncdump 
     661bo.simulation.save.header=Save header in database 
  • ether_megapoli/trunk/web/src/com/ether/ControllerBackoffice.java

    r528 r530  
    8686        final JSONObject jsonObject = new JSONObject(); 
    8787        final String pathSimulation = getProperty( "directory.simulation" ); 
    88         final File directory = new File( pathSimulation ); 
     88 
     89        final List<String> files = EtherHelper.getOnlyFileNames( pathSimulation, ".nc" ); 
     90        final List<String> directories = EtherHelper.getOnlyDirectorieNames( pathSimulation ); 
    8991        jsonObject.put( "pathSimulation", pathSimulation ); 
    90         jsonObject.put( "pathSimulationFiles", directory.list() ); 
     92        jsonObject.put( "simulationFiles", files ); 
     93        jsonObject.put( "simulationDirectories", directories ); 
    9194        return jsonObject; 
    9295    } 
     
    9497    /** *********************************************************** **/ 
    9598    /** *********************** CALLS ***************************** **/ 
     99    /** *********************************************************** **/ 
     100 
     101    /** *********************************************************** **/ 
     102    /** *********************** USERS ***************************** **/ 
    96103    /** *********************************************************** **/ 
    97104    /** 
     
    293300    } 
    294301 
     302    /** *********************************************************** **/ 
     303    /** *********************** MCO ******************************* **/ 
     304    /** *********************************************************** **/ 
    295305    /** 
    296306     * This method sorts the MCO's requests 
     
    441451 
    442452 
     453    /** *********************************************************** **/ 
     454    /** *********************** DATASETS ************************** **/ 
     455    /** *********************************************************** **/ 
    443456    /** 
    444457     * This method sorts the datasets 
     
    568581//    } 
    569582 
     583    /** *********************************************************** **/ 
     584    /** *********************** SIMULATIONS *********************** **/ 
     585    /** *********************************************************** **/ 
     586    /** 
     587     * @return 
     588     * @throws WebException 
     589     */ 
     590    @ControllerMethod(jsonResult = true) 
     591    public JSONObject launchNCDumpInSimulationDirectory() 
     592            throws WebException 
     593    { 
     594        final JSONObject jsonObject = new JSONObject(); 
     595        try 
     596        { 
     597            final String pathSimulation = getProperty( "directory.simulation" ); 
     598            getEtherService().launchNCDumpInSimulationDirectory( pathSimulation ); 
     599 
     600            final List<String> files = EtherHelper.getOnlyFileNames( pathSimulation, ".nc" ); 
     601            final List<String> directories = EtherHelper.getOnlyDirectorieNames( pathSimulation ); 
     602            jsonObject.put( "simulationFiles", files ); 
     603            jsonObject.put( "simulationDirectories", directories ); 
     604        } 
     605        catch( ServiceException e ) 
     606        { 
     607            throw new WebException( WebException.WebCode.ERROR_PROCESS_SIMULATION_NCDUMP, e ); 
     608        } 
     609        return jsonObject; 
     610    } 
     611 
     612    @ControllerMethod(jsonResult = true) 
     613    public JSONObject insertHeader( @NotNull @ParamName(ParameterConstants.PARAMETER_DIRECTORY_NAME) final String directoryName ) 
     614            throws WebException 
     615    { 
     616        final JSONObject jsonObject = new JSONObject(); 
     617        try 
     618        { 
     619            final String pathSimulation = getProperty( "directory.simulation" ); 
     620            getEtherService().insertHeader( pathSimulation, directoryName ); 
     621        } 
     622        catch( ServiceException e ) 
     623        { 
     624            throw new WebException( WebException.WebCode.ERROR_INSERT_HEADER, e ); 
     625        } 
     626        return jsonObject; 
     627    } 
     628 
     629    /** *********************************************************** **/ 
     630    /** ************************ PRIVATES ************************* **/ 
     631    /** *********************************************************** **/ 
    570632    /** 
    571633     * This method create and send an email to the user to inform of the administrator decision 
  • ether_megapoli/trunk/web/src/com/ether/WebException.java

    r520 r530  
    5959        DOWNLOAD_DIRECTORY_DOESNOT_EXISTS, 
    6060        ERROR_NO_CLEAN_LOCALISATION_AND_FLAG, 
    61         ERROR_TO_READ_FILE_PROPERTIES 
     61        ERROR_TO_READ_FILE_PROPERTIES, 
     62        ERROR_PROCESS_SIMULATION_NCDUMP, 
     63        ERROR_INSERT_HEADER 
    6264    } 
    6365 
  • ether_megapoli/trunk/web/visualization/visu_simulation.jsp

    r528 r530  
    1010 
    1111    <tiles:put name="insertCss" type="string"> 
    12         <ether:htmlCss cssFile="blueprint-css/blueprint/src/grid"/> 
    13         <ether:htmlCss cssFile="visu_parameter_by_pf"/> 
    1412        <ether:htmlCss cssFile="select"/> 
    1513        <ether:htmlCss cssFile="calendar/anytime"/> 
     
    2018        <ether:htmlJs jsFile="classesForJQuery/etherClasses"/> 
    2119        <ether:htmlJs jsFile="classesForJQuery/megapoliClasses"/> 
    22         <ether:htmlJsp jspFile="visu_parameter_by_pf-script"/> 
    23         <ether:htmlJs jsFile="classesForJQuery/Select"/> 
     20        <ether:htmlJsp jspFile="visu_simulation-script"/> 
    2421        <ether:htmlJs jsFile="classesForJQuery/Loading"/> 
    2522        <ether:htmlJs jsFile="calendar/anytime"/> 
Note: See TracChangeset for help on using the changeset viewer.