Changeset 244 for ether_megapoli/trunk


Ignore:
Timestamp:
11/09/11 16:34:14 (13 years ago)
Author:
vmipsl
Message:

Sous-menus paramètres

Location:
ether_megapoli/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/service/implementation/com/ether/EtherServiceImpl.java

    r220 r244  
    7373    } 
    7474 
    75     @Nullable 
     75    @NotNull 
    7676    @Transactional(readOnly = true) 
    7777    public List<Parametre> getParametersByPlateformId( @NotNull final Integer plateformId ) 
  • ether_megapoli/trunk/service/interface/com/ether/EtherService.java

    r220 r244  
    2828            throws ServiceException; 
    2929 
    30     @Nullable 
     30    @NotNull 
    3131    List<Parametre> getParametersByPlateformId( @NotNull final Integer plateformId ) 
    3232            throws ServiceException; 
  • ether_megapoli/trunk/web/src/com/ether/Controller.java

    r234 r244  
    9090            throws ServiceException, EtherException 
    9191    { 
    92         final List<Parametre> parametersByPlateform = _etherService.getParametersByPlateformId( plateformId ); 
     92        final List<Parametre> fullParametersByPlateform = _etherService.getParametersByPlateformId( plateformId ); 
     93        final List<List<Parametre>> parametersByPlateform = manageMenusForParameterList( fullParametersByPlateform ); 
    9394 
    9495        final JSONObject result = new JSONObject(); 
    9596        result.put( ParameterConstants.PARAMETER_PARAMETERS, getJsonHelper().toJSON( parametersByPlateform ) ); 
    9697        return result; 
     98    } 
     99 
     100    /** 
     101     * This method manage the sub-menus for the list of parameters (to avoid multiple "Particle Concentration" by example) 
     102     * The fullParameters must be ordered with parameterName ascendant 
     103     * 
     104     * @param fullParameters 
     105     * @return 
     106     */ 
     107    @NotNull 
     108    private List<List<Parametre>> manageMenusForParameterList( @NotNull final List<Parametre> fullParameters ) 
     109    { 
     110        final List<List<Parametre>> parameterListWithMenu = new ArrayList<List<Parametre>>(); 
     111 
     112        int i = 0; 
     113        while( i < fullParameters.size() ) 
     114        { 
     115            final Parametre fullParameter = fullParameters.get( i ); 
     116            final int firstIndex = fullParameters.indexOf( fullParameter ); 
     117            final int lastIndex = fullParameters.lastIndexOf( fullParameter ); 
     118            final List<Parametre> parameters = fullParameters.subList( firstIndex, lastIndex + 1 ); 
     119            parameterListWithMenu.add( parameters ); 
     120            i += parameters.size(); 
     121        } 
     122 
     123        return parameterListWithMenu; 
    97124    } 
    98125 
Note: See TracChangeset for help on using the changeset viewer.