Changeset 442


Ignore:
Timestamp:
03/26/12 17:49:46 (12 years ago)
Author:
vmipsl
Message:

Spectral units

Location:
tapas
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • tapas/domain/interface/com/ether/SpectralUnit.java

    r440 r442  
    11package com.ether; 
    2  
    3 import java.lang.reflect.Field; 
    42 
    53/** 
     
    97public enum SpectralUnit 
    108{ 
    11     NM, 
     9    NM_VACUUM, 
     10    NM_STANDARD, 
    1211    CM 
    1312 
  • tapas/web/project/formTapas.jsp

    r440 r442  
    11<%@ page import="com.ether.WebException" %> 
     2<%@ page import="com.ether.SpectralUnit" %> 
    23<%@ page contentType="text/html;charset=UTF-8" language="java" %> 
    34<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 
     
    2930    <tiles:put name="body" type="string"> 
    3031 
    31         <div id="formulaire"> 
    32  
    33         </div> 
     32        <div id="formulaire"></div> 
    3433 
    3534        <div id="errors"></div> 
     
    3938            tapasTexts["label.submitButton"] = '<spring:message code="label.submitButton"/>'; 
    4039            tapasTexts["<%=WebException.WebCode.ERROR_JSON_TAPAS_IS_NULL%>"] = "<spring:message code="error.ERROR_JSON_TAPAS_IS_NULL"/>"; 
     40            tapasTexts["<%=SpectralUnit.NM_STANDARD%>"] = "<spring:message code="label.spectralUnit.NM_STANDARD"/>"; 
     41            tapasTexts["<%=SpectralUnit.NM_VACUUM%>"] = "<spring:message code="label.spectralUnit.NM_VACUUM"/>"; 
     42            tapasTexts["<%=SpectralUnit.CM%>"] = "<spring:message code="label.spectralUnit.CM"/>"; 
    4143 
    42             //var interfaceTapas = new InterfaceTapas(${jSonFileFormats},${jSonYesNos},${jSonObservatories},${jSonSelectUnits}); 
    43             var interfaceTapas = new InterfaceTapas(${jSonFileFormats},${jSonYesNos},${jSonObservatories}); 
     44            var interfaceTapas = new InterfaceTapas(${jSonFileFormats},${jSonYesNos},${jSonObservatories}, ${jSonSpectralUnits}); 
    4445        </script> 
    4546 
  • tapas/web/project/formTapas_script.jsp

    r441 r442  
    22var InterfaceTapas = Class.create( { 
    33 
    4     initialize: function( jsonFileFormats, jsonYesNos, jsonObservatories ) 
     4    initialize: function( jsonFileFormats, jsonYesNos, jsonObservatories, jSonSpectralUnits ) 
    55    { 
    66        /** *********** CONTAINERS *********** **/ 
     
    1111        this.jsonYesNos = jsonYesNos || null; 
    1212        this.jSonObservatories = jsonObservatories || null; 
    13         //this.jSonSelectUnits = jsonSelectUnits || null; 
     13        this.jSonSpectralUnits = jSonSpectralUnits || null; 
    1414 
    1515        this.containerErrors.hide(); 
     
    103103        this.createTr( "LOS declension", "ide", tabObservation ); 
    104104        this.createTr( "Zenith angle", "iza", tabObservation ); 
    105         // this.createTrList("Spectral unit", "ispectral_choice", tabObservation, 'spectralUnit'); 
     105        this.createTrList( "Spectral unit", "ispectral_choice", tabObservation, 'spectralUnit' ); 
    106106        this.createTr( "Spectral range", "ispectral_ranger", tabObservation ); 
    107107 
     
    207207        //ajouter select vide avec add 
    208208        this.selectSpectralUnits.add( "-1", "-- Select unit --" ); 
    209         jQuery.each( this.jSonSpectralUnit, jQuery.proxy( function ( i, jsonSpectralUnit ) 
     209        jQuery.each( this.jSonSpectralUnits, jQuery.proxy( function ( i, jsonSpectralUnit ) 
    210210        { 
    211             this.selectSpectralUnits.add( jsonSpectralUnit.id, jsonSpectralUnit.name ); 
     211            this.selectSpectralUnits.add( jsonSpectralUnit.value, tapasTexts[jsonSpectralUnit.value] ); 
    212212        }, this ) ); 
    213213        this.selectSpectralUnits.selectFirst( true ); 
     
    238238 
    239239        preference.rayleighExtinction = new Object(); 
    240         ; 
     240 
    241241        preference.h2oExtinction = pair; 
    242242        preference.o3Extinction = pair; 
  • tapas/web/src/com/ether/Controller.java

    r440 r442  
    88import com.ether.tapas.Tapas; 
    99import com.ether.user.User; 
    10 import com.ether.user.UserRole; 
    1110import net.sf.json.JSONObject; 
    1211import org.apache.commons.logging.Log; 
     
    1514 
    1615import java.util.ArrayList; 
    17 import java.util.HashMap; 
    1816import java.util.List; 
    19 import java.util.Map; 
    2017 
    2118/** 
     
    3027    /** *********************** VIEWS ***************************** **/ 
    3128    /** *********************************************************** **/ 
     29    /** 
     30     * View for the form 
     31     * 
     32     * @return 
     33     * @throws WebException 
     34     */ 
    3235    //@ControllerMethod(view = VIEW_FORM_TAPAS, loginMandatory = true, defaultView = VIEW_INDEX) 
    3336    @ControllerMethod(view = VIEW_FORM_TAPAS, loginMandatory = false, defaultView = VIEW_INDEX) 
     
    4346            jsonObject.put( "jSonYesNos", getJSONYesNo() ); 
    4447            jsonObject.put( "jSonObservatories", allObservatories ); 
     48            jsonObject.put( "jSonSpectralUnits", getJSONSpectralUnit() ); 
    4549            return jsonObject; 
    4650        } 
     
    5357 
    5458 
    55  
    56  
    57  
    5859    /** *********************************************************** **/ 
    5960    /** *********************** CALLS ***************************** **/ 
    6061    /** *********************************************************** **/ 
     62    /** 
     63     * This method create a XML file filled with the javaTapas fields 
     64     * 
     65     * @param javaTapas 
     66     * @param user 
     67     * @return 
     68     * @throws WebException 
     69     */ 
    6170    @ControllerMethod(jsonResult = true, userMandatory = true) 
    6271    public JSONObject createUserRequest( @ParamName("jsonTapas") @Mandatory @UseJSON final Tapas javaTapas, @NotNull final User user ) // TODO rajouter parametre USER 
     
    8998        { 
    9099            final JSONObject jsonFileFormat = new JSONObject(); 
    91             jsonFileFormat .put( "text", fileFormat.name() ); 
    92             jsonFileFormat .put( "value", fileFormat.name() ); 
    93             jsonFileFormats.add( jsonFileFormat  ); 
     100            jsonFileFormat.put( "text", fileFormat.name() ); 
     101            jsonFileFormat.put( "value", fileFormat.name() ); 
     102            jsonFileFormats.add( jsonFileFormat ); 
    94103        } 
    95104        return jsonFileFormats; 
     
    105114        { 
    106115            final JSONObject jsonYesNo = new JSONObject(); 
    107             jsonYesNo .put( "text", yesNo.name() ); 
    108             jsonYesNo .put( "value", yesNo.name() ); 
     116            jsonYesNo.put( "text", yesNo.name() ); 
     117            jsonYesNo.put( "value", yesNo.name() ); 
    109118            jsonYesNos.add( jsonYesNo ); 
    110119        } 
    111120        return jsonYesNos; 
     121    } 
     122 
     123    private List<JSONObject> getJSONSpectralUnit() 
     124    { 
     125        final SpectralUnit[] spectralUnits = SpectralUnit.values(); 
     126 
     127        final List<JSONObject> jsonSpectralUnits = new ArrayList<JSONObject>( spectralUnits.length ); 
     128 
     129        for( final SpectralUnit spectralUnit : spectralUnits ) 
     130        { 
     131            final JSONObject jsonSpectralUnit = new JSONObject(); 
     132            jsonSpectralUnit.put( "text", spectralUnit.name() ); 
     133            jsonSpectralUnit.put( "value", spectralUnit.name() ); 
     134            jsonSpectralUnits.add( jsonSpectralUnit ); 
     135        } 
     136        return jsonSpectralUnits; 
    112137    } 
    113138 
  • tapas/web/src/messages_en.properties

    r416 r442  
    2424 
    2525label.submitButton=RUN 
     26 
     27label.spectralUnit.NM_STANDARD=Standard Wavelength (nm) 
     28label.spectralUnit.NM_VACUUM=Vacuum Wavelength (nm) 
     29label.spectralUnit.CM=Wavenumber (cm-1) 
    2630 
    2731################################################################ 
     
    108112 
    109113bo.user.emailNotSend=The email to the user cannot be sent, the email seems not valid : 
     114 
  • tapas/web/src/messages_fr.properties

    r416 r442  
    2424 
    2525label.submitButton=COURIR 
     26 
     27label.spectralUnit.NM_STANDARD=Standard Wavelength (nm) 
     28label.spectralUnit.NM_VACUUM=Vacuum Wavelength (nm) 
     29label.spectralUnit.CM=Wavenumber (cm-1) 
    2630 
    2731################################################################ 
Note: See TracChangeset for help on using the changeset viewer.