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/src/com/ether/Controller.java

    r129 r130  
    1515import javax.servlet.http.HttpServletRequest; 
    1616import javax.servlet.http.HttpServletResponse; 
     17import java.util.ArrayList; 
    1718import java.util.HashMap; 
    1819import java.util.List; 
     
    2829    /** *********************************************************** **/ 
    2930    /** *********************** VIEWS ***************************** **/ 
    30     /** *********************************************************** **/ 
     31    /** 
     32     * ********************************************************** * 
     33     */ 
    3134    // Default view if methodName is unknown 
    3235    public ModelAndView home( final HttpServletRequest request, final HttpServletResponse response ) 
    33             throws WebException 
     36            throws EtherException 
    3437    { 
    3538        return new ModelAndView( "index" ); 
     
    4851    { 
    4952        final List<Plateforme> plateforms = _etherService.getAllPlateforms(); 
     53//        final List<Plateforme> plateforms = new ArrayList<Plateforme>(); 
     54//        final Plateforme pf = new Plateforme(); 
     55//        pf.setPlateformeId( 1 ); 
     56//        pf.setPlateformeNom( "LHVP" ); 
     57//        plateforms.add( pf ); 
     58//        final Plateforme pf2 = new Plateforme(); 
     59//        pf2.setPlateformeId( 2 ); 
     60//        pf2.setPlateformeNom( "SIRTA" ); 
     61//        plateforms.add( pf2 ); 
    5062 
    5163        final Map<String, Object> model = new HashMap<String, Object>(); 
    5264        model.put( "plateforms", getJsonHelper().toJSON( plateforms ) ); 
     65        model.put( "axeTypes", getJSONAxeTypes() ); 
    5366        return model; 
    5467    } 
     
    5669    /** *********************************************************** **/ 
    5770    /** *********************** CALLS ***************************** **/ 
    58     /** ********************************************************** **/ 
     71    /** 
     72     * ********************************************************* * 
     73     */ 
    5974    @ControllerMethod(jsonResult = true) 
    6075    public JSONObject searchParametersByPlateform( @Mandatory @ParamName(ParameterConstants.PARAMETER_ID) final Integer plateformId ) 
    61             throws ServiceException, WebException 
     76            throws ServiceException, EtherException 
    6277    { 
    6378        final List<Parametre> parametersByPlateform = _etherService.getParametersByPlateformId( plateformId ); 
     79//        final List<Parametre> parametersByPlateform = new ArrayList<Parametre>( 2 ); 
     80//        final Parametre p1 = new Parametre(); 
     81//        p1.setParametreId( 1 ); 
     82//        p1.setParametreNom( "JNO2" ); 
     83//        parametersByPlateform.add( p1 ); 
     84//        final Parametre p2 = new Parametre(); 
     85//        p2.setParametreId( 2 ); 
     86//        p2.setParametreNom( "CO2" ); 
     87//        parametersByPlateform.add( p2 ); 
    6488 
    6589        final JSONObject result = new JSONObject(); 
    6690        result.put( ParameterConstants.PARAMETER_PARAMETERS, getJsonHelper().toJSON( parametersByPlateform ) ); 
    6791        return result; 
     92    } 
     93 
     94    @ControllerMethod(jsonResult = true) 
     95    private List<JSONObject> getJSONAxeTypes() 
     96    { 
     97        final AxeType[] axeTypes = AxeType.values(); 
     98 
     99        final List<JSONObject> jsonAxeTypes = new ArrayList<JSONObject>( axeTypes.length ); 
     100 
     101        for( final AxeType axeType : axeTypes ) 
     102        { 
     103            final JSONObject jsonAxeType = new JSONObject(); 
     104            jsonAxeType.put( "text", axeType.name() ); 
     105            jsonAxeType.put( "value", axeType.name() ); 
     106            jsonAxeTypes.add( jsonAxeType ); 
     107        } 
     108        return jsonAxeTypes; 
    68109    } 
    69110 
Note: See TracChangeset for help on using the changeset viewer.