Changeset 132
- Timestamp:
- 08/23/11 16:52:29 (13 years ago)
- Location:
- ether_megapoli/trunk
- Files:
-
- 13 edited
- 1 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/domain/interface/com/ether/AxeTypeForFixedPlateform.java
r130 r132 1 1 package com.ether; 2 2 3 public enum AxeType 3 public enum AxeTypeForFixedPlateform 4 4 { 5 5 TIME, 6 LATITUDE,6 FIXE, 7 7 } -
ether_megapoli/trunk/domain/interface/com/ether/AxeTypeForMobilePlateform.java
r130 r132 1 1 package com.ether; 2 2 3 public enum AxeType 3 public enum AxeTypeForMobilePlateform 4 4 { 5 TIME,6 5 LATITUDE, 6 MOBILE, 7 7 } -
ether_megapoli/trunk/persistence/implementation/com/medias/objects/Parametre.hbm.xml
r89 r132 12 12 </generator> 13 13 </id> 14 <many-to-one name="unite" class="com.medias.database.objects.Unite" fetch="select" >14 <many-to-one name="unite" class="com.medias.database.objects.Unite" fetch="select" lazy="false"> 15 15 <column name="unite_id" not-null="true"> 16 16 <comment>lien vers la table unite</comment> -
ether_megapoli/trunk/persistence/implementation/com/medias/objects/Plateforme.hbm.xml
r89 r132 17 17 </column> 18 18 </many-to-one> 19 <many-to-one name="typePlateforme" class="com.medias.database.objects.TypePlateforme" fetch="select" >19 <many-to-one name="typePlateforme" class="com.medias.database.objects.TypePlateforme" fetch="select" lazy="false"> 20 20 <column name="type_plateforme_id" not-null="true"> 21 21 <comment>lien vers la table type_plateforme</comment> -
ether_megapoli/trunk/service/implementation/com/ether/EtherPlotServiceImpl.java
r130 r132 2 2 3 3 import gov.noaa.pmel.sgt.JPane; 4 import gov.noaa.pmel.sgt.dm.SGTData;5 4 import gov.noaa.pmel.sgt.swing.JPlotLayout; 6 5 import org.apache.commons.logging.Log; … … 24 23 implements EtherPlotService 25 24 { 25 public static Integer getMaxWidth() 26 { 27 final Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); 28 return Math.min( Double.valueOf( screenSize.getWidth() ).intValue(), MAX_WIDTH ); 29 } 30 31 public static Integer getMaxHeight() 32 { 33 final Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); 34 return Math.min( Double.valueOf( screenSize.getHeight() ).intValue(), MAX_HEIGHT ); 35 } 36 26 37 /** 27 38 * Create the main JPane with the 3 jPanes … … 34 45 public BufferedImage createMainPane( @NotNull final MegapoliPlot megapoliPlot, @Nullable final Locale locale ) 35 46 { 36 // JPane jPane = new JPane( "Main jPane", new Dimension( MAIN_WIDTH, MAIN_HEIGHT ) ); 37 JPane jPane = new JPane( "Main jPane", new Dimension( MAIN_WIDTH, 700 ) ); 38 if( null != megapoliPlot.getWidth() && null != megapoliPlot.getHeight() ) 39 jPane = new JPane( "Main jPane", new Dimension( megapoliPlot.getWidth(), megapoliPlot.getHeight() ) ); 40 47 final Integer maxWidth = getMaxWidth(); 48 final Integer maxHeight = getMaxHeight(); 49 50 final JPane jPane = new JPane( "Main jPane", new Dimension( maxWidth, maxHeight ) ); 41 51 jPane.setLayout( new BorderLayout() ); 42 52 jPane.setBackground( Color.white ); 43 jPane.setBorder( BorderFactory.createLineBorder( Color.black, 2 ) );44 53 jPane.setOpaque( true ); 45 54 46 55 // Top Pane 47 // final JPane jPaneTop = createTopPane( megapoliPlot ); 48 // jPane.add( jPaneTop, BorderLayout.NORTH ); 56 final JPane jPaneTop = createTopPane( megapoliPlot ); 57 jPane.add( jPaneTop, BorderLayout.NORTH ); 58 59 final Integer valuesNumber = megapoliPlot.getData().getYArray().length; 60 61 // Bottom Pane 62 final JPane jPaneBottom = createBottomPane( valuesNumber, locale ); 63 jPane.add( jPaneBottom, BorderLayout.SOUTH ); 49 64 50 65 // Center Pane 51 final Integer valuesNumber = megapoliPlot.getData().getYArray().length;66 final Integer centerHeight = maxHeight - jPaneTop.getHeight() - jPaneBottom.getHeight(); 52 67 final JPane jPaneCenter; 53 68 if( valuesNumber > 0 ) 54 jPaneCenter = createCenterPane( megapoliPlot .getData());69 jPaneCenter = createCenterPane( megapoliPlot, maxWidth, centerHeight ); 55 70 else 56 71 jPaneCenter = createEmptyCenterPane( locale ); 57 72 jPane.add( jPaneCenter, BorderLayout.CENTER ); 58 73 59 // Bottom Pane60 // final JPane jPaneBottom = createBottomPane( valuesNumber, locale );61 // jPane.add( jPaneBottom, BorderLayout.SOUTH );62 74 63 75 final JPanelToImageManager jPanelToImageManager = new JPanelToImageManager( jPane ); … … 105 117 * Create the center JPane with the graph 106 118 * 107 * @param data 108 * @return 109 */ 110 @NotNull 111 public JPane createCenterPane( @NotNull final SGTData data ) 112 { 113 // final JPane jPaneCenter = new JPane( "Center jPane", new Dimension( 0, 1000 ) ); 119 * @param megapoliPlot 120 * @param maxWidth 121 * @param maxHeight 122 * @return 123 */ 124 @NotNull 125 public JPane createCenterPane( @NotNull final MegapoliPlot megapoliPlot, @NotNull final Integer maxWidth, @NotNull final Integer maxHeight ) 126 { 127 final Integer plotWidth = Math.min( maxWidth - MARGIN_LEFT_RIGHT, maxWidth ); 128 final Integer plotHeight = Math.min( maxHeight - MARGIN_LEFT_RIGHT, maxHeight ); 114 129 115 130 // Graph 116 final JPlotLayout jPlotLayout = new JPlotLayout( false, true, false, "Trajectory data", null, false);131 final JPlotLayout jPlotLayout = new JPlotLayout( false, true, false, "Trajectory data", null, megapoliPlot.isLegendToHide() ); 117 132 jPlotLayout.setTitles( "", "", "" ); 118 jPlotLayout.addData( data, data.getTitle() ); 119 // jPlotLayout.setSize( 800, 1 ); 133 // Add data and legend 134 jPlotLayout.addData( megapoliPlot.getData(), megapoliPlot.getData().getTitle() ); 135 jPlotLayout.setSize( plotWidth, plotHeight ); 120 136 jPlotLayout.setVisible( true ); 121 137 122 138 jPlotLayout.addNotify(); 123 139 jPlotLayout.validate(); 140 jPlotLayout.setOpaque( true ); 124 141 125 142 // TODO : remove this change to bufferedImage to insert directly the jPlotLayout !!!! 126 // final BufferedImage bufferedImage = new BufferedImage( jPlotLayout.getWidth(), jPlotLayout.getHeight(), BufferedImage.TYPE_INT_RGB );127 143 final BufferedImage bufferedImage = new BufferedImage( jPlotLayout.getWidth(), jPlotLayout.getHeight(), BufferedImage.TYPE_INT_RGB ); 128 144 final Graphics2D graphics2D = bufferedImage.createGraphics(); … … 130 146 131 147 final ImageIcon imageIcon = new ImageIcon( bufferedImage ); 132 final JLabel jLabel = new JLabel( imageIcon, JLabel.CENTER ); 133 jLabel.setBorder( BorderFactory.createLineBorder( Color.blue, 2 ) ); 134 135 // final JPane jPaneCenter = new JPane( "Center jPane", new Dimension( jPlotLayout.getWidth(), jPlotLayout.getHeight() ) ); 136 final JPane jPaneCenter = new JPane(); 137 jPaneCenter.setLayout( new BorderLayout() ); 138 jPaneCenter.add( jLabel, BorderLayout.CENTER ); 148 final JLabel jLabelPlot = new JLabel( imageIcon, JLabel.CENTER ); 149 jLabelPlot.setBorder( BorderFactory.createLineBorder( Color.black, 1 ) ); 150 151 final JPane jPaneCenter = new JPane( "Center jPane", new Dimension( jPlotLayout.getWidth(), jPlotLayout.getHeight() ) ); 152 jPaneCenter.setLayout( new GridBagLayout() ); 153 jPaneCenter.add( jLabelPlot, 154 new GridBagConstraints( 0, 0, 1, 1, 0, 0, 155 GridBagConstraints.CENTER, 156 GridBagConstraints.CENTER, 157 new Insets( 0, 0, 0, 0 ), 0, 0 ) ); 139 158 140 159 return jPaneCenter; … … 206 225 */ 207 226 @NotNull 208 public BufferedImage createErrorPane( @NotNull final String mainError, @N otNullfinal String errorText, @Nullable final Locale locale )227 public BufferedImage createErrorPane( @NotNull final String mainError, @Nullable final String errorText, @Nullable final Locale locale ) 209 228 { 210 229 // Image … … 215 234 final ResourceBundle bundle = WebHelper.getBundle( locale ); 216 235 final String mainMessage = bundle.getString( "plot.errorMessage" ); 217 final JLabel jLabelError = new JLabel( "<html>" + mainMessage + "<br><br>" + mainError + "<br>" + errorText + "</html>", JLabel.CENTER ); 236 237 final JLabel jLabelError; 238 if( null != errorText ) 239 jLabelError = new JLabel( "<html>" + mainMessage + "<br><br>" + mainError + "<br>" + errorText + "</html>", JLabel.CENTER ); 240 else 241 jLabelError = new JLabel( "<html>" + mainMessage + "<br><br>" + mainError + "</html>", JLabel.CENTER ); 242 218 243 final Font police = new Font( "Arial", Font.BOLD, ERROR_FONT_SIZE ); 219 244 jLabelError.setFont( police ); 220 245 221 246 // jPane 222 final JPane jPane = new JPane( "jPane", new Dimension( MA IN_WIDTH, errorImage.getIconHeight() ) );247 final JPane jPane = new JPane( "jPane", new Dimension( MAX_WIDTH, errorImage.getIconHeight() ) ); 223 248 jPane.setLayout( new BorderLayout() ); 224 249 jPane.setBackground( Color.white ); … … 243 268 } 244 269 245 public static final int TOP_HEIGHT = 110;246 public static final int CENTER_HEIGHT = 400;247 public static final int BOTTOM_HEIGHT = 50;248 249 270 private static final Log LOGGER = LogFactory.getLog( EtherPlotServiceImpl.class ); 250 271 251 272 // Dimensions of the jPanes 252 private static final int MAIN_WIDTH = 800; 253 private static final int MAIN_HEIGHT = 800; 273 private static final int MAX_WIDTH = 800; 274 private static final int MAX_HEIGHT = 700; 275 private static final int MARGIN_LEFT_RIGHT = 50; 254 276 255 277 private static final int TITLE_FONT_SIZE = 20; -
ether_megapoli/trunk/service/implementation/com/ether/MegapoliPlot.java
r130 r132 1 1 package com.ether; 2 2 3 import gov.noaa.pmel.sgt.LineAttribute;4 import gov.noaa.pmel.sgt.beans.DataModel;5 import gov.noaa.pmel.sgt.beans.Page;6 import gov.noaa.pmel.sgt.beans.PanelModel;7 3 import gov.noaa.pmel.sgt.dm.SimpleLine; 8 4 import org.jetbrains.annotations.NotNull; … … 10 6 import org.medias.megapoli.utils.MegapoliInitialisation; 11 7 12 import javax.swing.*;13 import java.awt.*;14 15 8 /** 16 9 * @author vmipsl 17 10 * @date 31 may 2011 18 11 */ 19 // TODO : range this class !!!!20 12 public class MegapoliPlot 21 13 { 22 public MegapoliPlot()23 {24 }25 26 public MegapoliPlot( @Nullable final Integer width, @Nullable final Integer height )27 {28 _width = width;29 _height = height;30 }31 32 14 @Nullable 33 15 public String getTitle() … … 74 56 } 75 57 76 @NotNull 77 public LineAttribute getLineAttribute() 58 public boolean isLegendToHide() 78 59 { 79 return _l ineAttribute;60 return _legendToHide; 80 61 } 81 62 82 public void setL ineAttribute( @NotNull final LineAttribute lineAttribute )63 public void setLegendToHide( final boolean legendToHide ) 83 64 { 84 _l ineAttribute = lineAttribute;65 _legendToHide = legendToHide; 85 66 } 86 87 @NotNull88 public Page getPage()89 {90 return _page;91 }92 93 public void setPage( @NotNull final Page page )94 {95 _page = page;96 }97 98 @NotNull99 public PanelModel getPanelModel()100 {101 return _panelModel;102 }103 104 public void setPanelModel( @NotNull final PanelModel panelModel )105 {106 _panelModel = panelModel;107 }108 109 @NotNull110 public DataModel getDataModel()111 {112 return _dataModel;113 }114 115 public void setDataModel( @NotNull final DataModel dataModel )116 {117 _dataModel = dataModel;118 }119 120 @NotNull121 public JPanel getjPanel()122 {123 return _jPanel;124 }125 126 public void setjPanel( @NotNull final JPanel jPanel )127 {128 _jPanel = jPanel;129 }130 131 @Nullable132 public Integer getWidth()133 {134 return _width;135 }136 137 public void setWidth( @Nullable final Integer width )138 {139 _width = width;140 }141 142 @Nullable143 public Integer getHeight()144 {145 return _height;146 }147 148 public void setHeight( @Nullable final Integer height )149 {150 _height = height;151 }152 153 /**154 * Instantiate the three primary SGT Bean objects.155 * Page - Main SGT JavaBean used with PanelModel and DataModel to156 * create a graphic.157 * <p/>158 * PanelModel - A model that supports the Panel structure of a plot.159 * DataModel - A model that supplies the relationship between SGTData objects,160 * its Attribute and the Panel and DataGroup in which it is161 * displayed and the Legend.162 * JPanel - The JPanel that will be used to contain the graphic.163 */164 165 /**166 * PanelModel corresponds to the file "megapoli.xml"167 * PanelHolder corresponds to one of the Panels from "panelList" described in the PanelModel168 * contains positions of labels, legends, title, etc..169 */170 171 @NotNull172 private Page _page = new Page();173 @NotNull174 private PanelModel _panelModel = new PanelModel();175 @NotNull176 private DataModel _dataModel = new DataModel();177 @NotNull178 private JPanel _jPanel = new JPanel( new BorderLayout() );179 67 180 68 @Nullable … … 183 71 private SimpleLine _data; 184 72 @NotNull 185 private LineAttribute _lineAttribute = new LineAttribute( LineAttribute.SOLID, Color.red );186 @Nullable187 private Integer _width;188 @Nullable189 private Integer _height;190 @NotNull191 73 private String _logoMegapoli = MegapoliInitialisation.pathImages + "/logo_Megapoli.png"; 192 74 @NotNull 193 75 private String _logoEther = MegapoliInitialisation.pathImages + "/logo_Ether.jpg"; 194 195 196 // Labels used in the megapoli.xml 197 public static final String FILE_NAME = "megapoli.xml"; 198 public static final String PANEL_GRAPH = "Panel_graph"; 199 public static final String PANEL_IMAGE = "Panel_image"; 200 public static final String DATA_GROUP = "DataGroup"; 201 public static final String LABEL_TITLE = "Label_title"; 202 public static final String LABEL_LOGO_MEGAPOLI = "Label_logoMegapoli"; 203 public static final String LABEL_LOGO_ETHER = "Label_logoEther"; 204 public static final String LEGEND = "Legend"; 76 private boolean _legendToHide = true; 205 77 } -
ether_megapoli/trunk/service/interface/com/ether/EtherPlotService.java
r130 r132 23 23 24 24 @NotNull 25 public JPane createCenterPane( @NotNull final SGTData data);25 public JPane createCenterPane( @NotNull final MegapoliPlot megapoliPlot, @NotNull final Integer maxWidth, @NotNull final Integer maxHeight ); 26 26 27 27 @NotNull … … 29 29 30 30 @NotNull 31 public BufferedImage createErrorPane( @NotNull final String mainError, @N otNullfinal String errorText, @Nullable final Locale locale );31 public BufferedImage createErrorPane( @NotNull final String mainError, @Nullable final String errorText, @Nullable final Locale locale ); 32 32 } -
ether_megapoli/trunk/web/src/ApplicationResources.properties
r130 r132 438 438 plot.errorMessage=Erreur de cr\u00E9ation du quicklook. <BR>Veuillez essayer de corriger les erreurs suivantes ou contacter l'administrateur en indiquant les erreurs rencontr\u00E9es. 439 439 plot.noData=Aucune donn\u00E9e extraite 440 plot.latitude=Latitude 441 plot.longitude=Longitude 442 plot.degres=Degr\u00E9s -
ether_megapoli/trunk/web/src/ApplicationResources_en.properties
r130 r132 425 425 plot.errorMessage=Error creating the quicklook. <BR>Please try to correct the following errors or contact the administrator with the detected errors. 426 426 plot.noData=No extracted data 427 plot.latitude=Latitude 428 plot.longitude=Longitude 429 plot.degres=Degrees -
ether_megapoli/trunk/web/src/com/ether/Controller.java
r130 r132 6 6 import com.medias.database.objects.Parametre; 7 7 import com.medias.database.objects.Plateforme; 8 import com.medias.database.objects.TypePlateforme; 8 9 import net.sf.json.JSONObject; 9 10 import org.apache.commons.logging.Log; … … 50 51 throws ServiceException 51 52 { 52 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 ); 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 final TypePlateforme type = new TypePlateforme( ); 59 type.setTypePlateformeNom( "MOBILE" ); 60 pf.setTypePlateforme( type ); 61 plateforms.add( pf ); 62 63 final Plateforme pf2 = new Plateforme(); 64 pf2.setPlateformeId( 2 ); 65 pf2.setPlateformeNom( "SIRTA" ); 66 final TypePlateforme type2 = new TypePlateforme( ); 67 type2.setTypePlateformeNom( "FIXED" ); 68 pf2.setTypePlateforme( type2 ); 69 plateforms.add( pf2 ); 62 70 63 71 final Map<String, Object> model = new HashMap<String, Object>(); 64 72 model.put( "plateforms", getJsonHelper().toJSON( plateforms ) ); 65 model.put( "axeTypes", getJSONAxeTypes() ); 73 model.put( "axeTypesForFixedPlateforms", getJSONAxeTypesForFixedPlateforms() ); 74 model.put( "axeTypesForMobilePlateforms", getJSONAxeTypesForMobilePlateforms() ); 66 75 return model; 67 76 } … … 77 86 { 78 87 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 );88 88 89 89 final JSONObject result = new JSONObject(); … … 92 92 } 93 93 94 @ControllerMethod(jsonResult = true) 95 private List<JSONObject> getJSONAxeTypes() 94 private List<JSONObject> getJSONAxeTypesForFixedPlateforms() 96 95 { 97 final AxeType [] axeTypes = AxeType.values();96 final AxeTypeForFixedPlateform[] axeTypes = AxeTypeForFixedPlateform.values(); 98 97 99 98 final List<JSONObject> jsonAxeTypes = new ArrayList<JSONObject>( axeTypes.length ); 100 99 101 for( final AxeType axeType : axeTypes ) 100 for( final AxeTypeForFixedPlateform axeType : axeTypes ) 101 { 102 final JSONObject jsonAxeType = new JSONObject(); 103 jsonAxeType.put( "text", axeType.name() ); 104 jsonAxeType.put( "value", axeType.name() ); 105 jsonAxeTypes.add( jsonAxeType ); 106 } 107 return jsonAxeTypes; 108 } 109 110 private List<JSONObject> getJSONAxeTypesForMobilePlateforms() 111 { 112 final AxeTypeForMobilePlateform[] axeTypes = AxeTypeForMobilePlateform.values(); 113 114 final List<JSONObject> jsonAxeTypes = new ArrayList<JSONObject>( axeTypes.length ); 115 116 for( final AxeTypeForMobilePlateform axeType : axeTypes ) 102 117 { 103 118 final JSONObject jsonAxeType = new JSONObject(); -
ether_megapoli/trunk/web/src/com/ether/ControllerPlot.java
r130 r132 2 2 3 3 import com.medias.Context; 4 import com.medias.database.objects.Parametre; 5 import com.medias.database.objects.Unite; 4 6 import gov.noaa.pmel.sgt.dm.SGTMetaData; 5 7 import gov.noaa.pmel.sgt.dm.SimpleLine; … … 24 26 import java.util.Date; 25 27 import java.util.List; 28 import java.util.Locale; 29 import java.util.ResourceBundle; 26 30 27 31 /** … … 109 113 //** ******************************************************************** **// 110 114 111 112 final SimpleLine data = new SimpleLine( dateArray, dataArray, "legend" ); 113 SGTMetaData meta = new SGTMetaData( "Longitude", "degrees East", false, false ); 114 data.setXMetaData( meta ); 115 116 meta = new SGTMetaData( "parameterName", "parameterUnit", false, false ); 117 data.setYMetaData( meta ); 115 final Parametre parametre = _etherService.getParameterById( parameterId ); 116 117 // final Parametre parametre = new Parametre(); 118 // parametre.setParametreNom( "Ozone" ); 119 // final Unite unit = new Unite(); 120 // unit.setUniteCode( "ppb" ); 121 // parametre.setUnite( unit ); 122 if( null == parametre ) 123 { 124 createErrorPane( response, request, WebException.WebCode.PARAMETER_IS_NULL.toString(), null ); 125 flagException = true; 126 throw new ServletException( WebException.WebCode.PARAMETER_IS_NULL.toString(), null ); 127 } 128 129 130 final SimpleLine data; 131 if( AxeTypeForFixedPlateform.TIME.name().equals( axeType ) ) 132 data = createTimeSerie( dateArray, dataArray, parametre.getParametreNom(), parametre.getUnite() ); 133 else 134 data = createLatitudeSerie( dataArray, dataArray, parametre.getParametreNom(), Context.getLocale( request ) ); 118 135 119 136 final MegapoliPlot megapoliPlot = new MegapoliPlot(); 120 137 megapoliPlot.setTitle( title ); 121 138 megapoliPlot.setData( data ); 139 megapoliPlot.setLegendToHide( null == data.getTitle() ); 122 140 123 141 final BufferedImage bufferedImage = _etherPlotService.createMainPane( megapoliPlot, Context.getLocale( request ) ); … … 138 156 } 139 157 140 private void createErrorPane( final HttpServletResponse response, final HttpServletRequest request, @NotNull final String mainError, @NotNull final Exception e ) 158 private SimpleLine createTimeSerie( @NotNull final GeoDateArray dateArray, @NotNull final double[] dataArray, @Nullable final String parameterName, @Nullable final Unite unit ) 159 { 160 final SimpleLine data = new SimpleLine( dateArray, dataArray, null ); 161 SGTMetaData meta = new SGTMetaData( null, null, false, false ); 162 data.setXMetaData( meta ); 163 164 meta = new SGTMetaData( parameterName, unit.getUniteCode(), false, false ); 165 data.setYMetaData( meta ); 166 return data; 167 } 168 169 private SimpleLine createLatitudeSerie( @NotNull final double[] dateArray, @NotNull final double[] dataArray, @Nullable final String legend, @Nullable final Locale locale ) 170 { 171 final ResourceBundle bundle = WebHelper.getBundle( locale ); 172 173 final SimpleLine data = new SimpleLine( dateArray, dataArray, legend ); 174 SGTMetaData meta = new SGTMetaData( bundle.getString( "plot.longitude" ), bundle.getString( "plot.degres" ), false, true ); 175 // TODO : vérifier modulo = 360 176 // meta.setModuloValue( 360 ); 177 data.setXMetaData( meta ); 178 179 meta = new SGTMetaData( bundle.getString( "plot.latitude" ), bundle.getString( "plot.degres" ), false, true ); 180 // TODO : vérifier modulo = 360 181 // meta.setModuloValue( 360 ); 182 data.setYMetaData( meta ); 183 return data; 184 } 185 186 private void createErrorPane( final HttpServletResponse response, final HttpServletRequest request, @NotNull final String mainError, @Nullable final Exception e ) 141 187 throws IOException 142 188 { 143 final BufferedImage errorImage = _etherPlotService.createErrorPane( mainError, e.toString(), Context.getLocale( request ) ); 189 final BufferedImage errorImage; 190 if( null != e ) 191 errorImage = _etherPlotService.createErrorPane( mainError, e.toString(), Context.getLocale( request ) ); 192 else 193 errorImage = _etherPlotService.createErrorPane( mainError, null, Context.getLocale( request ) ); 194 144 195 ImageIO.write( errorImage, "png", response.getOutputStream() ); 145 196 } -
ether_megapoli/trunk/web/src/com/ether/WebException.java
r130 r132 34 34 ERROR_NUMBER_OF_PARAM_TYPES_NOT_EQUAL_TO_PARAM_ANNOTATIONS, 35 35 INVALID_DATE, 36 PARAMETER_IS_NULL, 36 37 } 37 38 } -
ether_megapoli/trunk/web/src/json/serializers/PlateformJsonSerializer.java
r89 r132 5 5 import net.sf.json.JsonConfig; 6 6 7 public class PlateformJsonSerializer extends AbstractJsonSerializer<Plateforme> 7 public class PlateformJsonSerializer 8 extends AbstractJsonSerializer<Plateforme> 8 9 { 9 10 public JSONObject process( final Plateforme plateform, final JsonConfig jsonConfig ) … … 13 14 serialize( result, "id", plateform.getPlateformeId(), jsonConfig ); 14 15 serialize( result, "name", plateform.getPlateformeNom(), jsonConfig ); 16 serialize( result, "type", plateform.getTypePlateforme().getTypePlateformeNom(), jsonConfig ); 15 17 16 18 return result; -
ether_megapoli/trunk/web/visualization/visu_parameter_by_pf-script.jsp
r130 r132 1 <%@ page import="com.ether.EtherPlotServiceImpl" %> 1 2 <script type="text/javascript"> 2 3 var InterfaceVisualization = Class.create( { 3 4 4 initialize: function( jsonPlateforms, axeTypes )5 initialize: function( jsonPlateforms, axeTypesForFixedPlateforms, axeTypesForMobilePlateforms ) 5 6 { 6 7 // Values … … 11 12 this.generalContainerOptions = $( "generalContainerOptions" ); 12 13 this.jsonPlateforms = jsonPlateforms || null; 13 this.jsonAxeTypes = axeTypes || null; 14 this.jsonAxeTypesForFixedPlateforms = axeTypesForFixedPlateforms || null; 15 this.jsonAxeTypesForMobilePlateforms = axeTypesForMobilePlateforms || null; 14 16 this.selectedPlateform = false; 15 17 this.selectedParameter = false; … … 89 91 paramSelect.parent = $( "containerOptionAxe" ); 90 92 this.selectAxes = new Select( paramSelect ); 91 92 this.jsonAxeTypes.each( function ( axeType )93 {94 this.selectAxes.add( axeType.value, interfaceTexts[axeType.text] );95 }.bind( this ) );96 97 this.selectAxes.selectFirst( false );98 93 }, 99 94 … … 160 155 if( this.selectedParameter ) 161 156 this.selectedParameter = false; 157 158 // Change plateformType's select 159 this.updateListAxes(); 162 160 163 161 $( "textareaTitle" ).value = this.selectedPlateform.getName(); … … 219 217 // + "&axeType=" + this.selectAxes.getValue(); 220 218 221 var url = "visualization/plotEther?plateformId= 33"222 + "¶meterId=1 0"219 var url = "visualization/plotEther?plateformId=14" 220 + "¶meterId=125" 223 221 + "&dateBegin=" + this.beginDate 224 222 + "&dateEnd=" + this.endDate … … 227 225 228 226 this.plotWindow.getContent().innerHTML = '<img src=' + url + ' />'; 229 // this.plotWindow.setSize( this.plotWindow.getContent().firstChild.width, this.plotWindow.getContent().firstChild.height, true ); 230 this.plotWindow.setSize( 800, 700 ); 227 this.plotWindow.setSize( <%=EtherPlotServiceImpl.getMaxWidth()%>, <%=EtherPlotServiceImpl.getMaxHeight()%> ); 231 228 this.plotWindow.show(); 232 // this.plotWindow.height = this.plotWindow.getContent().firstChild.height;233 // this.plotWindow.width = this.plotWindow.getContent().firstChild.width;234 229 }, 235 230 … … 281 276 this.visualizeButton.enable(); 282 277 this.downloadButton.enable(); 278 }, 279 280 updateListAxes: function() 281 { 282 this.selectAxes.clear(); 283 var jsonAxeTypes; 284 285 if( "MOBILE" == this.selectedPlateform.jsonElement.type ) 286 jsonAxeTypes = this.jsonAxeTypesForMobilePlateforms; 287 else 288 jsonAxeTypes = this.jsonAxeTypesForFixedPlateforms; 289 290 jsonAxeTypes.each( function ( axeType ) 291 { 292 this.selectAxes.add( axeType.value, interfaceTexts[axeType.text] ); 293 }.bind( this ) ); 294 295 this.selectAxes.selectFirst( false ); 283 296 } 284 297 -
ether_megapoli/trunk/web/visualization/visu_parameter_by_pf.jsp
r130 r132 1 1 <!-- /*** ****************** VISU ******************** **/ --> 2 2 <%@ page import="com.medias.Context" %> 3 <%@ page import="com.ether.AxeType" %> 3 <%@ page import="com.ether.AxeTypeForFixedPlateform" %> 4 <%@ page import="com.ether.AxeTypeForMobilePlateform" %> 4 5 5 6 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> … … 25 26 <ether:htmlCss cssFile="windows_js_1.3/themes/mac_os_x"/> 26 27 27 <%-- Select --%>28 <%--ether:htmlCss cssFile="customedSelect/css/customSelect" /--%>29 28 </tiles:put> 30 29 … … 46 45 <ether:htmlJs jsFile="windows_js_1.3/javascripts/window_ext"/> 47 46 48 <%-- Select --%>49 <%--ether:htmlJs jsFile="customedSelect/js/customSelect"/--%>50 47 </tiles:put> 51 48 … … 61 58 <tiles:put name="body" type="string"> 62 59 63 <div class="span-2 4">60 <div class="span-25"> 64 61 <div id="generalContainerPlateforms" class="span-7 colborder"> 65 62 <div id="messages"><bean:message key="data.visualization.selectPf"/></div> … … 74 71 </div> 75 72 76 <div id="generalContainerOptions" class="span- 9last">77 <div id="containerOptionCalendar" class="span- 9">73 <div id="generalContainerOptions" class="span-10 last"> 74 <div id="containerOptionCalendar" class="span-10"> 78 75 <div id="messages" class="messagesHeight"><bean:message key="data.visualization.selectPeriod"/></div> 79 76 <input type="text" id="beginDate" size="15"/> … … 119 116 interfaceTexts["data.visualization.selectMinute"] = "<bean:message key="data.visualization.selectMinute"/>"; 120 117 121 interfaceTexts["<%=AxeType .TIME%>"] = "<bean:message key="data.visualization.axeType.Time"/>";122 interfaceTexts["<%=AxeType .LATITUDE%>"] = "<bean:message key="data.visualization.axeType.Latitude"/>";118 interfaceTexts["<%=AxeTypeForFixedPlateform.TIME%>"] = "<bean:message key="data.visualization.axeType.Time"/>"; 119 interfaceTexts["<%=AxeTypeForMobilePlateform.LATITUDE%>"] = "<bean:message key="data.visualization.axeType.Latitude"/>"; 123 120 124 var interfaceVisualization = new InterfaceVisualization( ${plateforms}, ${axeTypes } );121 var interfaceVisualization = new InterfaceVisualization( ${plateforms}, ${axeTypesForFixedPlateforms}, ${axeTypesForMobilePlateforms} ); 125 122 </script> 126 123
Note: See TracChangeset
for help on using the changeset viewer.