Changeset 185 for ether_megapoli


Ignore:
Timestamp:
09/07/11 22:42:44 (13 years ago)
Author:
vmipsl
Message:

Servlet _ TimeSerie? :

  • 1 paramètre ok
  • même paramètre sur différentes plateformes ok
Location:
ether_megapoli/trunk
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/applets/src/com/ether/AppletPlot.java

    r184 r185  
    8484//        add( jPaneTop, BorderLayout.NORTH ); 
    8585 
    86         final Integer valuesNumber = megapoliPlot.getValuesNumber(); 
     86//        final Integer valuesNumber = megapoliPlot.getValuesNumber(); 
     87        final Integer valuesNumber = 10; 
    8788 
    8889        // Bottom Pane 
     
    378379            megapoliPlot.setTimeSerie( true ); 
    379380            megapoliPlot.setLegendToHide( true ); 
    380             megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 
     381//            megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 
    381382        } 
    382383        else 
     
    399400            megapoliPlot.setTimeSerie( false ); 
    400401            megapoliPlot.setLegendToHide( false ); 
    401             megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 
     402//            megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 
    402403        } 
    403404        return megapoliPlot; 
  • ether_megapoli/trunk/applets/src/com/ether/AppletTimeSerie.java

    r184 r185  
    7171        add( jPaneTop, BorderLayout.NORTH ); 
    7272 
    73         final Integer valuesNumber = megapoliPlot.getValuesNumber(); 
     73//        final Integer valuesNumber = megapoliPlot.getValuesNumber(); 
     74        final Integer valuesNumber = 10; 
    7475 
    7576        // Bottom Pane 
     
    158159            megapoliPlot.setTimeSerie( true ); 
    159160            megapoliPlot.setLegendToHide( true ); 
    160             megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 
     161//            megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 
    161162        } 
    162163        else 
     
    179180            megapoliPlot.setTimeSerie( false ); 
    180181            megapoliPlot.setLegendToHide( false ); 
    181             megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 
     182//            megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 
    182183        } 
    183184        return megapoliPlot; 
  • ether_megapoli/trunk/persistence/implementation/com/ether/dao/ValueDAOImpl.java

    r171 r185  
    4646        criteria.addOrder( Order.asc( "measure.mesureDate" ) ); 
    4747 
    48 //        final List<Object[]> objects = selectAllByCriteria( Object[].class, criteria ); 
     48        final List<Object[]> objects = selectAllByCriteria( Object[].class, criteria ); 
    4949        // TODO : remove maxResults to 10 
    50         final List<Object[]> objects = selectPage( null, 10, criteria ); 
     50//        final List<Object[]> objects = selectPage( null, 10, criteria ); 
    5151 
    5252        final double[] values = new double[objects.size()]; 
     
    106106        return new Data( parameterValues, latitudeValues, longitudeValues ); 
    107107    } 
     108 
     109    @NotNull 
     110    public Integer getNumberValuesByPlateformByParameterByPeriod( @NotNull final Integer plateformId, @NotNull final Integer parameterId, @Nullable final Date beginDate, @Nullable final Date endDate ) 
     111            throws PersistenceException 
     112    { 
     113        final DetachedCriteria criteria = DetachedCriteria.forClass( Valeur.class, "value" ) 
     114                .add( Restrictions.eq( "value.parametre.id", parameterId ) ) 
     115                .createCriteria( "mesure", "measure" ) 
     116                .add( Restrictions.eq( "measure.plateforme.id", plateformId ) ); 
     117 
     118        if( null != beginDate ) 
     119            criteria.add( Restrictions.ge( "measure.mesureDate", beginDate ) ); 
     120        if( null != endDate ) 
     121            criteria.add( Restrictions.le( "measure.mesureDate", endDate ) ); 
     122 
     123        criteria.setProjection( Projections.property( "value.valeurVal" ) ); 
     124 
     125        return count( criteria ); 
     126    } 
     127 
     128//    @NotNull 
     129//    public Integer getNumberValuesByPlateformByParameterByPeriod( @NotNull final List<Pair> pairs, @Nullable final Date beginDate, @Nullable final Date endDate ) 
     130//            throws PersistenceException 
     131//    { 
     132//        final DetachedCriteria criteria = DetachedCriteria.forClass( Valeur.class, "value" ) 
     133//                .add( Restrictions.eq( "value.parametre.id", parameterId ) ) 
     134//                .createCriteria( "mesure", "measure" ) 
     135//                .add( Restrictions.eq( "measure.plateforme.id", plateformId ) ); 
     136// 
     137//        if( null != beginDate ) 
     138//            criteria.add( Restrictions.ge( "measure.mesureDate", beginDate ) ); 
     139//        if( null != endDate ) 
     140//            criteria.add( Restrictions.le( "measure.mesureDate", endDate ) ); 
     141// 
     142//        criteria.setProjection( Projections.property( "value.valeurVal" ) ); 
     143// 
     144//        return count( criteria ); 
     145//    } 
     146 
    108147} 
  • ether_megapoli/trunk/persistence/implementation/hibernate-domain.cfg.xml

    r174 r185  
    77        <session-factory> 
    88 
    9         <!--<mapping resource="com/medias/objects/Adresse.hbm.xml"/>--> 
    10         <!--<mapping resource="com/medias/objects/Bilan.hbm.xml"/>--> 
    11         <!--<mapping resource="com/medias/objects/Capteur.hbm.xml"/>--> 
    12         <!--<mapping resource="com/medias/objects/Categorie.hbm.xml"/>--> 
    13         <!--<mapping resource="com/medias/objects/CategorieParam.hbm.xml"/>--> 
    14         <!--<mapping resource="com/medias/objects/Commentaire.hbm.xml"/>--> 
    15         <!--<mapping resource="com/medias/objects/DeltaMesure.hbm.xml"/>--> 
    16         <!--<mapping resource="com/medias/objects/Fabriquant.hbm.xml"/>--> 
    17         <!--<mapping resource="com/medias/objects/Fichier.hbm.xml"/>--> 
    18         <!--<mapping resource="com/medias/objects/Flag.hbm.xml"/>--> 
    19         <!--<mapping resource="com/medias/objects/Jeu.hbm.xml"/>--> 
    20         <!--<mapping resource="com/medias/objects/Langue.hbm.xml"/>--> 
    21         <!--<mapping resource="com/medias/objects/Localisation.hbm.xml"/>--> 
    22         <!--<mapping resource="com/medias/objects/Mesure.hbm.xml"/>--> 
    23         <!--<mapping resource="com/medias/objects/Organisme.hbm.xml"/>--> 
    24         <!--<mapping resource="com/medias/objects/Parametre.hbm.xml"/>--> 
    25         <!--<mapping resource="com/medias/objects/Personne.hbm.xml"/>--> 
    26         <!--<mapping resource="com/medias/objects/Plateforme.hbm.xml"/>--> 
    27         <!--<mapping resource="com/medias/objects/RequeteNbvalsJeu.hbm.xml"/>--> 
    28         <!--<mapping resource="com/medias/objects/RequetePlatLoc.hbm.xml"/>--> 
    29         <!--<mapping resource="com/medias/objects/Sequence.hbm.xml"/>--> 
    30         <!--<mapping resource="com/medias/objects/TypeCapteur.hbm.xml"/>--> 
    31         <!--<mapping resource="com/medias/objects/TypePlateforme.hbm.xml"/>--> 
    32         <!--<mapping resource="com/medias/objects/Unite.hbm.xml"/>--> 
    33         <!--<mapping resource="com/medias/objects/Valeur.hbm.xml"/>--> 
    34         <!--<mapping resource="com/medias/objects/Zone.hbm.xml"/>--> 
     9        <mapping resource="com/medias/objects/Adresse.hbm.xml"/> 
     10        <mapping resource="com/medias/objects/Bilan.hbm.xml"/> 
     11        <mapping resource="com/medias/objects/Capteur.hbm.xml"/> 
     12        <mapping resource="com/medias/objects/Categorie.hbm.xml"/> 
     13        <mapping resource="com/medias/objects/CategorieParam.hbm.xml"/> 
     14        <mapping resource="com/medias/objects/Commentaire.hbm.xml"/> 
     15        <mapping resource="com/medias/objects/DeltaMesure.hbm.xml"/> 
     16        <mapping resource="com/medias/objects/Fabriquant.hbm.xml"/> 
     17        <mapping resource="com/medias/objects/Fichier.hbm.xml"/> 
     18        <mapping resource="com/medias/objects/Flag.hbm.xml"/> 
     19        <mapping resource="com/medias/objects/Jeu.hbm.xml"/> 
     20        <mapping resource="com/medias/objects/Langue.hbm.xml"/> 
     21        <mapping resource="com/medias/objects/Localisation.hbm.xml"/> 
     22        <mapping resource="com/medias/objects/Mesure.hbm.xml"/> 
     23        <mapping resource="com/medias/objects/Organisme.hbm.xml"/> 
     24        <mapping resource="com/medias/objects/Parametre.hbm.xml"/> 
     25        <mapping resource="com/medias/objects/Personne.hbm.xml"/> 
     26        <mapping resource="com/medias/objects/Plateforme.hbm.xml"/> 
     27        <mapping resource="com/medias/objects/RequeteNbvalsJeu.hbm.xml"/> 
     28        <mapping resource="com/medias/objects/RequetePlatLoc.hbm.xml"/> 
     29        <mapping resource="com/medias/objects/Sequence.hbm.xml"/> 
     30        <mapping resource="com/medias/objects/TypeCapteur.hbm.xml"/> 
     31        <mapping resource="com/medias/objects/TypePlateforme.hbm.xml"/> 
     32        <mapping resource="com/medias/objects/Unite.hbm.xml"/> 
     33        <mapping resource="com/medias/objects/Valeur.hbm.xml"/> 
     34        <mapping resource="com/medias/objects/Zone.hbm.xml"/> 
    3535 
    3636        </session-factory> 
  • ether_megapoli/trunk/persistence/interface/com/ether/dao/ValueDAO.java

    r171 r185  
    99 
    1010import java.util.Date; 
     11import java.util.List; 
    1112 
    1213/** 
     
    2425    <T1, T2, T3> Data<T1[], T2[], T3[]> getListsByPlateformByParameterByPeriodFor2D( @NotNull final Integer plateformId, @NotNull final Integer parameterId, @Nullable final Date dateBegin, @Nullable final Date dateEnd ) 
    2526            throws PersistenceException; 
     27 
     28    @NotNull 
     29    Integer getNumberValuesByPlateformByParameterByPeriod( @NotNull final Integer plateformId, @NotNull final Integer parameterId, @Nullable final Date beginDate, @Nullable final Date endDate ) 
     30            throws PersistenceException; 
     31 
     32//    @NotNull 
     33//    Integer getNumberValuesByPlateformByParameterByPeriod( @NotNull final List<Pair> pairs, @Nullable final Date beginDate, @Nullable final Date endDate ) 
     34//            throws PersistenceException; 
    2635} 
  • ether_megapoli/trunk/service/implementation/com/ether/EtherPlotContentServiceImpl.java

    r184 r185  
    22 
    33import com.medias.database.objects.Parametre; 
    4 import com.medias.database.objects.Unite; 
     4import com.medias.database.objects.Plateforme; 
    55import gov.noaa.pmel.sgt.Axis; 
    66import gov.noaa.pmel.sgt.CartesianGraph; 
     
    4141import java.awt.*; 
    4242import java.util.ArrayList; 
    43 import java.util.Calendar; 
    4443import java.util.Date; 
    4544import java.util.List; 
    4645import java.util.Locale; 
     46import java.util.Random; 
    4747import java.util.ResourceBundle; 
    4848 
     
    6363        mainPane.setLayout( new StackedLayout() ); 
    6464 
    65         final List<Pair> pIdPIdList = megapoliPlot.getpIdPIdList(); 
    66  
    67         /** *********** LINES ************ **/ 
    68         final List<SimpleLine> lines = createLines( pIdPIdList, megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() ); 
    69         final SimpleLine firstLine = lines.get( 0 ); 
    70  
    71         /** *************** AXIS ************** **/ 
    72         final SoTRange xnRange = firstLine.getXRange(); 
    73         final SoTRange yRange = firstLine.getYRange(); 
    74         for( final SimpleLine line : lines ) 
    75             yRange.add( line.getYRange() ); 
    76  
    77         // TODO : automatiser le nb d'intervalles en fonction des valeurs de y 
    78         final Integer intervalsNumber = 10; 
    79         final SoTRange ynRange = Graph.computeRange( yRange, intervalsNumber ); 
    80  
    81         // Origin point 
    82         final SoTPoint originPoint = new SoTPoint( ynRange.getStart(), xnRange.getStart() ); 
    83         final SoTPoint endPoint = new SoTPoint( ynRange.getStart(), xnRange.getEnd() ); 
    84  
    85         // Create the time axis, set its range in user units and its origin. 
    86         final TimeAxis xbot = new TimeAxis( "X-Axis", TimeAxis.AUTO ); 
    87         xbot.setRangeU( xnRange ); 
    88         xbot.setLocationU( originPoint ); 
    89         xbot.setLabelFont( _axisFont ); 
    90 //        xbot.setMinorLabelInterval( 1 ); 
    91  
    92         // Create the vertical axis, set its range in user units and its origin. Create the axis title. 
    93         final PlainAxis yleft = new PlainAxis( "Y-Axis" ); 
    94         yleft.setRangeU( ynRange ); 
    95         yleft.setLocationU( originPoint ); 
    96         yleft.setLabelFont( _axisFont ); 
    97         final SGLabel ytitle = new SGLabel( "Y-Axis Title", firstLine.getYMetaData().getName(), new Point2D.Double( 0.0, 0.0 ) ); 
    98         ytitle.setFont( _axisFont ); 
    99         ytitle.setHeightP( _heightAxisFont ); 
    100         yleft.setTitle( ytitle ); 
    101  
    102         final PlainAxis yleft2 = new PlainAxis( "YY-Axis" ); 
    103         yleft2.setRangeU( ynRange ); 
    104         yleft2.setLocationU( endPoint ); 
    105         yleft2.setLabelFont( _axisFont ); 
    106         yleft2.setLabelPosition( Axis.POSITIVE_SIDE ); 
    107         final SGLabel ytitle2 = new SGLabel( "Y-Axis Title", "zzzz", new Point2D.Double( 0.0, 0.0 ) ); 
    108         ytitle2.setFont( _axisFont ); 
    109         ytitle2.setHeightP( _heightAxisFont ); 
    110         yleft2.setTitle( ytitle2 ); 
    111  
    112         /** ********************************** **/ 
    113         /** *********** FIRST LAYER ********** **/ 
    114         /** ********************************** **/ 
    11565        // TODO : revoir les tailles ! mettre en automatique par rapport à plotWidth et plotHeight 
    11666        /* 
     
    13181        mainPane.add( layer ); 
    13282 
     83        final Pair<List, List> listPairOfPIdPIdForTwoAxes = extractListPairForAxes( megapoliPlot.getpIdPIdList() ); 
     84        final List<Pair> pIdPIdListForFirstAxis = listPairOfPIdPIdForTwoAxes.getFirstValue(); 
     85        final List<Pair> pIdPIdListForSecondAxis = listPairOfPIdPIdForTwoAxes.getSecondValue(); 
     86 
     87 
     88        /** *********** FIRST Y-AXIS ************ **/ 
     89        final List<SimpleLine> linesForFirstAxis = createLines( pIdPIdListForFirstAxis, megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() ); 
     90        final SimpleLine firstLineForFirstAxis = linesForFirstAxis.get( 0 ); 
     91 
     92        final SoTRange xnRange = firstLineForFirstAxis.getXRange(); 
     93        final SoTRange yRangeForFirstAxis = firstLineForFirstAxis.getYRange(); 
     94        for( final SimpleLine line : linesForFirstAxis ) 
     95            yRangeForFirstAxis.add( line.getYRange() ); 
     96 
     97        // TODO : automatiser le nb d'intervalles en fonction des valeurs de y 
     98        final Integer intervalsNumber = 10; 
     99        final SoTRange ynRangeForFirstAxis = Graph.computeRange( yRangeForFirstAxis, intervalsNumber ); 
     100 
     101        // Origin point 
     102        final SoTPoint originPointForFirstAxis = new SoTPoint( ynRangeForFirstAxis.getStart(), xnRange.getStart() ); 
     103 
     104        // Create the time axis, set its range in user units and its origin. 
     105        // Time axis is the same for the two y-axis 
     106        final TimeAxis xbot = new TimeAxis( "X-Axis", TimeAxis.AUTO ); 
     107        xbot.setRangeU( xnRange ); 
     108        xbot.setLocationU( originPointForFirstAxis ); 
     109        xbot.setLabelFont( _axisFont ); 
     110//        xbot.setMinorLabelInterval( 1 ); 
     111 
     112        // Create the vertical axis, set its range in user units and its origin. Create the axis title. 
     113        final PlainAxis yleftForFirstAxis = new PlainAxis( "Y-Axis" ); 
     114        yleftForFirstAxis.setRangeU( ynRangeForFirstAxis ); 
     115        yleftForFirstAxis.setLocationU( originPointForFirstAxis ); 
     116        yleftForFirstAxis.setLabelFont( _axisFont ); 
     117        final String yLabelForFirstAxis = firstLineForFirstAxis.getYMetaData().getName() + " (" + firstLineForFirstAxis.getYMetaData().getUnits() + ")"; 
     118        final SGLabel ytitleForFirstAxis = new SGLabel( "Y-Axis Title", yLabelForFirstAxis, new Point2D.Double( 0.0, 0.0 ) ); 
     119        ytitleForFirstAxis.setFont( _axisFont ); 
     120        ytitleForFirstAxis.setHeightP( _heightAxisFont ); 
     121        yleftForFirstAxis.setTitle( ytitleForFirstAxis ); 
     122 
    133123        /** ************ GRAPH ********** **/ 
    134124        // Create first CartesianGraph and transforms 
    135125        final CartesianGraph graph = new CartesianGraph( "First Graph" ); 
    136         final LinearTransform xt = new LinearTransform( new Range2D( xstart, xend ), xnRange ); 
    137         graph.setXTransform( xt ); 
    138         final LinearTransform yt = new LinearTransform( new Range2D( ystart, yend ), ynRange ); 
    139         graph.setYTransform( yt ); 
     126        final LinearTransform xtForFirstAxis = new LinearTransform( new Range2D( xstart, xend ), xnRange ); 
     127        graph.setXTransform( xtForFirstAxis ); 
     128        final LinearTransform ytForFirstAxis = new LinearTransform( new Range2D( ystart, yend ), ynRangeForFirstAxis ); 
     129        graph.setYTransform( ytForFirstAxis ); 
    140130 
    141131        graph.addXAxis( xbot ); 
    142         graph.addYAxis( yleft ); 
    143         graph.addYAxis( yleft2 ); 
    144  
    145  
    146         /** *********** LINE ********* **/ 
    147         final LineAttribute attr; 
    148         final int lineAttributeStyle; 
    149         if( megapoliPlot.getAxeType().equals( AxeTypeForFixedPlateform.TIME_POINTS.toString() ) ) 
    150             lineAttributeStyle = LineAttribute.MARK; 
    151         else 
    152             lineAttributeStyle = LineAttribute.SOLID; 
    153         attr = new LineAttribute( lineAttributeStyle, 1, Color.red ); 
    154         attr.setMarkHeightP( _markHeight ); 
    155  
    156         graph.setData( firstLine, attr ); 
    157         layer.setGraph( graph ); 
     132        graph.addYAxis( yleftForFirstAxis ); 
     133 
     134        final LineAttribute attrForFirstAxis = createRandomLineAttrbute( megapoliPlot.getAxeType() ); 
     135        graph.setData( firstLineForFirstAxis, attrForFirstAxis ); 
    158136 
    159137        /** *********** LEGEND ********* **/ 
     
    162140        { 
    163141            lkey.setId( "Legend" ); 
    164             lkey.setLocationP( new Point2D.Double( xsize - 1, ysize - 1 ) ); 
    165             lkey.setVAlign( LineKey.TOP ); 
    166             lkey.setHAlign( LineKey.RIGHT ); 
     142            lkey.setLocationP( new Point2D.Double( 0.1, ysize - 0.1 ) ); 
     143            lkey.setBorderStyle( LineKey.NO_BORDER ); 
    167144            layer.addChild( lkey ); 
    168             lkey.addLineGraph( (LineCartesianRenderer) graph.getRenderer(), new SGLabel( "First line", "Red Data", new Point2D.Double( 0.0, 0.0 ) ) ); 
     145            lkey.addLineGraph( (LineCartesianRenderer) graph.getRenderer(), firstLineForFirstAxis.getKeyTitle() ); 
    169146        } 
    170147 
     
    172149        /** *********** OTHER LAYERS ********* **/ 
    173150        /** ********************************** **/ 
    174         for( final SimpleLine line : lines.subList( 1, lines.size() ) ) 
     151        for( final SimpleLine line : linesForFirstAxis.subList( 1, linesForFirstAxis.size() ) ) 
    175152        { 
    176153            final Layer otherLayer = new Layer( "Other Layer", new Dimension2D( xsize, ysize ) ); 
    177154            mainPane.add( otherLayer ); 
    178             final CartesianGraph otherGraph = new CartesianGraph( "Second Graph", xt, yt ); 
     155            final CartesianGraph otherGraph = new CartesianGraph( "Second Graph", xtForFirstAxis, ytForFirstAxis ); 
    179156            otherLayer.setGraph( otherGraph ); 
    180157 
    181             final LineAttribute otherLineAttribute = new LineAttribute( lineAttributeStyle, 2, Color.blue ); 
    182             otherLineAttribute.setMarkHeightP( _markHeight ); 
     158            final LineAttribute otherLineAttribute = createRandomLineAttrbute( megapoliPlot.getAxeType() ); 
    183159            otherGraph.setData( line, otherLineAttribute ); 
    184             lkey.addLineGraph( (LineCartesianRenderer) otherGraph.getRenderer(), new SGLabel( "Other line", "Other Data", new Point2D.Double( 0.0, 0.0 ) ) ); 
     160            lkey.addLineGraph( (LineCartesianRenderer) otherGraph.getRenderer(), line.getKeyTitle() ); 
    185161        } 
     162 
     163        /** *********** SECOND Y-AXIS (optional) ************ **/ 
     164        if( !pIdPIdListForSecondAxis.isEmpty() ) 
     165        { 
     166            final List<SimpleLine> linesForSecondAxis = createLines( pIdPIdListForSecondAxis, megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() ); 
     167            final SimpleLine firstLineForSecondAxis = linesForSecondAxis.get( 0 ); 
     168 
     169            final SoTRange yRangeForSecondAxis = firstLineForSecondAxis.getYRange(); 
     170            for( final SimpleLine line : linesForSecondAxis ) 
     171                yRangeForSecondAxis.add( line.getYRange() ); 
     172 
     173            final SoTRange ynRangeForSecondAxis = Graph.computeRange( yRangeForSecondAxis, intervalsNumber ); 
     174            final SoTPoint endPointForSecondAxis = new SoTPoint( ynRangeForSecondAxis.getStart(), xnRange.getEnd() ); 
     175 
     176            final PlainAxis yleftForSecondAxis = new PlainAxis( "YY-Axis" ); 
     177            yleftForSecondAxis.setRangeU( yRangeForSecondAxis ); 
     178            yleftForSecondAxis.setLocationU( endPointForSecondAxis ); 
     179            yleftForSecondAxis.setLabelFont( _axisFont ); 
     180            yleftForSecondAxis.setLabelPosition( Axis.POSITIVE_SIDE ); 
     181            final SGLabel ytitleForSecondAxis = new SGLabel( "Y-Axis Title", firstLineForSecondAxis.getYMetaData().getName(), new Point2D.Double( 0.0, 0.0 ) ); 
     182            ytitleForSecondAxis.setFont( _axisFont ); 
     183            ytitleForSecondAxis.setHeightP( _heightAxisFont ); 
     184            yleftForSecondAxis.setTitle( ytitleForSecondAxis ); 
     185 
     186            /** ************ GRAPH ********** **/ 
     187            final LinearTransform ytForSecondAxis = new LinearTransform( new Range2D( ystart, yend ), ynRangeForSecondAxis ); 
     188            graph.setYTransform( ytForSecondAxis ); 
     189            graph.addYAxis( yleftForSecondAxis ); 
     190 
     191            final LineAttribute attrForSecondAxis = createRandomLineAttrbute( megapoliPlot.getAxeType() ); 
     192            graph.setData( firstLineForSecondAxis, attrForSecondAxis ); 
     193 
     194            for( final SimpleLine line : linesForSecondAxis.subList( 1, linesForSecondAxis.size() ) ) 
     195            { 
     196                final Layer otherLayer = new Layer( "Other Layer", new Dimension2D( xsize, ysize ) ); 
     197                mainPane.add( otherLayer ); 
     198                final CartesianGraph otherGraph = new CartesianGraph( "Second Graph", xtForFirstAxis, ytForSecondAxis ); 
     199                otherLayer.setGraph( otherGraph ); 
     200 
     201                final LineAttribute otherLineAttribute = createRandomLineAttrbute( megapoliPlot.getAxeType() ); 
     202                otherGraph.setData( line, otherLineAttribute ); 
     203                lkey.addLineGraph( (LineCartesianRenderer) otherGraph.getRenderer(), line.getKeyTitle() ); 
     204            } 
     205        } 
     206        layer.setGraph( graph ); 
     207 
    186208        return mainPane; 
     209    } 
     210 
     211    /** 
     212     * This method returns a new LineAttribute with a random color 
     213     * 
     214     * @param axeType 
     215     * @return 
     216     */ 
     217    @NotNull 
     218    private LineAttribute createRandomLineAttrbute( @NotNull final String axeType ) 
     219    { 
     220        final LineAttribute attr; 
     221        final Color color = new Color( new Random().nextInt( 256 ), new Random().nextInt( 256 ), new Random().nextInt( 256 ) ); 
     222 
     223        if( axeType.equals( AxeTypeForFixedPlateform.TIME_POINTS.toString() ) ) 
     224            attr = new LineAttribute( LineAttribute.MARK, 1, color ); 
     225        else 
     226            attr = new LineAttribute( LineAttribute.SOLID, 1, color ); 
     227 
     228        attr.setMarkHeightP( _markHeight ); 
     229 
     230        return attr; 
     231    } 
     232 
     233    private Pair<List, List> extractListPairForAxes( @NotNull final List<Pair> pIdPIdList ) 
     234    { 
     235        final List<Pair> pIdPIdListForFirstAxis = new ArrayList<Pair>(); 
     236        final List<Pair> pIdPIdListForSecondAxis = new ArrayList<Pair>(); 
     237 
     238        for( final Pair pIdPId : pIdPIdList ) 
     239        { 
     240            final List<Integer> secondValuesForFirstAxis = getSecondValues( pIdPIdListForFirstAxis ); 
     241            final Integer parameterId = (Integer) pIdPId.getSecondValue(); 
     242 
     243            if( pIdPIdListForFirstAxis.isEmpty() || secondValuesForFirstAxis.contains( parameterId ) ) 
     244                pIdPIdListForFirstAxis.add( pIdPId ); 
     245            else 
     246                pIdPIdListForSecondAxis.add( pIdPId ); 
     247        } 
     248 
     249        return new Pair( pIdPIdListForFirstAxis, pIdPIdListForSecondAxis ); 
     250    } 
     251 
     252    private List getSecondValues( @NotNull final List<Pair> pairList ) 
     253    { 
     254        final List secondValues = new ArrayList<Integer>( pairList.size() ); 
     255        for( final Pair pair : pairList ) 
     256            secondValues.add( pair.getSecondValue() ); 
     257        return secondValues; 
     258    } 
     259 
     260    /** 
     261     * This method extracts data from BD for the plateform and parameter given as parameters 
     262     * and creates the corresponded simpleLine 
     263     * 
     264     * @param pIdPIdList 
     265     * @param beginDate 
     266     * @param endDate 
     267     * @return 
     268     * @throws ServiceException 
     269     */ 
     270    @NotNull 
     271    private List<SimpleLine> createLines( @NotNull final List<Pair> pIdPIdList, @Nullable final Date beginDate, @Nullable final Date endDate ) 
     272            throws ServiceException 
     273    { 
     274        final List<SimpleLine> lines = new ArrayList<SimpleLine>( pIdPIdList.size() ); 
     275        boolean isFirstLine = true; 
     276 
     277        for( final Pair<Integer, Integer> pIdPId : pIdPIdList ) 
     278        { 
     279            final Integer plateformId = pIdPId.getFirstValue(); 
     280            final Integer parameterId = pIdPId.getSecondValue(); 
     281 
     282            final Plateforme plateform = _etherService.getPlateformById( plateformId ); 
     283//            final Plateforme plateform = BouchonHelper.createPlateform(); 
     284            if( null == plateform ) 
     285                throw new ServiceException( ServiceException.ServiceCode.PLATEFORM_IS_NULL, new Throwable( ServiceException.ServiceCode.PLATEFORM_IS_NULL.toString() ) ); 
     286 
     287            final Parametre parametre = _etherService.getParameterById( parameterId ); 
     288//            final Parametre parametre = BouchonHelper.createParameter(); 
     289            if( null == parametre ) 
     290                throw new ServiceException( ServiceException.ServiceCode.PARAMETER_IS_NULL, new Throwable( ServiceException.ServiceCode.PARAMETER_IS_NULL.toString() ) ); 
     291 
     292            final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodForTimeSerie( plateformId, parameterId, beginDate, endDate ); 
     293//            final Data valuesLists = BouchonHelper.createValuesTemp( 50, 5 ); 
     294 
     295            final double[] dataArray = (double[]) valuesLists.getFirstArray(); 
     296            final Date[] dateValues = (Date[]) valuesLists.getSecondArray(); 
     297 
     298            final SimpleLine line = new SimpleLine( new GeoDateArray( dateValues ), dataArray, "legend" ); 
     299            SGTMetaData meta = new SGTMetaData( "", "", false, false ); 
     300            line.setXMetaData( meta ); 
     301            line.setKeyTitle( new SGLabel( "Line", plateform.getPlateformeNom() + "-" + parametre.getParametreNom(), new Point2D.Double( 0.0, 0.0 ) ) ); 
     302 
     303            if( isFirstLine ) 
     304                meta = new SGTMetaData( parametre.getParametreNom(), parametre.getUnite().getUniteCode(), false, false ); 
     305            else 
     306                meta = new SGTMetaData( "", "", false, false ); 
     307            line.setYMetaData( meta ); 
     308 
     309            lines.add( line ); 
     310            isFirstLine = false; 
     311        } 
     312        return lines; 
    187313    } 
    188314 
     
    443569    } 
    444570 
    445     @NotNull 
    446     private JPlotLayout createJPlotLayoutFor2DOrig( final MegapoliPlot megapoliPlot, final Integer plotWidth, final Integer plotHeight, @Nullable final Locale locale ) 
    447     { 
    448         final ResourceBundle bundle = WebHelper.getBundle( locale ); 
    449  
    450         final double[] parameterArray = (double[]) megapoliPlot.getData().getFirstArray(); 
    451         final double[] latitudeArray = (double[]) megapoliPlot.getData().getSecondArray(); 
    452         final double[] longitudeValues = (double[]) megapoliPlot.getData().getThirdArray(); 
    453  
    454 //        final SimpleLine data = new SimpleLine( longitudeValues, latitudeArray, "legend" ); 
    455         final SimpleGrid data = new SimpleGrid( parameterArray, longitudeValues, latitudeArray, "Test Series" ); 
    456         SGTMetaData meta = new SGTMetaData( bundle.getString( "plot.longitude" ), bundle.getString( "plot.degres" ), false, true ); 
    457         // TODO : vérifier modulo = 360 
    458 //        meta.setModuloValue( 360 ); 
    459         data.setXMetaData( meta ); 
    460  
    461         meta = new SGTMetaData( bundle.getString( "plot.latitude" ), bundle.getString( "plot.degres" ), false, true ); 
    462         // TODO : vérifier modulo = 360 
    463 //        meta.setModuloValue( 360 ); 
    464         data.setYMetaData( meta ); 
    465  
    466         // Graph 
    467         final JPlotLayout jPlotLayout = new JPlotLayout( true, false, false, "JGridDemo Pane", null, true ); 
    468         jPlotLayout.setEditClasses( false ); 
    469         /* 
    470        * Create a GridAttribute for CONTOUR style. 
    471         */ 
    472         final Range2D datar = new Range2D( -20.0f, 45.0f, 5.0f ); 
    473         final ContourLevels clevels = ContourLevels.getDefault( datar ); 
    474         final GridAttribute gridAttr = new GridAttribute( clevels ); 
    475         /* 
    476        * Create a ColorMap and change the style to RASTER_CONTOUR. 
    477         */ 
    478         final ColorMap cmap = createColorMap( datar ); 
    479         gridAttr.setColorMap( cmap ); 
    480         gridAttr.setStyle( GridAttribute.RASTER_CONTOUR ); 
    481         /* 
    482        * Add the grid to the layout and give a label for 
    483        * the ColorKey. 
    484         */ 
    485         jPlotLayout.addData( data, gridAttr, "First Data" ); 
    486  
    487 //        final JPlotLayoutEther jPlotLayout = new JPlotLayoutEther( false, megapoliPlot.isXTime(), false, "Trajectory data", null, megapoliPlot.isLegendToHide() ); 
    488 //        jPlotLayout.setTitles( "", "", "" ); 
    489  
    490         // Replace legend 
    491 //        final String legend = megapoliPlot.getData().getTitle(); 
    492 //        final Dimension2D layerSizeP = jPlotLayout.getLayerSizeP(); 
    493 //        final double factorForPlotWidthInPhysicalUnits = layerSizeP.getWidth() / Double.valueOf( plotWidth ); 
    494 //        final double legendSizeInPhysicalUnits = legend.length() * factorForPlotWidthInPhysicalUnits * 7; 
    495 //        jPlotLayout.setKeyLocationP( new Point2D.Double( layerSizeP.getWidth() - legendSizeInPhysicalUnits, layerSizeP.getHeight() - 0.1 ) ); 
    496  
    497         // Add data and legend 
    498 //        jPlotLayout.addData( megapoliPlot.getData(), legend ); 
    499         jPlotLayout.setSize( plotWidth, plotHeight ); 
    500         jPlotLayout.setVisible( true ); 
    501  
    502         jPlotLayout.addNotify(); 
    503         jPlotLayout.validate(); 
    504         jPlotLayout.setOpaque( true ); 
    505         return jPlotLayout; 
    506     } 
     571//    @NotNull 
     572//    private JPlotLayout createJPlotLayoutFor2DOrig( final MegapoliPlot megapoliPlot, final Integer plotWidth, final Integer plotHeight, @Nullable final Locale locale ) 
     573//    { 
     574//        final ResourceBundle bundle = WebHelper.getBundle( locale ); 
     575// 
     576//        final double[] parameterArray = (double[]) megapoliPlot.getData().getFirstArray(); 
     577//        final double[] latitudeArray = (double[]) megapoliPlot.getData().getSecondArray(); 
     578//        final double[] longitudeValues = (double[]) megapoliPlot.getData().getThirdArray(); 
     579// 
     580////        final SimpleLine data = new SimpleLine( longitudeValues, latitudeArray, "legend" ); 
     581//        final SimpleGrid data = new SimpleGrid( parameterArray, longitudeValues, latitudeArray, "Test Series" ); 
     582//        SGTMetaData meta = new SGTMetaData( bundle.getString( "plot.longitude" ), bundle.getString( "plot.degres" ), false, true ); 
     583//        // TODO : vérifier modulo = 360 
     584////        meta.setModuloValue( 360 ); 
     585//        data.setXMetaData( meta ); 
     586// 
     587//        meta = new SGTMetaData( bundle.getString( "plot.latitude" ), bundle.getString( "plot.degres" ), false, true ); 
     588//        // TODO : vérifier modulo = 360 
     589////        meta.setModuloValue( 360 ); 
     590//        data.setYMetaData( meta ); 
     591// 
     592//        // Graph 
     593//        final JPlotLayout jPlotLayout = new JPlotLayout( true, false, false, "JGridDemo Pane", null, true ); 
     594//        jPlotLayout.setEditClasses( false ); 
     595//        /* 
     596//       * Create a GridAttribute for CONTOUR style. 
     597//        */ 
     598//        final Range2D datar = new Range2D( -20.0f, 45.0f, 5.0f ); 
     599//        final ContourLevels clevels = ContourLevels.getDefault( datar ); 
     600//        final GridAttribute gridAttr = new GridAttribute( clevels ); 
     601//        /* 
     602//       * Create a ColorMap and change the style to RASTER_CONTOUR. 
     603//        */ 
     604//        final ColorMap cmap = createColorMap( datar ); 
     605//        gridAttr.setColorMap( cmap ); 
     606//        gridAttr.setStyle( GridAttribute.RASTER_CONTOUR ); 
     607//        /* 
     608//       * Add the grid to the layout and give a label for 
     609//       * the ColorKey. 
     610//        */ 
     611//        jPlotLayout.addData( data, gridAttr, "First Data" ); 
     612// 
     613////        final JPlotLayoutEther jPlotLayout = new JPlotLayoutEther( false, megapoliPlot.isXTime(), false, "Trajectory data", null, megapoliPlot.isLegendToHide() ); 
     614////        jPlotLayout.setTitles( "", "", "" ); 
     615// 
     616//        // Replace legend 
     617////        final String legend = megapoliPlot.getData().getTitle(); 
     618////        final Dimension2D layerSizeP = jPlotLayout.getLayerSizeP(); 
     619////        final double factorForPlotWidthInPhysicalUnits = layerSizeP.getWidth() / Double.valueOf( plotWidth ); 
     620////        final double legendSizeInPhysicalUnits = legend.length() * factorForPlotWidthInPhysicalUnits * 7; 
     621////        jPlotLayout.setKeyLocationP( new Point2D.Double( layerSizeP.getWidth() - legendSizeInPhysicalUnits, layerSizeP.getHeight() - 0.1 ) ); 
     622// 
     623//        // Add data and legend 
     624////        jPlotLayout.addData( megapoliPlot.getData(), legend ); 
     625//        jPlotLayout.setSize( plotWidth, plotHeight ); 
     626//        jPlotLayout.setVisible( true ); 
     627// 
     628//        jPlotLayout.addNotify(); 
     629//        jPlotLayout.validate(); 
     630//        jPlotLayout.setOpaque( true ); 
     631//        return jPlotLayout; 
     632//    } 
    507633 
    508634    @NotNull 
     
    654780    } 
    655781 
    656     /** 
    657      * This method extracts data from BD for the plateform and parameter given as parameters 
    658      * and creates the corresponded simpleLine 
    659      * 
    660      * @param pIdPIdList 
    661      * @param beginDate 
    662      * @param endDate 
    663      * @return 
    664      * @throws ServiceException 
    665      */ 
    666     @NotNull 
    667     private List<SimpleLine> createLines( @NotNull final List<Pair> pIdPIdList, @Nullable final Date beginDate, @Nullable final Date endDate ) 
    668             throws ServiceException 
    669     { 
    670         final List<SimpleLine> lines = new ArrayList<SimpleLine>( pIdPIdList.size() ); 
    671         boolean isFirstLine = true; 
    672  
    673         for( final Pair<Integer, Integer> pIdPId : pIdPIdList ) 
    674         { 
    675             final Parametre parametre = new Parametre(); 
    676             if( isFirstLine ) 
    677             { 
    678 //            final Parametre parametre = _etherService.getParameterById( parameterId ); 
    679                 parametre.setParametreNom( "Ozone" ); 
    680                 final Unite unit = new Unite(); 
    681                 unit.setUniteCode( "ppb" ); 
    682                 parametre.setUnite( unit ); 
    683                 if( null == parametre ) 
    684                     throw new ServiceException( ServiceException.ServiceCode.PARAMETER_IS_NULL, new Throwable( ServiceException.ServiceCode.PARAMETER_IS_NULL.toString() ) ); 
    685             } 
    686  
    687             final Integer plateformId = pIdPId.getFirstValue(); 
    688             final Integer parameterId = pIdPId.getSecondValue(); 
    689 //        final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodForTimeSerie( plateformId, parameterId, beginDate, endDate ); 
    690             final Data valuesLists = createValuesTemp( 50, 5 ); 
    691  
    692             final double[] dataArray = (double[]) valuesLists.getFirstArray(); 
    693             final Date[] dateValues = (Date[]) valuesLists.getSecondArray(); 
    694  
    695             final SimpleLine line = new SimpleLine( new GeoDateArray( dateValues ), dataArray, "legend" ); 
    696             SGTMetaData meta = new SGTMetaData( "", "", false, false ); 
    697             line.setXMetaData( meta ); 
    698  
    699             if( isFirstLine ) 
    700                 meta = new SGTMetaData( parametre.getParametreNom(), parametre.getUnite().getUniteCode(), false, false ); 
    701             else 
    702                 meta = new SGTMetaData( "", "", false, false ); 
    703             line.setYMetaData( meta ); 
    704  
    705             lines.add( line ); 
    706             isFirstLine = false; 
    707         } 
    708         return lines; 
    709     } 
    710  
    711     // TODO : remove this method 
    712     private Data createValuesTemp( final Integer size, final Integer delta ) 
    713     { 
    714         final double[] values = new double[size]; 
    715         final Date[] dates = new Date[size]; 
    716         final Calendar cal = Calendar.getInstance(); 
    717  
    718         for( int i = 0; i < size; i++ ) 
    719         { 
    720             values[i] = (double) i * Math.random(); 
    721             cal.set( Calendar.MINUTE, (int) ( 2 + i + ( Math.random() * 8 ) ) ); 
    722             dates[i] = cal.getTime(); 
    723         } 
    724         return new Data( values, dates ); 
    725     } 
    726  
    727782    @Required 
    728783    public void setEtherService( final EtherService etherService ) 
    729784    { 
    730785        _etherService = etherService; 
     786    } 
     787 
     788    public EtherService getEtherService() 
     789    { 
     790        return _etherService; 
    731791    } 
    732792 
  • ether_megapoli/trunk/service/implementation/com/ether/EtherPlotServiceImpl.java

    r184 r185  
    6969 
    7070        // TODO : gérer values Number 
    71         final Integer valuesNumber = 10; 
    72 //        final Integer valuesNumber = megapoliPlot.getValuesNumber(); 
     71//        final Integer valuesNumber = 10; 
     72        final Integer valuesNumber = getEtherService().getNumberValuesByPlateformByParameterByPeriod( megapoliPlot.getpIdPIdList(), megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() ); 
    7373 
    7474        // Bottom Pane 
  • ether_megapoli/trunk/service/implementation/com/ether/EtherServiceImpl.java

    r171 r185  
    117117    } 
    118118 
     119    @NotNull 
     120    @Transactional(readOnly = true) 
     121    public Integer getNumberValuesByPlateformByParameterByPeriod( @NotNull final List<Pair> pairs, @Nullable final Date beginDate, @Nullable final Date endDate ) 
     122            throws ServiceException 
     123    { 
     124        try 
     125        { 
     126            Integer number = 0; 
     127            for( final Pair pair : pairs ) 
     128                number += _valueDAO.getNumberValuesByPlateformByParameterByPeriod( (Integer) pair.getFirstValue(), (Integer) pair.getSecondValue(), beginDate, endDate ); 
     129 
     130            return number; 
     131        } 
     132        catch( PersistenceException e ) 
     133        { 
     134            throw new ServiceException( ServiceException.ServiceCode.VALUE_NOT_FOUND, e ); 
     135        } 
     136    } 
     137 
    119138    @Required 
    120139    public void setPlateformDAO( final PlateformDAO plateformDAO ) 
  • ether_megapoli/trunk/service/implementation/com/ether/MegapoliPlot.java

    r184 r185  
    7777    } 
    7878 
    79 //    @Nullable 
    80 //    public String getParameterName() 
    81 //    { 
    82 //        return _parameterName; 
    83 //    } 
    84 // 
    85 //    public void setParameterName( @Nullable final String parameterName ) 
    86 //    { 
    87 //        _parameterName = parameterName; 
    88 //    } 
    89 // 
    90 //    @Nullable 
    91 //    public String getParameterUnitCode() 
    92 //    { 
    93 //        return _parameterUnitCode; 
    94 //    } 
    95 // 
    96 //    public void setParameterUnitCode( @Nullable final String parameterUnitCode ) 
    97 //    { 
    98 //        _parameterUnitCode = parameterUnitCode; 
    99 //    } 
    100  
    101     @NotNull 
    102     public Integer getValuesNumber() 
    103     { 
    104         return _valuesNumber; 
    105     } 
    106  
    107     public void setValuesNumber( @NotNull final Integer valuesNumber ) 
    108     { 
    109         _valuesNumber = valuesNumber; 
    110     } 
    111  
    11279    @NotNull 
    11380    public String getAxeType() 
     
    167134    private boolean _legendToHide = true; 
    168135    private boolean _isTimeSerie = true; 
    169 //    @Nullable 
    170 //    private String _parameterName; 
    171 //    @Nullable 
    172 //    private String _parameterUnitCode; 
    173     @NotNull 
    174     private Integer _valuesNumber; 
    175136    @NotNull 
    176137    private String _axeType; 
  • ether_megapoli/trunk/service/interface/com/ether/EtherService.java

    r171 r185  
    3939    <T1, T2, T3> Data<T1[], T2[], T3[]> getListsByPlateformByParameterByPeriodFor2D( @NotNull final Integer plateformId, @NotNull final Integer parameterId, @Nullable final Date dateBegin, @Nullable final Date dateEnd ) 
    4040            throws ServiceException; 
     41 
     42    @NotNull 
     43    Integer getNumberValuesByPlateformByParameterByPeriod( @NotNull final List<Pair> pairs, @Nullable final Date beginDate, @Nullable final Date endDate ) 
     44            throws ServiceException; 
    4145} 
  • ether_megapoli/trunk/service/interface/com/ether/ServiceException.java

    r184 r185  
    2424        SERVICE_PROBLEM,  
    2525        PLATEFORM_NOT_FOUND, 
     26        PLATEFORM_IS_NULL, 
    2627        PARAMETER_NOT_FOUND, 
    2728        PARAMETER_IS_NULL, 
  • ether_megapoli/trunk/service/test/com/ether/ServiceEtherTest.java

    r89 r185  
    11package com.ether; 
    22 
    3 import gov.noaa.pmel.util.GeoDateArray; 
    4 import org.jetbrains.annotations.NotNull; 
    5 import org.jetbrains.annotations.Nullable; 
    6  
    7 import java.text.ParseException; 
    8 import java.util.ArrayList; 
    9 import java.util.Date; 
    10 import java.util.List; 
     3import com.medias.database.objects.Plateforme; 
     4import com.medias.database.objects.TypePlateforme; 
    115 
    126/** 
     
    2822        afterServiceTest(); 
    2923    } 
    30  
    3124} 
  • ether_megapoli/trunk/service/test/com/ether/ServiceTestHelper.java

    r89 r185  
    33import com.medias.database.objects.Parametre; 
    44import com.medias.database.objects.Plateforme; 
     5import com.medias.database.objects.TypePlateforme; 
    56import com.medias.database.objects.Valeur; 
    67import org.apache.commons.logging.Log; 
    78import org.apache.commons.logging.LogFactory; 
    89 
    9 public abstract class ServiceTestHelper<SERVICE extends Service>  
    10         extends HibernateTestHelper<SERVICE> 
     10public abstract class ServiceTestHelper<SERVICE extends Service> 
     11        extends HibernateTestHelper<SERVICE> 
    1112{ 
    12     protected ServiceTestHelper(final String serviceBeanName) { 
    13         super(null, serviceBeanName, getAllDependencies(), DEFAULT_SESSION_FACTORY_BEAN_NAME); 
     13    protected ServiceTestHelper( final String serviceBeanName ) 
     14    { 
     15        super( null, serviceBeanName, getAllDependencies(), DEFAULT_SESSION_FACTORY_BEAN_NAME ); 
    1416    } 
    1517 
    16     protected void deleteAllKnownData() throws Exception 
     18    protected void deleteAllKnownData() 
     19            throws Exception 
    1720    { 
    18         //      deleteAllDatas( getAllKnownDomainClasses() ); 
     21        //      deleteAllDatas( getAllKnownDomainClasses() ); 
    1922    } 
    2023 
    2124    public static String[] getAllDependencies() 
    2225    { 
    23                 return new String[] {  
    24                                 "classpath:dao-context.xml", 
    25                                 "classpath:service-context.xml", 
    26                                 "classpath:hibernate_test.cfg.xml", }; 
     26        return new String[]{ 
     27                "classpath:dao-context.xml", 
     28                "classpath:service-context.xml", 
     29                "classpath:hibernate_test.cfg.xml",}; 
    2730    } 
    2831 
     
    3033    public static Class[] getAllKnownDomainClasses() 
    3134    { 
    32         return new Class[] {  
    33                         Plateforme.class, 
    34                         Parametre.class, 
    35                         Valeur.class,}; 
     35        return new Class[]{ 
     36                Plateforme.class, 
     37                Parametre.class, 
     38                Valeur.class,}; 
    3639    } 
    3740 
     
    3942     * Executes operations before running test. 
    4043     */ 
    41     protected abstract void beforeServiceTest() throws Exception; 
     44    protected abstract void beforeServiceTest() 
     45            throws Exception; 
    4246 
    4347    /** 
    4448     * Executes operations after running test. 
    4549     */ 
    46     protected final void afterServiceTest() throws Exception 
     50    protected final void afterServiceTest() 
     51            throws Exception 
    4752    { 
    48          //deleteAllKnownData();         
     53        //deleteAllKnownData(); 
    4954    } 
    5055 
    51     protected final void beforeHibernateTest() throws Exception 
     56    protected final void beforeHibernateTest() 
     57            throws Exception 
    5258    { 
    53         beforeServiceTest(); 
     59        beforeServiceTest(); 
    5460    } 
    5561 
    56     protected final void afterHibernateTest() throws Exception 
     62    protected final void afterHibernateTest() 
     63            throws Exception 
    5764    { 
    58         afterServiceTest(); 
     65        afterServiceTest(); 
    5966    } 
    6067 
    6168    protected final SERVICE getService() 
    6269    { 
    63         return getBean(); 
     70        return getBean(); 
    6471    } 
    6572 
    66     private static final Log LOGGER = LogFactory.getLog(ServiceTestHelper.class); 
     73    private static final Log LOGGER = LogFactory.getLog( ServiceTestHelper.class ); 
    6774    private static final String DEFAULT_SESSION_FACTORY_BEAN_NAME = "sessionFactory"; 
    6875} 
  • ether_megapoli/trunk/web/src/com/ether/Controller.java

    r184 r185  
    5151            throws ServiceException 
    5252    { 
    53 //        final List<Plateforme> plateforms = _etherService.getAllPlateforms(); 
    54         final List<Plateforme> plateforms = new ArrayList<Plateforme>(); 
    55         final Plateforme pf = new Plateforme(); 
    56         pf.setPlateformeId( 1 ); 
    57         pf.setPlateformeNom( "LHVP" ); 
    58         pf.setTypePlateforme( new TypePlateforme( 1, "FIXE" ) ); 
    59         plateforms.add( pf ); 
    60         final Plateforme pf2 = new Plateforme(); 
    61         pf2.setPlateformeId( 2 ); 
    62         pf2.setPlateformeNom( "SIRTA" ); 
    63         pf2.setTypePlateforme( new TypePlateforme( 1, "MOBILE" ) ); 
    64         plateforms.add( pf2 ); 
     53        final List<Plateforme> plateforms = _etherService.getAllPlateforms(); 
     54//        final List<Plateforme> plateforms = new ArrayList<Plateforme>(); 
     55//        final Plateforme pf = new Plateforme(); 
     56//        pf.setPlateformeId( 1 ); 
     57//        pf.setPlateformeNom( "LHVP" ); 
     58//        pf.setTypePlateforme( new TypePlateforme( 1, "FIXE" ) ); 
     59//        plateforms.add( pf ); 
     60//        final Plateforme pf2 = new Plateforme(); 
     61//        pf2.setPlateformeId( 2 ); 
     62//        pf2.setPlateformeNom( "SIRTA" ); 
     63//        pf2.setTypePlateforme( new TypePlateforme( 1, "FIXE" ) ); 
     64//        plateforms.add( pf2 ); 
    6565 
    6666        final Map<String, Object> model = new HashMap<String, Object>(); 
     
    8080            throws ServiceException, EtherException 
    8181    { 
    82 //        final List<Parametre> parametersByPlateform = _etherService.getParametersByPlateformId( plateformId ); 
    83         final List<Parametre> parametersByPlateform = new ArrayList<Parametre>( 2 ); 
    84         final Parametre p1 = new Parametre(); 
    85         p1.setParametreId( 1 ); 
    86         p1.setParametreNom( "JNO2" ); 
    87         parametersByPlateform.add( p1 ); 
    88         final Parametre p2 = new Parametre(); 
    89         p2.setParametreId( 2 ); 
    90         p2.setParametreNom( "CO2" ); 
    91         parametersByPlateform.add( p2 ); 
    92  
    93         if( plateformId == 1 ) 
    94         { 
    95             final Parametre p3 = new Parametre(); 
    96             p3.setParametreId( 3 ); 
    97             p3.setParametreNom( "Ethane" ); 
    98             parametersByPlateform.add( p3 ); 
    99         } 
    100         else 
    101         { 
    102             final Parametre p3 = new Parametre(); 
    103             p3.setParametreId( 3 ); 
    104             p3.setParametreNom( "Sulfate" ); 
    105             parametersByPlateform.add( p3 ); 
    106             final Parametre p4 = new Parametre(); 
    107             p4.setParametreId( 4 ); 
    108             p4.setParametreNom( "Benzene" ); 
    109             parametersByPlateform.add( p4 ); 
    110         } 
     82        final List<Parametre> parametersByPlateform = _etherService.getParametersByPlateformId( plateformId ); 
     83//        final List<Parametre> parametersByPlateform = new ArrayList<Parametre>( 2 ); 
     84//        final Parametre p1 = new Parametre(); 
     85//        p1.setParametreId( 1 ); 
     86//        p1.setParametreNom( "JNO2" ); 
     87//        parametersByPlateform.add( p1 ); 
     88//        final Parametre p2 = new Parametre(); 
     89//        p2.setParametreId( 2 ); 
     90//        p2.setParametreNom( "CO2" ); 
     91//        parametersByPlateform.add( p2 ); 
     92// 
     93//        if( plateformId == 1 ) 
     94//        { 
     95//            final Parametre p3 = new Parametre(); 
     96//            p3.setParametreId( 3 ); 
     97//            p3.setParametreNom( "Ethane" ); 
     98//            parametersByPlateform.add( p3 ); 
     99//        } 
     100//        else 
     101//        { 
     102//            final Parametre p3 = new Parametre(); 
     103//            p3.setParametreId( 3 ); 
     104//            p3.setParametreNom( "Sulfate" ); 
     105//            parametersByPlateform.add( p3 ); 
     106//            final Parametre p4 = new Parametre(); 
     107//            p4.setParametreId( 4 ); 
     108//            p4.setParametreNom( "Benzene" ); 
     109//            parametersByPlateform.add( p4 ); 
     110//        } 
    111111 
    112112        final JSONObject result = new JSONObject(); 
  • ether_megapoli/trunk/web/src/com/ether/ControllerPlot.java

    r184 r185  
    105105                megapoliPlot.setTimeSerie( true ); 
    106106                megapoliPlot.setLegendToHide( pIdPIdList.size() == 1 ); 
    107 //                megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 
    108107            } 
    109108            else 
     
    128127                megapoliPlot.setTimeSerie( false ); 
    129128                megapoliPlot.setLegendToHide( false ); 
    130                 megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 
     129//                megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 
    131130            } 
    132131 
     
    160159    } 
    161160 
     161    // TODO : supprimer cette méthode et utiliser JSON pour récupérer pIdPIdList 
    162162    @Nullable 
    163163    private List<Pair> extractpIdPIdListFromString( @NotNull final String pIdPIdArrayString ) 
  • ether_megapoli/trunk/web/visualization/visu_parameter_by_pf-script.jsp

    r184 r185  
    7070            labelTitle: interfaceTexts["data.visualization.selectDate"], labelYear: interfaceTexts["data.visualization.selectYear"], labelMonth: interfaceTexts["data.visualization.selectMonth"], labelDayOfMonth: interfaceTexts["data.visualization.selectDay"], 
    7171            labelHour: interfaceTexts["data.visualization.selectHour"], labelMinute: interfaceTexts["data.visualization.selectMinute"], 
     72            methodToCall: this.onClickEndDate.bindAsEventListener( this ), 
    7273            idToUpdateEarliest: "beginDate" 
    7374        } ); 
     
    209210 
    210211        // Enable/disable addPlot's button 
    211         if( !this.selectPlotsPlateformType || this.selectPlotsPlateformType == this.selectedPlateform.jsonElement.type ) 
     212        if( (!this.selectPlotsPlateformType || this.selectPlotsPlateformType == this.selectedPlateform.jsonElement.type) && "MOBILE" != this.selectedPlateform.jsonElement.type ) 
    212213            this.addPlotButton.enable(); 
    213214        else 
     
    243244 
    244245        this.testAllFields(); 
     246    }, 
     247 
     248    onClickEndDate: function() 
     249    { 
     250        this.endDate = this.calendarConverter.parse( $( "endDate" ).value ).getTime(); 
    245251    }, 
    246252 
Note: See TracChangeset for help on using the changeset viewer.