Changeset 178 for ether_megapoli
- Timestamp:
- 09/06/11 13:51:18 (13 years ago)
- Location:
- ether_megapoli/trunk
- Files:
-
- 5 added
- 2 deleted
- 11 edited
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/applets/src/com/ether/AppletPlot.java
r174 r178 1 import gov.noaa.pmel.sgt.AbstractPane; 2 import gov.noaa.pmel.sgt.CartesianGraph; 3 import gov.noaa.pmel.sgt.CartesianRenderer; 1 package com.ether; 2 3 import com.medias.database.objects.Parametre; 4 import com.medias.database.objects.Unite; 4 5 import gov.noaa.pmel.sgt.ColorMap; 5 6 import gov.noaa.pmel.sgt.ContourLevels; 6 7 import gov.noaa.pmel.sgt.GridAttribute; 7 import gov.noaa.pmel.sgt.GridCartesianRenderer;8 8 import gov.noaa.pmel.sgt.IndexedColorMap; 9 9 import gov.noaa.pmel.sgt.JPane; … … 11 11 import gov.noaa.pmel.sgt.demo.TestData; 12 12 import gov.noaa.pmel.sgt.dm.SGTData; 13 import gov.noaa.pmel.sgt.swing.JClassTree;14 13 import gov.noaa.pmel.sgt.swing.JPlotLayout; 15 import gov.noaa.pmel.sgt.swing.prop.GridAttributeDialog;16 import gov.noaa.pmel.util.Debug;17 import gov.noaa.pmel.util.Dimension2D;18 14 import gov.noaa.pmel.util.Range2D; 19 import gov.noaa.pmel.util.Rectangle2D; 15 import org.jetbrains.annotations.NotNull; 16 import org.jetbrains.annotations.Nullable; 17 import org.springframework.context.support.ClassPathXmlApplicationContext; 20 18 21 19 import javax.swing.*; … … 23 21 import java.awt.event.ActionEvent; 24 22 import java.awt.print.PageFormat; 25 import java.awt.print.PrinterException;26 23 import java.awt.print.PrinterJob; 24 import java.util.Calendar; 25 import java.util.Date; 26 import java.util.Locale; 27 27 28 28 … … 30 30 extends JApplet 31 31 { 32 static JPlotLayout rpl_;33 private GridAttribute gridAttr_;34 JButton edit_;35 JButton space_ = null;36 JButton tree_;37 JButton print_;38 JButton layout_;39 PageFormat pageFormat = PrinterJob.getPrinterJob().defaultPage();40 41 32 public void init() 42 33 { 43 /* 44 * Create the demo in the JApplet environment. 45 */ 46 getContentPane().setLayout( new BorderLayout( 0, 0 ) ); 47 setBackground( java.awt.Color.white ); 48 setSize( 600, 550 ); 49 JPanel main = new JPanel(); 50 rpl_ = makeGraph(); 51 JPanel button = makeButtonPanel( false ); 52 rpl_.setBatch( true ); 53 main.add( rpl_, BorderLayout.CENTER ); 54 JPane gridKeyPane = rpl_.getKeyPane(); 55 gridKeyPane.setSize( new Dimension( 600, 100 ) ); 56 main.add( gridKeyPane, BorderLayout.SOUTH ); 57 getContentPane().add( main, "Center" ); 58 getContentPane().add( button, "South" ); 59 rpl_.setBatch( false ); 60 34 String app_context1 = "classpath:dao-context.xml"; 35 String app_context2 = "classpath:service-context.xml"; 36 String app_context3 = "classpath:hibernate.cfg.xml"; 37 String[] contextPaths = new String[]{app_context1, app_context2, app_context3}; 38 39 final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( contextPaths ); 40 _etherService = (EtherService) context.getBean( "etherService", EtherService.class ); 41 _etherPlotService = (EtherPlotService) context.getBean( "etherPlotService", EtherPlotService.class ); 42 43 // final String appletContext = "applet-context.xml"; 44 // final String hibernateContext = "hibernate.cfg.xml"; 45 // final String[] contextPaths = new String[]{appletContext, hibernateContext}; 46 // 47 // final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( contextPaths ); 48 // _etherService = (EtherService) context.getBean( "etherService", EtherService.class ); 49 // _etherPlotService = (EtherPlotService) context.getBean( "etherPlotService", EtherPlotService.class ); 50 51 _locale = new Locale( "fr" ); 52 _plateformId = 14; 53 _parameterId = 90; 54 _title = "Applet de merd...."; 55 _axeType = AxeTypeForFixedPlateform.TIME_LINE.toString(); 56 _dateBegin = null; 57 _dateEnd = null; 58 59 _maxWidth = EtherPlotServiceImpl.getMaxWidth(); 60 _maxHeight = EtherPlotServiceImpl.getMaxHeight(); 61 62 // final Integer plateformId = Integer.valueOf( getParameter( "plateformId" ) ); 63 // final Integer parameterId = Integer.valueOf( getParameter( "parameterId" ) ); 64 // final String title = getParameter( "title" ); 65 // final String axeType = getParameter( "axeType" ); 66 // final String dateBegin = getParameter( "dateBegin" ); 67 // final String dateEnd = getParameter( "dateEnd" ); 68 // final String locale = getParameter( "locale" ); 69 } 70 71 public void start() 72 { 73 // Create megapoliPlot 74 final MegapoliPlot megapoliPlot = createMegapoliPlot(); 75 76 // Create graph 77 setLayout( new BorderLayout( 0, 0 ) ); 78 setBackground( Color.WHITE ); 79 // setSize( _maxWidth, _maxHeight ); 80 setSize( 800, 800 ); 81 82 // Top Pane 83 final JPane jPaneTop = _etherPlotService.createTopPane( megapoliPlot ); 84 add( jPaneTop, BorderLayout.NORTH ); 85 86 final Integer valuesNumber = megapoliPlot.getValuesNumber(); 87 88 // Bottom Pane 89 final JPane jPaneBottom = _etherPlotService.createBottomPane( valuesNumber, _locale ); 90 add( jPaneBottom, BorderLayout.PAGE_END ); 91 92 // Actions Panel 93 final JPanel jPanelControl = _etherPlotService.createControlPanel(); 94 // add( jPanelControl, BorderLayout.SOUTH ); 95 96 // Graph Pane 97 // final JPane jPaneGraph = _etherPlotService.createTimeSeriePlot( megapoliPlot ); 98 final JPane jPaneGraph = makeGraph(); 99 add( jPaneGraph, BorderLayout.CENTER ); 100 101 102 // JPanel main = new JPanel(); 103 // rpl_ = makeGraph(); 104 // JPanel button = makeButtonPanel( false ); 105 // rpl_.setBatch( true ); 106 // main.add( rpl_, BorderLayout.CENTER ); 107 // JPane gridKeyPane = rpl_.getKeyPane(); 108 // gridKeyPane.setSize( new Dimension( 600, 100 ) ); 109 // main.add( gridKeyPane, BorderLayout.SOUTH ); 110 // getContentPane().add( main, "Center" ); 111 // getContentPane().add( button, "South" ); 112 // rpl_.setBatch( false ); 61 113 } 62 114 … … 90 142 } 91 143 92 public static void main( String[] args )93 {94 /*95 * Create the demo as an application96 */97 AppletPlot gd = new AppletPlot();98 /*99 * Create a new JFrame to contain the demo.100 */101 JFrame frame = new JFrame( "Grid Demo" );102 JPanel main = new JPanel();103 main.setLayout( new BorderLayout() );104 frame.setSize( 600, 500 );105 frame.getContentPane().setLayout( new BorderLayout() );106 /*107 * Listen for windowClosing events and dispose of JFrame108 */109 frame.addWindowListener( new java.awt.event.WindowAdapter()110 {111 public void windowClosing( java.awt.event.WindowEvent event )112 {113 JFrame fr = (JFrame) event.getSource();114 fr.setVisible( false );115 fr.dispose();116 System.exit( 0 );117 }118 119 public void windowOpened( java.awt.event.WindowEvent event )120 {121 rpl_.getKeyPane().draw();122 }123 } );124 /*125 * Create button panel with "mark" button126 */127 JPanel button = gd.makeButtonPanel( true );128 /*129 * Create JPlotLayout and turn batching on. With batching on the130 * plot will not be updated as components are modified or added to131 * the plot tree.132 */133 rpl_ = gd.makeGraph();134 rpl_.setBatch( true );135 /*136 * Layout the plot, key, and buttons.137 */138 main.add( rpl_, BorderLayout.CENTER );139 JPane gridKeyPane = rpl_.getKeyPane();140 gridKeyPane.setBatch( true ); // new line141 gridKeyPane.setSize( new Dimension( 600, 100 ) );142 rpl_.setKeyLayerSizeP( new Dimension2D( 6.0, 1.0 ) );143 rpl_.setKeyBoundsP( new Rectangle2D.Double( 0.0, 1.0, 6.0, 1.0 ) );144 main.add( gridKeyPane, BorderLayout.SOUTH );145 frame.getContentPane().add( main, BorderLayout.CENTER );146 frame.getContentPane().add( button, BorderLayout.SOUTH );147 148 JPanel foo = null;149 JPanel bar = null;150 JButton foobutton = null;151 JButton barbutton = null;152 153 /* JPanel foo = new JPanel();154 foo.setLayout(new BorderLayout());155 JButton foobutton = new JButton("my foo button");156 foo.add(foobutton, BorderLayout.CENTER);157 foo.setMaximumSize(new Dimension(700, 100));158 foo.setMinimumSize(new Dimension(600, 100));159 foo.setPreferredSize(new Dimension(600, 100));160 frame.getContentPane().add(foo, BorderLayout.NORTH);161 JPanel bar = new JPanel();162 bar.setLayout(new BorderLayout());163 JButton barbutton = new JButton("my bar button");164 bar.add(barbutton, BorderLayout.CENTER);165 bar.setMaximumSize(new Dimension(150, 2000));166 bar.setMinimumSize(new Dimension(150, 100));167 bar.setPreferredSize(new Dimension(150, 200));168 frame.getContentPane().add(bar, BorderLayout.WEST); */169 170 frame.pack();171 frame.setVisible( true );172 /*173 * Turn batching off. JPlotLayout will redraw if it has been174 * modified since batching was turned on.175 */176 gridKeyPane.setBatch( false ); // new line177 rpl_.setBatch( false );178 179 if( Debug.DEBUG )180 {181 System.out.println( "Locations:" );182 System.out.println( " foo = " + foo.getLocation() );183 System.out.println( " foobutton = " + foobutton.getLocation() );184 System.out.println( " bar = " + bar.getLocation() );185 System.out.println( " barbutton = " + barbutton.getLocation() );186 System.out.println( " main = " + main.getLocation() );187 System.out.println( " rpl_ = " + rpl_.getLocation() );188 System.out.println( " gridKeyPane = " + gridKeyPane.getLocation() );189 System.out.println( " button = " + button.getLocation() );190 System.out.println( " print_ = " + gd.print_.getLocation() );191 System.out.println( " space_ = " + gd.space_.getLocation() );192 System.out.println( " tree_ = " + gd.tree_.getLocation() );193 System.out.println( " edit_ = " + gd.edit_.getLocation() );194 }195 }196 197 144 void edit_actionPerformed( java.awt.event.ActionEvent e ) 198 145 { … … 200 147 * Create a GridAttributeDialog and set the renderer. 201 148 */ 202 GridAttributeDialog gad = new GridAttributeDialog();203 gad.setJPane( rpl_ );204 CartesianRenderer rend = ( (CartesianGraph) rpl_.getFirstLayer().getGraph() ).getRenderer();205 gad.setGridCartesianRenderer( (GridCartesianRenderer) rend );206 // gad.setGridAttribute(gridAttr_);207 gad.setVisible( true );149 // GridAttributeDialog gad = new GridAttributeDialog(); 150 // gad.setJPane( rpl_ ); 151 // CartesianRenderer rend = ( (CartesianGraph) rpl_.getFirstLayer().getGraph() ).getRenderer(); 152 // gad.setGridCartesianRenderer( (GridCartesianRenderer) rend ); 153 // gad.setGridAttribute( gridAttr_ ); 154 // gad.setVisible( true ); 208 155 } 209 156 … … 213 160 * Create a JClassTree for the JPlotLayout objects 214 161 */ 215 JClassTree ct = new JClassTree();216 ct.setModal( false );217 ct.setJPane( rpl_ );218 ct.show();162 // JClassTree ct = new JClassTree(); 163 // ct.setModal( false ); 164 // ct.setJPane( rpl_ ); 165 // ct.show(); 219 166 } 220 167 221 168 void print_actionPerformed( ActionEvent e ) 222 169 { 223 Color saveColor; 224 225 PrinterJob printJob = PrinterJob.getPrinterJob(); 226 printJob.setPrintable( rpl_, pageFormat ); 227 printJob.setJobName( "Grid Demo" ); 228 if( printJob.printDialog() ) 229 { 230 try 231 { 232 saveColor = rpl_.getBackground(); 233 if( !saveColor.equals( Color.white ) ) 234 { 235 rpl_.setBackground( Color.white ); 236 } 237 rpl_.setPageAlign( AbstractPane.TOP, 238 AbstractPane.CENTER ); 239 RepaintManager currentManager = RepaintManager.currentManager( rpl_ ); 240 currentManager.setDoubleBufferingEnabled( false ); 241 printJob.print(); 242 currentManager.setDoubleBufferingEnabled( true ); 243 rpl_.setBackground( saveColor ); 244 } 245 catch( PrinterException pe ) 246 { 247 System.out.println( "Error printing: " + pe ); 248 } 249 } 250 170 // Color saveColor; 171 // 172 // PrinterJob printJob = PrinterJob.getPrinterJob(); 173 // printJob.setPrintable( rpl_, pageFormat ); 174 // printJob.setJobName( "Grid Demo" ); 175 // if( printJob.printDialog() ) 176 // { 177 // try 178 // { 179 // saveColor = rpl_.getBackground(); 180 // if( !saveColor.equals( Color.white ) ) 181 // { 182 // rpl_.setBackground( Color.white ); 183 // } 184 // rpl_.setPageAlign( AbstractPane.TOP, 185 // AbstractPane.CENTER ); 186 // RepaintManager currentManager = RepaintManager.currentManager( rpl_ ); 187 // currentManager.setDoubleBufferingEnabled( false ); 188 // printJob.print(); 189 // currentManager.setDoubleBufferingEnabled( true ); 190 // rpl_.setBackground( saveColor ); 191 // } 192 // catch( PrinterException pe ) 193 // { 194 // System.out.println( "Error printing: " + pe ); 195 // } 196 // } 251 197 } 252 198 … … 291 237 Range2D datar = new Range2D( -20.0f, 45.0f, 5.0f ); 292 238 clevels = ContourLevels.getDefault( datar ); 293 gridAttr_ = new GridAttribute( clevels );239 GridAttribute gridAttr_ = new GridAttribute( clevels ); 294 240 /* 295 241 * Create a ColorMap and change the style to RASTER_CONTOUR. … … 360 306 } 361 307 308 private MegapoliPlot createMegapoliPlot() 309 { 310 final Calendar calendar = Calendar.getInstance(); 311 Date formatedDateBegin = null; 312 Date formatedDateEnd = null; 313 if( null != _dateBegin && null != _dateEnd && !"false".equals( _dateBegin ) && !"false".equals( _dateEnd ) ) 314 try 315 { 316 calendar.setTimeInMillis( Long.valueOf( _dateBegin ) ); 317 formatedDateBegin = calendar.getTime(); 318 calendar.setTimeInMillis( Long.valueOf( _dateEnd ) ); 319 formatedDateEnd = calendar.getTime(); 320 } 321 catch( Exception e ) 322 { 323 // TODO : gérer fenêtre d'erreur 324 // createErrorPane( response, request, WebException.WebCode.INVALID_DATE.toString(), e ); 325 // flagException = true; 326 // throw new ServletException( WebException.WebCode.INVALID_DATE.toString(), e ); 327 } 328 329 // Parameter 330 // final Parametre parametre = _etherService.getParameterById( parameterId ); 331 final Parametre parametre = new Parametre(); 332 parametre.setParametreNom( "Ozone" ); 333 final Unite unit = new Unite(); 334 unit.setUniteCode( "ppb" ); 335 parametre.setUnite( unit ); 336 if( null == parametre ) 337 { 338 // TODO : gérer fenêtre d'erreur 339 // createErrorPane( response, request, WebException.WebCode.PARAMETER_IS_NULL.toString(), null ); 340 // flagException = true; 341 // throw new ServletException( WebException.WebCode.PARAMETER_IS_NULL.toString(), null ); 342 } 343 344 // Create plot 345 final MegapoliPlot megapoliPlot = new MegapoliPlot(); 346 megapoliPlot.setTitle( _title ); 347 megapoliPlot.setAxeType( _axeType ); 348 megapoliPlot.setParameterName( parametre.getParametreNom() ); 349 if( null != parametre.getUnite() && null != parametre.getUnite().getUniteCode() ) 350 megapoliPlot.setParameterUnitCode( parametre.getUnite().getUniteCode() ); 351 352 353 if( AxeTypeForFixedPlateform.TIME_LINE.name().equals( _axeType ) || AxeTypeForFixedPlateform.TIME_POINTS.name().equals( _axeType ) ) 354 { 355 // final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodForTimeSerie( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 356 final double[] values = new double[50]; 357 final Date[] dates = new Date[50]; 358 final Calendar cal = Calendar.getInstance(); 359 360 for( int i = 0; i < 50; i++ ) 361 { 362 values[i] = (double) i; 363 cal.set( Calendar.MINUTE, 5 * i ); 364 dates[i] = cal.getTime(); 365 } 366 final Data valuesLists = new Data( values, dates ); 367 368 megapoliPlot.setData( valuesLists ); 369 370 megapoliPlot.setTimeSerie( true ); 371 megapoliPlot.setLegendToHide( true ); 372 megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 373 } 374 else 375 { 376 // final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodFor2D( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 377 final double[] latitudeValues = new double[50]; 378 final double[] longitudeValues = new double[50]; 379 final double[] parameterValues = new double[50]; 380 381 for( int i = 0; i < 50; i++ ) 382 { 383 parameterValues[i] = Math.random() * i; 384 latitudeValues[i] = Math.random() * i; 385 longitudeValues[i] = Math.random() * i; 386 } 387 final Data valuesLists = new Data( parameterValues, latitudeValues, longitudeValues ); 388 389 megapoliPlot.setData( valuesLists ); 390 391 megapoliPlot.setTimeSerie( false ); 392 megapoliPlot.setLegendToHide( false ); 393 megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 394 } 395 return megapoliPlot; 396 } 397 362 398 class MyAction 363 399 implements java.awt.event.ActionListener … … 388 424 } 389 425 } 426 427 // static JPlotLayout rpl_; 428 JButton edit_; 429 JButton space_ = null; 430 JButton tree_; 431 JButton print_; 432 JButton layout_; 433 PageFormat pageFormat = PrinterJob.getPrinterJob().defaultPage(); 434 // private GridAttribute gridAttr_; 435 436 437 private EtherService _etherService; 438 private EtherPlotService _etherPlotService; 439 @NotNull 440 private Locale _locale; 441 @NotNull 442 private Integer _plateformId; 443 @NotNull 444 private Integer _parameterId; 445 @Nullable 446 private String _title; 447 @NotNull 448 private String _axeType; 449 @Nullable 450 private String _dateBegin; 451 @Nullable 452 private String _dateEnd; 453 @NotNull 454 private Integer _maxWidth; 455 @NotNull 456 private Integer _maxHeight; 390 457 } -
ether_megapoli/trunk/applets/src/com/ether/AppletTemp.java
r174 r178 1 import gov.noaa.pmel.sgt.AbstractPane; 2 import gov.noaa.pmel.sgt.CartesianGraph; 3 import gov.noaa.pmel.sgt.CartesianRenderer; 4 import gov.noaa.pmel.sgt.ColorMap; 5 import gov.noaa.pmel.sgt.ContourLevels; 6 import gov.noaa.pmel.sgt.GridAttribute; 7 import gov.noaa.pmel.sgt.GridCartesianRenderer; 8 import gov.noaa.pmel.sgt.IndexedColorMap; 9 import gov.noaa.pmel.sgt.JPane; 10 import gov.noaa.pmel.sgt.LinearTransform; 11 import gov.noaa.pmel.sgt.demo.TestData; 12 import gov.noaa.pmel.sgt.dm.SGTData; 13 import gov.noaa.pmel.sgt.swing.JClassTree; 14 import gov.noaa.pmel.sgt.swing.JPlotLayout; 15 import gov.noaa.pmel.sgt.swing.prop.GridAttributeDialog; 16 import gov.noaa.pmel.util.Range2D; 1 package com.ether; 2 3 import com.medias.database.objects.Parametre; 4 import org.jetbrains.annotations.NotNull; 5 import org.jetbrains.annotations.Nullable; 6 import org.springframework.context.support.ClassPathXmlApplicationContext; 17 7 18 8 import javax.swing.*; 19 9 import java.awt.*; 20 import java.awt.event.ActionEvent; 21 import java.awt.print.PageFormat; 22 import java.awt.print.PrinterException; 23 import java.awt.print.PrinterJob; 10 import java.util.Locale; 24 11 25 12 public class AppletTemp 26 13 extends JApplet 27 14 { 28 static JPlotLayout rpl_;29 private GridAttribute gridAttr_;30 JButton edit_;31 JButton space_ = null;32 JButton tree_;33 JButton print_;34 JButton layout_;35 PageFormat pageFormat = PrinterJob.getPrinterJob().defaultPage();36 37 15 public void init() 38 16 { 39 /* 40 * Create the demo in the JApplet environment. 41 */ 42 getContentPane().setLayout( new BorderLayout( 0, 0 ) ); 43 setBackground( java.awt.Color.white ); 44 setSize( 600, 550 ); 45 JPanel main = new JPanel(); 46 rpl_ = makeGraph(); 47 JPanel button = makeButtonPanel( false ); 48 rpl_.setBatch( true ); 49 main.add( rpl_, BorderLayout.CENTER ); 50 JPane gridKeyPane = rpl_.getKeyPane(); 51 gridKeyPane.setSize( new Dimension( 600, 100 ) ); 52 main.add( gridKeyPane, BorderLayout.SOUTH ); 53 getContentPane().add( main, "Center" ); 54 getContentPane().add( button, "South" ); 55 rpl_.setBatch( false ); 17 String app_context1 = "classpath:dao-context.xml"; 18 String app_context2 = "classpath:service-context.xml"; 19 String app_context3 = "classpath:hibernate.cfg.xml"; 20 String[] contextPaths = new String[]{app_context1, app_context2, app_context3}; 56 21 22 final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( contextPaths ); 23 _etherService = (EtherService) context.getBean( "etherService", EtherService.class ); 24 _etherPlotService = (EtherPlotService) context.getBean( "etherPlotService", EtherPlotService.class ); 25 26 // final String appletContext = "applet-context.xml"; 27 // final String hibernateContext = "hibernate.cfg.xml"; 28 // final String[] contextPaths = new String[]{appletContext, hibernateContext}; 29 30 _locale = new Locale( "fr" ); 31 _plateformId = 14; 32 _parameterId = 90; 33 _title = "Applet de merd...."; 34 _axeType = AxeTypeForFixedPlateform.TIME_LINE.toString(); 35 _dateBegin = null; 36 _dateEnd = null; 37 38 _maxWidth = EtherPlotServiceImpl.getMaxWidth(); 39 _maxHeight = EtherPlotServiceImpl.getMaxHeight(); 40 41 // final Integer plateformId = Integer.valueOf( getParameter( "plateformId" ) ); 42 // final Integer parameterId = Integer.valueOf( getParameter( "parameterId" ) ); 43 // final String title = getParameter( "title" ); 44 // final String axeType = getParameter( "axeType" ); 45 // final String dateBegin = getParameter( "dateBegin" ); 46 // final String dateEnd = getParameter( "dateEnd" ); 47 // final String locale = getParameter( "locale" ); 57 48 } 58 49 59 JPanel makeButtonPanel( boolean mark)50 public void start() 60 51 { 61 MyAction myAction = new MyAction(); 62 JPanel button = new JPanel(); 63 button.setLayout( new FlowLayout() ); 64 print_ = new JButton( "Print..." ); 65 print_.addActionListener( myAction ); 66 button.add( print_ ); 67 layout_ = new JButton( "Page Layout..." ); 68 layout_.addActionListener( myAction ); 69 button.add( layout_ ); 70 tree_ = new JButton( "Tree View" ); 71 tree_.addActionListener( myAction ); 72 button.add( tree_ ); 73 edit_ = new JButton( "Edit GridAttribute" ); 74 edit_.addActionListener( myAction ); 75 button.add( edit_ ); 76 /* 77 * Optionally leave the "mark" button out of the button panel 78 */ 79 if( mark ) 52 try 80 53 { 81 space_ = new JButton( "Add Mark" ); 82 space_.addActionListener( myAction ); 83 button.add( space_ ); 54 final Parametre parametre = _etherService.getParameterById( 90 ); 55 56 final JLabel jLabelTitle = new JLabel( "AppletTemp : " + parametre.getParametreNom(), JLabel.CENTER ); 57 final Font police = new Font( "Arial", Font.BOLD, 14 ); 58 jLabelTitle.setFont( police ); 59 add( jLabelTitle, BorderLayout.CENTER ); 84 60 } 85 return button; 61 catch( ServiceException e ) 62 { 63 final JLabel jLabelTitle = new JLabel( "Plantage sur le paramÚtre à rechercher", JLabel.CENTER ); 64 final Font police = new Font( "Arial", Font.BOLD, 14 ); 65 jLabelTitle.setFont( police ); 66 add( jLabelTitle, BorderLayout.CENTER ); 67 } 86 68 } 87 69 88 void edit_actionPerformed( java.awt.event.ActionEvent e ) 89 { 90 /* 91 * Create a GridAttributeDialog and set the renderer. 92 */ 93 GridAttributeDialog gad = new GridAttributeDialog(); 94 gad.setJPane( rpl_ ); 95 CartesianRenderer rend = ( (CartesianGraph) rpl_.getFirstLayer().getGraph() ).getRenderer(); 96 gad.setGridCartesianRenderer( (GridCartesianRenderer) rend ); 97 // gad.setGridAttribute(gridAttr_); 98 gad.setVisible( true ); 99 } 100 101 void tree_actionPerformed( java.awt.event.ActionEvent e ) 102 { 103 /* 104 * Create a JClassTree for the JPlotLayout objects 105 */ 106 JClassTree ct = new JClassTree(); 107 ct.setModal( false ); 108 ct.setJPane( rpl_ ); 109 ct.show(); 110 } 111 112 void print_actionPerformed( ActionEvent e ) 113 { 114 Color saveColor; 115 116 PrinterJob printJob = PrinterJob.getPrinterJob(); 117 printJob.setPrintable( rpl_, pageFormat ); 118 printJob.setJobName( "Grid Demo" ); 119 if( printJob.printDialog() ) 120 { 121 try 122 { 123 saveColor = rpl_.getBackground(); 124 if( !saveColor.equals( Color.white ) ) 125 { 126 rpl_.setBackground( Color.white ); 127 } 128 rpl_.setPageAlign( AbstractPane.TOP, 129 AbstractPane.CENTER ); 130 RepaintManager currentManager = RepaintManager.currentManager( rpl_ ); 131 currentManager.setDoubleBufferingEnabled( false ); 132 printJob.print(); 133 currentManager.setDoubleBufferingEnabled( true ); 134 rpl_.setBackground( saveColor ); 135 } 136 catch( PrinterException pe ) 137 { 138 System.out.println( "Error printing: " + pe ); 139 } 140 } 141 142 } 143 144 void layout_actionPerformed( ActionEvent e ) 145 { 146 PrinterJob pj = PrinterJob.getPrinterJob(); 147 pageFormat = pj.pageDialog( pageFormat ); 148 } 149 150 JPlotLayout makeGraph() 151 { 152 /* 153 * This example uses a pre-created "Layout" for raster time 154 * series to simplify the construction of a plot. The 155 * JPlotLayout can plot a single grid with 156 * a ColorKey, time series with a LineKey, point collection with a 157 * PointCollectionKey, and general X-Y plots with a 158 * LineKey. JPlotLayout supports zooming, object selection, and 159 * object editing. 160 */ 161 SGTData newData; 162 TestData td; 163 JPlotLayout rpl; 164 ContourLevels clevels; 165 /* 166 * Create a test grid with sinasoidal-ramp data. 167 */ 168 Range2D xr = new Range2D( 190.0f, 250.0f, 1.0f ); 169 Range2D yr = new Range2D( 0.0f, 45.0f, 1.0f ); 170 td = new TestData( TestData.XY_GRID, xr, yr, 171 TestData.SINE_RAMP, 12.0f, 30.f, 5.0f ); 172 newData = td.getSGTData(); 173 /* 174 * Create the layout without a Logo image and with the 175 * ColorKey on a separate Pane object. 176 */ 177 rpl = new JPlotLayout( true, false, false, "JGridDemo Pane", null, true ); 178 rpl.setEditClasses( false ); 179 /* 180 * Create a GridAttribute for CONTOUR style. 181 */ 182 Range2D datar = new Range2D( -20.0f, 45.0f, 5.0f ); 183 clevels = ContourLevels.getDefault( datar ); 184 gridAttr_ = new GridAttribute( clevels ); 185 /* 186 * Create a ColorMap and change the style to RASTER_CONTOUR. 187 */ 188 ColorMap cmap = createColorMap( datar ); 189 gridAttr_.setColorMap( cmap ); 190 gridAttr_.setStyle( GridAttribute.RASTER_CONTOUR ); 191 /* 192 * Add the grid to the layout and give a label for 193 * the ColorKey. 194 */ 195 rpl.addData( newData, gridAttr_, "First Data" ); 196 /* 197 * Change the layout's three title lines. 198 */ 199 rpl.setTitles( "Raster Plot Demo", 200 "using a JPlotLayout", 201 "" ); 202 /* 203 * Resize the graph and place in the "Center" of the frame. 204 */ 205 rpl.setSize( new Dimension( 600, 400 ) ); 206 /* 207 * Resize the key Pane, both the device size and the physical 208 * size. Set the size of the key in physical units and place 209 * the key pane at the "South" of the frame. 210 */ 211 // rpl.setKeyLayerSizeP(new Dimension2D(6.0, 1.02)); 212 // rpl.setKeyBoundsP(new Rectangle2D.Double(0.01, 1.01, 5.98, 1.0)); 213 214 return rpl; 215 } 216 217 ColorMap createColorMap( Range2D datar ) 218 { 219 int[] red = 220 {0, 0, 0, 0, 0, 0, 0, 0, 221 0, 0, 0, 0, 0, 0, 0, 0, 222 0, 0, 0, 0, 0, 0, 0, 0, 223 0, 7, 23, 39, 55, 71, 87, 103, 224 119, 135, 151, 167, 183, 199, 215, 231, 225 247, 255, 255, 255, 255, 255, 255, 255, 226 255, 255, 255, 255, 255, 255, 255, 255, 227 255, 246, 228, 211, 193, 175, 158, 140}; 228 int[] green = 229 {0, 0, 0, 0, 0, 0, 0, 0, 230 0, 11, 27, 43, 59, 75, 91, 107, 231 123, 139, 155, 171, 187, 203, 219, 235, 232 251, 255, 255, 255, 255, 255, 255, 255, 233 255, 255, 255, 255, 255, 255, 255, 255, 234 255, 247, 231, 215, 199, 183, 167, 151, 235 135, 119, 103, 87, 71, 55, 39, 23, 236 7, 0, 0, 0, 0, 0, 0, 0}; 237 int[] blue = 238 {0, 143, 159, 175, 191, 207, 223, 239, 239 255, 255, 255, 255, 255, 255, 255, 255, 240 255, 255, 255, 255, 255, 255, 255, 255, 241 255, 247, 231, 215, 199, 183, 167, 151, 242 135, 119, 103, 87, 71, 55, 39, 23, 243 7, 0, 0, 0, 0, 0, 0, 0, 244 0, 0, 0, 0, 0, 0, 0, 0, 245 0, 0, 0, 0, 0, 0, 0, 0}; 246 247 IndexedColorMap cmap = new IndexedColorMap( red, green, blue ); 248 cmap.setTransform( new LinearTransform( 0.0, (double) red.length, 249 datar.start, datar.end ) ); 250 return cmap; 251 } 252 253 class MyAction 254 implements java.awt.event.ActionListener 255 { 256 public void actionPerformed( java.awt.event.ActionEvent event ) 257 { 258 Object obj = event.getSource(); 259 if( obj == edit_ ) 260 { 261 edit_actionPerformed( event ); 262 } 263 else if( obj == space_ ) 264 { 265 System.out.println( " <<Mark>>" ); 266 } 267 else if( obj == tree_ ) 268 { 269 tree_actionPerformed( event ); 270 } 271 else if( obj == print_ ) 272 { 273 print_actionPerformed( event ); 274 } 275 else if( obj == layout_ ) 276 { 277 layout_actionPerformed( event ); 278 } 279 } 280 } 70 private EtherService _etherService; 71 private EtherPlotService _etherPlotService; 72 @NotNull 73 private Locale _locale; 74 @NotNull 75 private Integer _plateformId; 76 @NotNull 77 private Integer _parameterId; 78 @Nullable 79 private String _title; 80 @NotNull 81 private String _axeType; 82 @Nullable 83 private String _dateBegin; 84 @Nullable 85 private String _dateEnd; 86 @NotNull 87 private Integer _maxWidth; 88 @NotNull 89 private Integer _maxHeight; 281 90 } -
ether_megapoli/trunk/applets/src/com/ether/AppletTimeSerie.java
r175 r178 1 import com.ether.AxeTypeForFixedPlateform; 2 import com.ether.Data; 3 import com.ether.EtherPlotService; 4 import com.ether.EtherService; 5 import com.ether.MegapoliPlot; 6 import com.medias.Context; 1 package com.ether; 2 7 3 import com.medias.database.objects.Parametre; 8 4 import com.medias.database.objects.Unite; 9 import gov.noaa.pmel.sgt.Axis;10 import gov.noaa.pmel.sgt.CartesianGraph;11 import gov.noaa.pmel.sgt.Graph;12 5 import gov.noaa.pmel.sgt.JPane; 13 import gov.noaa.pmel.sgt.Layer; 14 import gov.noaa.pmel.sgt.LineAttribute; 15 import gov.noaa.pmel.sgt.LineCartesianRenderer; 16 import gov.noaa.pmel.sgt.LineKey; 17 import gov.noaa.pmel.sgt.LinearTransform; 18 import gov.noaa.pmel.sgt.PlainAxis; 19 import gov.noaa.pmel.sgt.SGLabel; 20 import gov.noaa.pmel.sgt.StackedLayout; 21 import gov.noaa.pmel.sgt.TimeAxis; 22 import gov.noaa.pmel.sgt.demo.TestData; 23 import gov.noaa.pmel.sgt.dm.SimpleLine; 24 import gov.noaa.pmel.sgt.swing.JClassTree; 25 import gov.noaa.pmel.util.Dimension2D; 26 import gov.noaa.pmel.util.GeoDate; 27 import gov.noaa.pmel.util.IllegalTimeValue; 28 import gov.noaa.pmel.util.Point2D; 29 import gov.noaa.pmel.util.Range2D; 30 import gov.noaa.pmel.util.SoTPoint; 31 import gov.noaa.pmel.util.SoTRange; 32 import gov.noaa.pmel.util.TimeRange; 6 import org.jetbrains.annotations.NotNull; 7 import org.jetbrains.annotations.Nullable; 33 8 import org.springframework.context.support.ClassPathXmlApplicationContext; 34 9 35 10 import javax.swing.*; 36 import javax.swing.border.EtchedBorder;37 import java.applet.Applet;38 11 import java.awt.*; 39 import java.awt.im.InputContext;40 12 import java.util.Calendar; 41 13 import java.util.Date; 42 import java.util.Enumeration;43 14 import java.util.Locale; 44 15 … … 48 19 public void init() 49 20 { 50 final String appletContext = "applet-context.xml"; 51 final String hibernateContext = "hibernate.cfg.xml"; 52 final String[] contextPaths = new String[]{appletContext, hibernateContext}; 21 String app_context1 = "classpath:dao-context.xml"; 22 String app_context2 = "classpath:service-context.xml"; 23 String app_context3 = "classpath:hibernate.cfg.xml"; 24 String[] contextPaths = new String[]{app_context1, app_context2, app_context3}; 53 25 54 26 final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( contextPaths ); 55 27 _etherService = (EtherService) context.getBean( "etherService", EtherService.class ); 56 28 _etherPlotService = (EtherPlotService) context.getBean( "etherPlotService", EtherPlotService.class ); 57 _locale = InputContext.getInstance().getLocale(); 29 30 // final String appletContext = "applet-context.xml"; 31 // final String hibernateContext = "hibernate.cfg.xml"; 32 // final String[] contextPaths = new String[]{appletContext, hibernateContext}; 33 // 34 // final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( contextPaths ); 35 // _etherService = (EtherService) context.getBean( "etherService", EtherService.class ); 36 // _etherPlotService = (EtherPlotService) context.getBean( "etherPlotService", EtherPlotService.class ); 37 38 _locale = new Locale( "fr" ); 39 _plateformId = 14; 40 _parameterId = 90; 41 _title = "Applet de merd...."; 42 _axeType = AxeTypeForFixedPlateform.TIME_LINE.toString(); 43 _dateBegin = null; 44 _dateEnd = null; 45 46 _maxWidth = EtherPlotServiceImpl.getMaxWidth(); 47 _maxHeight = EtherPlotServiceImpl.getMaxHeight(); 48 49 // final Integer plateformId = Integer.valueOf( getParameter( "plateformId" ) ); 50 // final Integer parameterId = Integer.valueOf( getParameter( "parameterId" ) ); 51 // final String title = getParameter( "title" ); 52 // final String axeType = getParameter( "axeType" ); 53 // final String dateBegin = getParameter( "dateBegin" ); 54 // final String dateEnd = getParameter( "dateEnd" ); 55 // final String locale = getParameter( "locale" ); 58 56 } 59 57 60 58 public void start() 61 59 { 62 // Init megapoliPlot with parameters63 final MegapoliPlot megapoliPlot = initMegapoliPlot();60 // Create megapoliPlot 61 final MegapoliPlot megapoliPlot = createMegapoliPlot(); 64 62 65 63 // Create graph 66 64 setLayout( new BorderLayout( 0, 0 ) ); 67 65 setBackground( Color.WHITE ); 66 // setSize( _maxWidth, _maxHeight ); 68 67 setSize( 800, 800 ); 69 68 … … 72 71 add( jPaneTop, BorderLayout.NORTH ); 73 72 74 // Bottom Pane75 73 final Integer valuesNumber = megapoliPlot.getValuesNumber(); 76 74 … … 79 77 add( jPaneBottom, BorderLayout.PAGE_END ); 80 78 81 makeControlPanel(); 82 add( controlPanel, BorderLayout.SOUTH ); 79 // Actions Panel 80 final JPanel jPanelControl = _etherPlotService.createControlPanel(); 81 // add( jPanelControl, BorderLayout.SOUTH ); 83 82 84 // makeGraph( parametre.getParametreNom() ); 85 makeGraph();86 add( mainPane_, BorderLayout.CENTER );83 // Graph Pane 84 final JPane jPaneGraph = _etherPlotService.createTimeSeriePlot( megapoliPlot ); 85 add( jPaneGraph, BorderLayout.CENTER ); 87 86 } 88 87 89 void makeGraph()88 private MegapoliPlot createMegapoliPlot() 90 89 { 91 /*92 * This example explicitly creates the JPane, Layers, Axes, and SGLabels.93 */94 /*95 * Create JPane, place in the center of the frame96 * and set the layout to use the StackedLayout. StackedLayout is97 * a custom layout manager designed to place Components directly98 * over one another.99 */100 mainPane_ = new JPane( "Layout Demo", new Dimension( 426, 400 ) );101 mainPane_.setLayout( new StackedLayout() );102 /*103 * Create the two random time series using the TestData class and104 * the SimpleLine classes from sgt.dm105 */106 SimpleLine line;107 SimpleLine line2;108 GeoDate start = null;109 GeoDate stop = null;110 TimeRange tr;111 TestData td;112 try113 {114 start = new GeoDate( "1992-11-01", "yyyy-MM-dd" );115 stop = new GeoDate( "1993-02-20", "yyyy-MM-dd" );116 }117 catch( IllegalTimeValue e )118 {119 }120 tr = new TimeRange( start, stop );121 td = new TestData( TestData.TIME_SERIES, tr, 1.0f,122 TestData.RANDOM, 1.2f, 0.0f, 20.0f );123 line = (SimpleLine) td.getSGTData();124 //125 try126 {127 start = new GeoDate( "1992-11-01", "yyyy-MM-dd" );128 stop = new GeoDate( "1993-02-20", "yyyy-MM-dd" );129 }130 catch( IllegalTimeValue e )131 {132 }133 tr = new TimeRange( start, stop );134 td = new TestData( TestData.TIME_SERIES, tr, 1.0f,135 TestData.RANDOM, 1.2f, 0.5f, 30.0f );136 line2 = (SimpleLine) td.getSGTData();137 /*138 * Get the axis ranges from SGTLine139 */140 SoTRange ynRange, yRange;141 SoTRange tnRange;142 String yLabel;143 yRange = line.getYRange();144 yRange.add( line2.getYRange() );145 tnRange = line.getXRange();146 /*147 * compute the range for the y and time axes148 * and get the y axis label from line's metadata149 */150 ynRange = Graph.computeRange( yRange, 6 );151 yLabel = line.getYMetaData().getName();152 /*153 * LayoutDemo will have two layers.154 * One layer for each line to be drawn.155 * The first layer will contain the axes and labels156 * and the first set of data. The second layer will157 * contain the second set of data.158 */159 /*160 * xsize, ysize are the width and height in physical units161 * of the Layer graphics region.162 *163 * xstart, xend are the start and end points for the TimeAxis164 * ystart, yend are the start and end points for the Y axis165 */166 double xsize = 4.0;167 double xstart = 0.6;168 double xend = 3.25;169 double ysize = 3.0;170 double ystart = 0.6;171 double yend = 2.50;172 173 Layer layer, layer2;174 SGLabel label, title, ytitle;175 CartesianGraph graph, graph2;176 LinearTransform xt, yt;177 PlainAxis yleft;178 TimeAxis xbot;179 LineKey lkey;180 GeoDate stime;181 /*182 * create the first layer183 */184 layer = new Layer( "First Layer", new Dimension2D( xsize, ysize ) );185 /*186 * create a time stamp label for the plot187 * position the label at the lower left corner188 * and add to the first layer189 * (NOTE: the time will be displayed for the GMT time zone)190 */191 stime = new GeoDate();192 label = new SGLabel( "Date Stamp", stime.toString(),193 new Point2D.Double( 0.05, 0.05 ) );194 label.setAlign( SGLabel.BOTTOM, SGLabel.LEFT );195 label.setColor( Color.magenta );196 label.setHeightP( 0.15 );197 label.setFont( new Font( "Dialog", Font.PLAIN, 10 ) );198 layer.addChild( label );199 /*200 * create a title for the plot201 * position the label centered on the graph202 * and add to the first layer203 */204 title = new SGLabel( "Title", "Layout Demo zzzzqsdqdqs",205 new Point2D.Double( xsize / 2.0, ysize ) );206 title.setAlign( SGLabel.TOP, SGLabel.CENTER );207 title.setHeightP( 0.20 );208 title.setFont( new Font( "Helvetica", Font.BOLD, 14 ) );209 layer.addChild( title );210 /*211 * create a LineKey212 * the LineKey will be a legend for the two lines created213 * position the key in the upper right corner214 * and add to the first layer215 */216 lkey = new LineKey();217 lkey.setId( "Legend" );218 lkey.setLocationP( new Point2D.Double( xsize - 0.01, ysize ) );219 lkey.setVAlign( LineKey.TOP );220 lkey.setHAlign( LineKey.RIGHT );221 layer.addChild( lkey );222 /*223 * add the first layer to the Pane224 */225 mainPane_.add( layer );226 /*227 * create first CartesianGraph and transforms228 */229 graph = new CartesianGraph( "First Graph" );230 xt = new LinearTransform( new Range2D( xstart, xend ), tnRange );231 graph.setXTransform( xt );232 yt = new LinearTransform( new Range2D( ystart, yend ), ynRange );233 graph.setYTransform( yt );234 /*235 * Create the time axis, set its range in user units236 * and its origin. Add the axis to the first graph.237 */238 SoTPoint point = new SoTPoint( ynRange.getStart(), tnRange.getStart() );239 xbot = new TimeAxis( "Bottom Axis", TimeAxis.MONTH_YEAR );240 xbot.setRangeU( tnRange );241 xbot.setLocationU( point );242 Font xbfont = new Font( "Helvetica", Font.ITALIC, 14 );243 xbot.setLabelFont( xbfont );244 xbot.setMinorLabelInterval( 1 );245 graph.addXAxis( xbot );246 /*247 * Create the vertical axis, set its range in user units248 * and its origin. Create the axis title and add the249 * axis to the first graph.250 */251 yleft = new PlainAxis( "Left Axis" );252 yleft.setRangeU( ynRange );253 yleft.setLocationU( point );254 yleft.setLabelFont( xbfont );255 ytitle = new SGLabel( "Y-Axis Title", yLabel,256 new Point2D.Double( 0.0, 0.0 ) );257 Font ytfont = new Font( "Helvetica", Font.PLAIN, 14 );258 ytitle.setFont( ytfont );259 ytitle.setHeightP( 0.2 );260 yleft.setTitle( ytitle );261 graph.addYAxis( yleft );262 /*263 * Add the first graph to the first layer.264 */265 layer.setGraph( graph );266 /*267 * Create a LineAttribute for the display of the first268 * line. Associate the attribute and the line with the269 * first graph. Add the line to the LineKey.270 */271 LineAttribute attr;272 273 attr = new LineAttribute( LineAttribute.MARK, 20, Color.red );274 attr.setMarkHeightP( 0.1 );275 graph.setData( line, attr );276 lkey.addLineGraph( (LineCartesianRenderer) graph.getRenderer(),277 new SGLabel( "1st line", "Red Data",278 new Point2D.Double( 0.0, 0.0 ) ) );279 /*280 * Create the second layer and add it the the Pane.281 * Create the second graph and associate it with the282 * second layer.283 */284 layer2 = new Layer( "Second Layer", new Dimension2D( xsize, ysize ) );285 mainPane_.add( layer2 );286 graph2 = new CartesianGraph( "Second Graph", xt, yt );287 layer2.setGraph( graph2 );288 /*289 * Create a LineAttribute for the display of the second290 * line. Associate the attribute and the line with the291 * second graph. Add the line to the LineKey.292 */293 LineAttribute attr2;294 attr2 = new LineAttribute( LineAttribute.MARK, 2, Color.blue );295 attr2.setMarkHeightP( 0.1 );296 graph2.setData( line2, attr2 );297 lkey.addLineGraph( (LineCartesianRenderer) graph2.getRenderer(),298 new SGLabel( "2nd line", "Blue Data",299 new Point2D.Double( 0.0, 0.0 ) ) );300 }301 302 /**303 * Change the Pane layout to StackedLayout.304 *305 * @param event306 */307 308 void stacked_itemStateChanged( java.awt.event.ItemEvent event )309 {310 /*311 * Get the component list for mainPane_ and change312 * the layout to StackedLayout.313 */314 Component[] comps = mainPane_.getComponents();315 mainPane_.setBatch( true );316 mainPane_.setLayout( new StackedLayout() );317 /*318 * Remove any axes that have been associated with319 * the second graph. With the layers overlayed it320 * is not necessary to have duplicate axes.321 */322 Graph gr2 = ( (Layer) comps[1] ).getGraph();323 ( (CartesianGraph) gr2 ).removeAllXAxes();324 ( (CartesianGraph) gr2 ).removeAllYAxes();325 /*326 * Tell the Applet that the mainPane_ needs to327 * be layed out and re-draw the mainPane_.328 */329 if( isApplet_ )330 {331 validate();332 }333 else334 {335 frame.validate();336 }337 mainPane_.setBatch( false );338 if( tree_ != null )339 {340 if( tree_.isVisible() )341 {342 tree_.setJPane( mainPane_ );343 tree_.expandTree();344 }345 }346 }347 348 /**349 * Change the Pane layout to GridLayout.350 *351 * @param event352 */353 354 void grid_itemStateChanged( java.awt.event.ItemEvent event )355 {356 /*357 * Get the component list for mainPane_ and change358 * the layout to GridLayout.359 */360 Component[] comps = mainPane_.getComponents();361 mainPane_.setBatch( true );362 mainPane_.setLayout( new GridLayout( 2, 0 ) );363 /*364 * Get the first and second graphs from the first365 * and second layers, respectively.366 */367 Graph gr = ( (Layer) comps[0] ).getGraph();368 Graph gr2 = ( (Layer) comps[1] ).getGraph();369 /*370 * Create copies of all X-Axes associated with the first371 * graph for the second graph. If the axes are not copied then372 * the second graph will have the second line plotted, but without373 * any axes.374 */375 for( Enumeration xa = ( (CartesianGraph) gr ).xAxisElements(); xa.hasMoreElements(); )376 {377 ( (CartesianGraph) gr2 ).addXAxis( ( (Axis) xa.nextElement() ).copy() );378 }379 /*380 * Create copies of all Y-Axes associated with the first381 * graph for the second graph.382 */383 for( Enumeration ya = ( (CartesianGraph) gr ).yAxisElements(); ya.hasMoreElements(); )384 {385 ( (CartesianGraph) gr2 ).addYAxis( ( (Axis) ya.nextElement() ).copy() );386 }387 /*388 * Tell the Applet that the mainPane_ needs to389 * be layed out and re-draw the mainPane_.390 */391 if( isApplet_ )392 {393 validate();394 }395 else396 {397 frame.validate();398 }399 // mainPane_.draw();400 mainPane_.setBatch( false );401 if( tree_ != null )402 {403 if( tree_.isVisible() )404 {405 tree_.setJPane( mainPane_ );406 tree_.expandTree();407 }408 }409 }410 411 void showTree_ActionPerformed( java.awt.event.ActionEvent event )412 {413 /*414 * Create the ClassTree dialog to display the classes used415 * in the mainPane_ and allow editing.416 */417 if( tree_ == null )418 {419 tree_ = new JClassTree( "Classes for LayoutDemo" );420 }421 tree_.setJPane( mainPane_ );422 tree_.show();423 }424 425 private MegapoliPlot initMegapoliPlot()426 {427 final Integer plateformId = 14;428 final Integer parameterId = 90;429 final String title = "Applet de merd....";430 final String axeType = AxeTypeForFixedPlateform.TIME_LINE.toString();431 432 // final Integer plateformId = Integer.valueOf( getParameter( "plateformId" ) );433 // final Integer parameterId = Integer.valueOf( getParameter( "parameterId" ) );434 // final String title = getParameter( "title" );435 // final String axeType = getParameter( "axeType" );436 //437 // final String dateBegin = getParameter( "dateBegin" );438 // final String dateEnd = getParameter( "dateEnd" );439 final String dateBegin = null;440 final String dateEnd = null;441 90 final Calendar calendar = Calendar.getInstance(); 442 91 Date formatedDateBegin = null; 443 92 Date formatedDateEnd = null; 444 if( null != dateBegin && null != dateEnd && !"false".equals( dateBegin ) && !"false".equals(dateEnd ) )93 if( null != _dateBegin && null != _dateEnd && !"false".equals( _dateBegin ) && !"false".equals( _dateEnd ) ) 445 94 try 446 95 { 447 calendar.setTimeInMillis( Long.valueOf( dateBegin ) );96 calendar.setTimeInMillis( Long.valueOf( _dateBegin ) ); 448 97 formatedDateBegin = calendar.getTime(); 449 calendar.setTimeInMillis( Long.valueOf( dateEnd ) );98 calendar.setTimeInMillis( Long.valueOf( _dateEnd ) ); 450 99 formatedDateEnd = calendar.getTime(); 451 100 } … … 475 124 // Create plot 476 125 final MegapoliPlot megapoliPlot = new MegapoliPlot(); 477 megapoliPlot.setTitle( title );478 megapoliPlot.setAxeType( axeType );126 megapoliPlot.setTitle( _title ); 127 megapoliPlot.setAxeType( _axeType ); 479 128 megapoliPlot.setParameterName( parametre.getParametreNom() ); 480 129 if( null != parametre.getUnite() && null != parametre.getUnite().getUniteCode() ) … … 482 131 483 132 484 if( AxeTypeForFixedPlateform.TIME_LINE.name().equals( axeType ) || AxeTypeForFixedPlateform.TIME_POINTS.name().equals(axeType ) )133 if( AxeTypeForFixedPlateform.TIME_LINE.name().equals( _axeType ) || AxeTypeForFixedPlateform.TIME_POINTS.name().equals( _axeType ) ) 485 134 { 486 135 // final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodForTimeSerie( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 487 136 final double[] values = new double[50]; 488 137 final Date[] dates = new Date[50]; 138 final Calendar cal = Calendar.getInstance(); 489 139 490 140 for( int i = 0; i < 50; i++ ) 491 141 { 492 142 values[i] = (double) i; 493 dates[i] = new Date(); 143 cal.set( Calendar.MINUTE, 5 * i ); 144 dates[i] = cal.getTime(); 494 145 } 495 146 final Data valuesLists = new Data( values, dates ); … … 517 168 518 169 megapoliPlot.setData( valuesLists ); 519 // final double[] latitudeArray = {2.1, 2.2, 2.3};520 // final double[] longitudeValues = {112.1, 12.2, 22.3};521 170 522 171 megapoliPlot.setTimeSerie( false ); … … 526 175 return megapoliPlot; 527 176 } 528 public void makeControlPanel()529 {530 final JPanel controlPanel = new JPanel();531 final ButtonGroup gridtype = new ButtonGroup();532 final JCheckBox stacked = new JCheckBox();533 final JCheckBox grid = new JCheckBox();534 535 controlPanel.setLayout( new GridBagLayout() );536 // controlPanel.setBackground(new java.awt.Color(200,200,200));537 controlPanel.setBounds( 0, 679, 426, 33 );538 controlPanel.setBorder( new EtchedBorder() );539 gridtype.add( stacked );540 stacked.setSelected( true );541 stacked.setText( "Overlayed" );542 543 GridBagConstraints gbc = new GridBagConstraints();544 gbc.gridx = 0;545 gbc.gridy = 0;546 gbc.gridwidth = 1;547 gbc.gridheight = 1;548 gbc.weightx = 0.0;549 gbc.weighty = 1.0;550 gbc.anchor = GridBagConstraints.EAST;551 gbc.fill = GridBagConstraints.BOTH;552 gbc.insets = new Insets( 5, 15, 5, 5 );553 gbc.ipadx = 0;554 gbc.ipady = 0;555 controlPanel.add( stacked, gbc );556 stacked.setBounds( 15, 5, 84, 23 );557 gridtype.add( grid );558 grid.setText( "Grid" );559 560 gbc.gridx = 1;561 gbc.gridy = 0;562 gbc.gridwidth = 1;563 gbc.gridheight = 1;564 gbc.weightx = 0.5;565 gbc.weighty = 1.0;566 gbc.anchor = GridBagConstraints.WEST;567 gbc.fill = GridBagConstraints.VERTICAL;568 gbc.insets = new Insets( 5, 5, 5, 0 );569 gbc.ipadx = 0;570 gbc.ipady = 0;571 controlPanel.add( grid, gbc );572 grid.setBounds( 109, 5, 53, 23 );573 showTree.setText( "Show Class Tree" );574 575 gbc.gridx = 2;576 gbc.gridy = 0;577 gbc.gridwidth = 1;578 gbc.gridheight = 1;579 gbc.weightx = 1.0;580 gbc.weighty = 1.0;581 gbc.anchor = GridBagConstraints.EAST;582 gbc.fill = GridBagConstraints.VERTICAL;583 gbc.insets = new Insets( 5, 5, 5, 15 );584 gbc.ipadx = 0;585 gbc.ipady = 0;586 controlPanel.add( showTree, gbc );587 showTree.setBackground( Color.yellow.brighter() );588 showTree.setBounds( 302, 5, 109, 23 );589 590 SymItem lSymItem = new SymItem();591 stacked.addItemListener( lSymItem );592 grid.addItemListener( lSymItem );593 SymAction lSymAction = new SymAction();594 showTree.addActionListener( lSymAction );595 }596 597 598 class SymItem599 implements java.awt.event.ItemListener600 {601 public void itemStateChanged( java.awt.event.ItemEvent event )602 {603 Object object = event.getSource();604 if( object == stacked )605 stacked_itemStateChanged( event );606 else if( object == grid )607 grid_itemStateChanged( event );608 }609 }610 611 class SymAction612 implements java.awt.event.ActionListener613 {614 public void actionPerformed( java.awt.event.ActionEvent event )615 {616 Object object = event.getSource();617 if( object == showTree )618 showTree_ActionPerformed( event );619 }620 }621 622 JPane mainPane_;623 JClassTree tree_ = null;624 boolean isApplet_ = true;625 JFrame frame = null;626 627 JPanel controlPanel = new JPanel();628 JCheckBox stacked = new JCheckBox();629 ButtonGroup gridtype = new ButtonGroup();630 JCheckBox grid = new JCheckBox();631 JButton showTree = new JButton();632 177 633 178 private EtherService _etherService; 634 179 private EtherPlotService _etherPlotService; 180 @NotNull 635 181 private Locale _locale; 182 @NotNull 183 private Integer _plateformId; 184 @NotNull 185 private Integer _parameterId; 186 @Nullable 187 private String _title; 188 @NotNull 189 private String _axeType; 190 @Nullable 191 private String _dateBegin; 192 @Nullable 193 private String _dateEnd; 194 @NotNull 195 private Integer _maxWidth; 196 @NotNull 197 private Integer _maxHeight; 636 198 } -
ether_megapoli/trunk/applets/src/com/ether/JLayoutDemo.java
r174 r178 1 package com.ether; 2 1 3 import gov.noaa.pmel.sgt.JPane; 2 4 import gov.noaa.pmel.sgt.Layer; -
ether_megapoli/trunk/applets/src/com/ether/PIFAppletTimeSerie.java
r175 r178 1 package com.ether; 2 1 3 import com.ether.EtherPlotService; 2 4 import com.ether.EtherService; -
ether_megapoli/trunk/common/Common.iml
r120 r178 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <module type="JAVA_MODULE" version="4"> 3 <component name="NewModuleRootManager" inherit-compiler-output="true"> 3 <component name="NewModuleRootManager" inherit-compiler-output="false"> 4 <output url="file://$MODULE_DIR$/../web/WEB-INF/classes" /> 5 <output-test url="file://$MODULE_DIR$/../out/test/Common" /> 4 6 <exclude-output /> 5 7 <content url="file://$MODULE_DIR$"> -
ether_megapoli/trunk/domain/Domain.iml
r89 r178 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <module type="JAVA_MODULE" version="4"> 3 <component name="NewModuleRootManager" inherit-compiler-output="true"> 3 <component name="NewModuleRootManager" inherit-compiler-output="false"> 4 <output url="file://$MODULE_DIR$/../web/WEB-INF/classes" /> 5 <output-test url="file://$MODULE_DIR$/../out/test/Domain" /> 4 6 <exclude-output /> 5 7 <content url="file://$MODULE_DIR$"> -
ether_megapoli/trunk/persistence/Persistence.iml
r120 r178 14 14 </facet> 15 15 </component> 16 <component name="NewModuleRootManager" inherit-compiler-output="true"> 16 <component name="NewModuleRootManager" inherit-compiler-output="false"> 17 <output url="file://$MODULE_DIR$/../web/WEB-INF/classes" /> 18 <output-test url="file://$MODULE_DIR$/../out/test/Persistence" /> 17 19 <exclude-output /> 18 20 <content url="file://$MODULE_DIR$"> -
ether_megapoli/trunk/service/Service.iml
r120 r178 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <module type="JAVA_MODULE" version="4"> 3 <component name="NewModuleRootManager" inherit-compiler-output="true"> 3 <component name="NewModuleRootManager" inherit-compiler-output="false"> 4 <output url="file://$MODULE_DIR$/../web/WEB-INF/classes" /> 5 <output-test url="file://$MODULE_DIR$/../out/test/Service" /> 4 6 <exclude-output /> 5 7 <content url="file://$MODULE_DIR$"> -
ether_megapoli/trunk/service/implementation/com/ether/EtherPlotServiceImpl.java
r176 r178 2 2 3 3 import com.medias.megapoli.utils.MegapoliInitialisation; 4 import gov.noaa.pmel.sgt.CartesianGraph; 4 5 import gov.noaa.pmel.sgt.ColorMap; 5 6 import gov.noaa.pmel.sgt.ContourLevels; 7 import gov.noaa.pmel.sgt.Graph; 6 8 import gov.noaa.pmel.sgt.GridAttribute; 7 9 import gov.noaa.pmel.sgt.IndexedColorMap; 8 10 import gov.noaa.pmel.sgt.JPane; 11 import gov.noaa.pmel.sgt.Layer; 12 import gov.noaa.pmel.sgt.LineAttribute; 13 import gov.noaa.pmel.sgt.LineCartesianRenderer; 14 import gov.noaa.pmel.sgt.LineKey; 9 15 import gov.noaa.pmel.sgt.LinearTransform; 16 import gov.noaa.pmel.sgt.PlainAxis; 17 import gov.noaa.pmel.sgt.SGLabel; 18 import gov.noaa.pmel.sgt.StackedLayout; 19 import gov.noaa.pmel.sgt.TimeAxis; 10 20 import gov.noaa.pmel.sgt.demo.TestData; 11 21 import gov.noaa.pmel.sgt.dm.SGTData; … … 14 24 import gov.noaa.pmel.sgt.dm.SimpleLine; 15 25 import gov.noaa.pmel.sgt.swing.JPlotLayout; 26 import gov.noaa.pmel.util.Dimension2D; 27 import gov.noaa.pmel.util.GeoDate; 16 28 import gov.noaa.pmel.util.GeoDateArray; 29 import gov.noaa.pmel.util.IllegalTimeValue; 30 import gov.noaa.pmel.util.Point2D; 17 31 import gov.noaa.pmel.util.Range2D; 32 import gov.noaa.pmel.util.SoTPoint; 33 import gov.noaa.pmel.util.SoTRange; 34 import gov.noaa.pmel.util.TimeRange; 18 35 import org.apache.commons.logging.Log; 19 36 import org.apache.commons.logging.LogFactory; … … 78 95 79 96 // Center Pane 80 final Integer centerHeight = maxHeight - jPaneTop.getHeight() - jPaneBottom.getHeight(); 81 final JPane jPaneCenter; 82 if( valuesNumber > 0 ) 83 jPaneCenter = createCenterPane( megapoliPlot, maxWidth, centerHeight, locale ); 97 // final Integer centerHeight = maxHeight - jPaneTop.getHeight() - jPaneBottom.getHeight(); 98 // final JPane jPaneCenter; 99 // if( valuesNumber > 0 ) 100 // jPaneCenter = createCenterPane( megapoliPlot, maxWidth, centerHeight, locale ); 101 // else 102 // jPaneCenter = createEmptyCenterPane( locale ); 103 // jPane.add( jPaneCenter, BorderLayout.CENTER ); 104 105 if( AxeTypeForFixedPlateform.TIME_LINE.name().equals( megapoliPlot.getAxeType() ) || AxeTypeForFixedPlateform.TIME_POINTS.name().equals( megapoliPlot.getAxeType() ) ) 106 { 107 final JPane jPaneGraph = createTimeSeriePlot( megapoliPlot ); 108 final BufferedImage bufferedImage = new BufferedImage( 600, 600, BufferedImage.TYPE_INT_BGR ); 109 final Graphics2D graphics2D = bufferedImage.createGraphics(); 110 // graphics2D.setBackground( Color.WHITE ); 111 jPaneGraph.addNotify(); 112 jPaneGraph.validate(); 113 jPaneGraph.draw( graphics2D ); 114 115 // final JPanelToImageManager jPanelToImageManager = new JPanelToImageManager( jPane ); 116 // return jPanelToImageManager.saveAsImage(); 117 return bufferedImage; 118 } 84 119 else 85 jPaneCenter = createEmptyCenterPane( locale ); 86 jPane.add( jPaneCenter, BorderLayout.CENTER ); 87 88 89 final JPanelToImageManager jPanelToImageManager = new JPanelToImageManager( jPane ); 90 return jPanelToImageManager.saveAsImage(); 120 { 121 final JPane jPaneGraph = create2DPlot( megapoliPlot ); 122 final BufferedImage bufferedImage = new BufferedImage( 600, 600, BufferedImage.TYPE_INT_BGR ); 123 final Graphics2D graphics2D = bufferedImage.createGraphics(); 124 // graphics2D.setBackground( Color.WHITE ); 125 jPaneGraph.addNotify(); 126 jPaneGraph.validate(); 127 jPaneGraph.draw( graphics2D ); 128 129 // final JPanelToImageManager jPanelToImageManager = new JPanelToImageManager( jPane ); 130 // return jPanelToImageManager.saveAsImage(); 131 return bufferedImage; 132 } 91 133 } 92 134 … … 137 179 */ 138 180 @NotNull 139 public JPane createCenterPane ( @NotNull final MegapoliPlot megapoliPlot, @NotNull final Integer maxWidth, @NotNull final Integer maxHeight, @Nullable final Locale locale )181 public JPane createCenterPaneOld( @NotNull final MegapoliPlot megapoliPlot, @NotNull final Integer maxWidth, @NotNull final Integer maxHeight, @Nullable final Locale locale ) 140 182 { 141 183 final Integer plotWidth = Math.min( maxWidth - MARGIN_LEFT_RIGHT, maxWidth ); … … 177 219 178 220 /** 221 * Create the center JPane with the graph 222 * 223 * @param megapoliPlot 224 * @param maxWidth 225 * @param maxHeight 226 * @return 227 */ 228 @NotNull 229 public JPane createCenterPane( @NotNull final MegapoliPlot megapoliPlot, @NotNull final Integer maxWidth, @NotNull final Integer maxHeight, @Nullable final Locale locale ) 230 { 231 232 final JPane jPaneTimeSeriePlot = createTimeSeriePlot( megapoliPlot ); 233 234 final Integer plotWidth = Math.min( maxWidth - MARGIN_LEFT_RIGHT, maxWidth ); 235 final Integer plotHeight = Math.min( maxHeight - MARGIN_LEFT_RIGHT, maxHeight ); 236 237 // final JPlotLayout jPlotLayout; 238 // final BufferedImage bufferedImage; 239 // if( megapoliPlot.isTimeSerie() ) 240 // { 241 // jPlotLayout = createJPlotLayoutForTimeSerie( megapoliPlot, plotWidth, plotHeight ); 242 // 243 // // TODO : remove this change to bufferedImage to insert directly the jPlotLayout !!!! 244 // bufferedImage = new BufferedImage( jPlotLayout.getWidth(), jPlotLayout.getHeight(), BufferedImage.TYPE_INT_RGB ); 245 // final Graphics2D graphics2D = bufferedImage.createGraphics(); 246 // jPlotLayout.draw( graphics2D ); 247 // } 248 // else 249 // { 250 // jPlotLayout = createJPlotLayoutFor2D( megapoliPlot, plotWidth, plotHeight, locale ); 251 // 252 // final JPanelToImageManager jPanelToImageManager = new JPanelToImageManager( jPlotLayout ); 253 // bufferedImage = jPanelToImageManager.saveAsImage(); 254 // } 255 // 256 // final ImageIcon imageIcon = new ImageIcon( bufferedImage ); 257 // final JLabel jLabelPlot = new JLabel( imageIcon, JLabel.CENTER ); 258 // jLabelPlot.setBorder( BorderFactory.createLineBorder( Color.black, 1 ) ); 259 // 260 // final JPane jPaneCenter = new JPane( "Center jPane", new Dimension( jPlotLayout.getWidth(), jPlotLayout.getHeight() ) ); 261 // jPaneCenter.setLayout( new GridBagLayout() ); 262 // jPaneCenter.add( jLabelPlot, 263 // new GridBagConstraints( 0, 0, 1, 1, 0, 0, 264 // GridBagConstraints.CENTER, 265 // GridBagConstraints.CENTER, 266 // new Insets( 0, 0, 0, 0 ), 0, 0 ) ); 267 // 268 // return jPaneCenter; 269 return jPaneTimeSeriePlot; 270 } 271 272 /** 179 273 * Create the bottom JPane with the text "published .. (date)" 180 274 * … … 250 344 } 251 345 346 @NotNull 347 public JPanel createControlPanel() 348 { 349 final JPanel controlPanel = new JPanel(); 350 final ButtonGroup gridtype = new ButtonGroup(); 351 final JCheckBox stacked = new JCheckBox(); 352 final JCheckBox grid = new JCheckBox(); 353 354 controlPanel.setLayout( new GridBagLayout() ); 355 // controlPanel.setBackground(new java.awt.Color(200,200,200)); 356 controlPanel.setBounds( 0, 679, 426, 33 ); 357 controlPanel.setBorder( new EtchedBorder() ); 358 gridtype.add( stacked ); 359 stacked.setSelected( true ); 360 stacked.setText( "Overlayed" ); 361 362 GridBagConstraints gbc = new GridBagConstraints(); 363 gbc.gridx = 0; 364 gbc.gridy = 0; 365 gbc.gridwidth = 1; 366 gbc.gridheight = 1; 367 gbc.weightx = 0.0; 368 gbc.weighty = 1.0; 369 gbc.anchor = GridBagConstraints.EAST; 370 gbc.fill = GridBagConstraints.BOTH; 371 gbc.insets = new Insets( 5, 15, 5, 5 ); 372 gbc.ipadx = 0; 373 gbc.ipady = 0; 374 controlPanel.add( stacked, gbc ); 375 stacked.setBounds( 15, 5, 84, 23 ); 376 gridtype.add( grid ); 377 grid.setText( "Grid" ); 378 379 gbc.gridx = 1; 380 gbc.gridy = 0; 381 gbc.gridwidth = 1; 382 gbc.gridheight = 1; 383 gbc.weightx = 0.5; 384 gbc.weighty = 1.0; 385 gbc.anchor = GridBagConstraints.WEST; 386 gbc.fill = GridBagConstraints.VERTICAL; 387 gbc.insets = new Insets( 5, 5, 5, 0 ); 388 gbc.ipadx = 0; 389 gbc.ipady = 0; 390 controlPanel.add( grid, gbc ); 391 grid.setBounds( 109, 5, 53, 23 ); 392 final JButton showTree = new JButton(); 393 showTree.setText( "Show Class Tree" ); 394 395 gbc.gridx = 2; 396 gbc.gridy = 0; 397 gbc.gridwidth = 1; 398 gbc.gridheight = 1; 399 gbc.weightx = 1.0; 400 gbc.weighty = 1.0; 401 gbc.anchor = GridBagConstraints.EAST; 402 gbc.fill = GridBagConstraints.VERTICAL; 403 gbc.insets = new Insets( 5, 5, 5, 15 ); 404 gbc.ipadx = 0; 405 gbc.ipady = 0; 406 controlPanel.add( showTree, gbc ); 407 showTree.setBackground( Color.yellow.brighter() ); 408 showTree.setBounds( 302, 5, 109, 23 ); 409 410 final SymItem lSymItem = new SymItem( stacked, grid ); 411 stacked.addItemListener( lSymItem ); 412 grid.addItemListener( lSymItem ); 413 // SymAction lSymAction = new SymAction(); 414 // showTree.addActionListener( lSymAction ); 415 416 return controlPanel; 417 } 418 419 /** 420 * First layer contains axes, labels and the first set of data 421 * Others layers contains only the other sets of data 422 * 423 * @param megapoliPlot 424 * @return 425 */ 426 @NotNull 427 public JPane createTimeSeriePlot( @NotNull final MegapoliPlot megapoliPlot ) 428 { 429 final JPane mainPane = new JPane( "zz", new Dimension( 600, 600 ) ); 430 mainPane.setLayout( new StackedLayout() ); 431 mainPane.setBorder( BorderFactory.createLineBorder( Color.pink ) ); 432 433 // // Graph 434 //// final JPlotLayoutEther jPlotLayout = new JPlotLayoutEther( false, true, false, "Trajectory data", null, megapoliPlot.isLegendToHide() ); 435 // final JPlotLayout jPlotLayout = new JPlotLayout( data, "Profile Demo", null, false ); 436 // jPlotLayout.setTitles( "", "", "" ); 437 438 /** ***************************** **/ 439 /** *********** LINES ************ **/ 440 /** ***************************** **/ 441 final double[] dataArray = (double[]) megapoliPlot.getData().getFirstArray(); 442 final Date[] dateValues = (Date[]) megapoliPlot.getData().getSecondArray(); 443 444 final SimpleLine line0 = new SimpleLine( new GeoDateArray( dateValues ), dataArray, "legend" ); 445 SGTMetaData meta = new SGTMetaData( "", "", false, false ); 446 line0.setXMetaData( meta ); 447 448 meta = new SGTMetaData( megapoliPlot.getParameterName(), megapoliPlot.getParameterUnitCode(), false, false ); 449 line0.setYMetaData( meta ); 450 451 452 SimpleLine line; 453 GeoDate start = null; 454 GeoDate stop = null; 455 TimeRange tr; 456 TestData td; 457 try 458 { 459 start = new GeoDate( "1992-11-01", "yyyy-MM-dd" ); 460 stop = new GeoDate( "1993-02-20", "yyyy-MM-dd" ); 461 } 462 catch( IllegalTimeValue e ) 463 { 464 } 465 tr = new TimeRange( start, stop ); 466 td = new TestData( TestData.TIME_SERIES, tr, 1.0f, 467 TestData.RANDOM, 1.2f, 0.5f, 30.0f ); 468 line = (SimpleLine) td.getSGTData(); 469 470 471 /** ***************************** **/ 472 /** *********** AXIS ************ **/ 473 /** ***************************** **/ 474 final SoTRange ynRange; 475 final SoTRange yRange; 476 final SoTRange tnRange; 477 final String yLabel; 478 yRange = line.getYRange(); 479 // yRange.add( line2.getYRange() ); 480 tnRange = line.getXRange(); 481 final Integer intervalsNumber = 10; 482 ynRange = Graph.computeRange( yRange, intervalsNumber ); 483 yLabel = line.getYMetaData().getName(); 484 485 486 /** ***************************** **/ 487 /** *********** LAYERS ********** **/ 488 /** ***************************** **/ 489 /* 490 * xsize, ysize are the width and height in physical units 491 * of the Layer graphics region. 492 * 493 * xstart, xend are the start and end points for the TimeAxis 494 * ystart, yend are the start and end points for the Y axis 495 */ 496 final double xsize = 4.0; 497 final double xstart = 0.6; 498 final double xend = 3.25; 499 final double ysize = 4.0; 500 final double ystart = 0.6; 501 final double yend = 2.50; 502 503 Layer layer2; 504 SGLabel label, title, ytitle; 505 CartesianGraph graph, graph2; 506 LinearTransform xt, yt; 507 PlainAxis yleft; 508 TimeAxis xbot; 509 LineKey lkey; 510 GeoDate stime; 511 512 final Layer layer = new Layer( "First Layer", new Dimension2D( xsize, ysize ) ); 513 514 /** ***************************** **/ 515 /** *********** LEGENDS ********* **/ 516 /** ***************************** **/ 517 /* 518 * create a LineKey 519 * the LineKey will be a legend for the two lines created 520 * position the key in the upper right corner 521 * and add to the first layer 522 */ 523 lkey = new LineKey(); 524 lkey.setId( "Legend" ); 525 lkey.setLocationP( new Point2D.Double( xsize - 1, ysize - 1 ) ); 526 lkey.setVAlign( LineKey.TOP ); 527 lkey.setHAlign( LineKey.RIGHT ); 528 layer.addChild( lkey ); 529 /* 530 * add the first layer to the Pane 531 */ 532 mainPane.add( layer ); 533 /* 534 * create first CartesianGraph and transforms 535 */ 536 graph = new CartesianGraph( "First Graph" ); 537 xt = new LinearTransform( new Range2D( xstart, xend ), tnRange ); 538 graph.setXTransform( xt ); 539 yt = new LinearTransform( new Range2D( ystart, yend ), ynRange ); 540 graph.setYTransform( yt ); 541 /* 542 * Create the time axis, set its range in user units 543 * and its origin. Add the axis to the first graph. 544 */ 545 SoTPoint point = new SoTPoint( ynRange.getStart(), tnRange.getStart() ); 546 xbot = new TimeAxis( "Bottom Axis", TimeAxis.MONTH_YEAR ); 547 xbot.setRangeU( tnRange ); 548 xbot.setLocationU( point ); 549 Font xbfont = new Font( "Helvetica", Font.ITALIC, 14 ); 550 xbot.setLabelFont( xbfont ); 551 xbot.setMinorLabelInterval( 1 ); 552 graph.addXAxis( xbot ); 553 /* 554 * Create the vertical axis, set its range in user units 555 * and its origin. Create the axis title and add the 556 * axis to the first graph. 557 */ 558 yleft = new PlainAxis( "Left Axis" ); 559 yleft.setRangeU( ynRange ); 560 yleft.setLocationU( point ); 561 yleft.setLabelFont( xbfont ); 562 ytitle = new SGLabel( "Y-Axis Title", yLabel, 563 new Point2D.Double( 0.0, 0.0 ) ); 564 Font ytfont = new Font( "Helvetica", Font.PLAIN, 14 ); 565 ytitle.setFont( ytfont ); 566 ytitle.setHeightP( 0.2 ); 567 yleft.setTitle( ytitle ); 568 graph.addYAxis( yleft ); 569 /* 570 * Add the first graph to the first layer. 571 */ 572 layer.setGraph( graph ); 573 /* 574 * Create a LineAttribute for the display of the first 575 * line. Associate the attribute and the line with the 576 * first graph. Add the line to the LineKey. 577 */ 578 LineAttribute attr; 579 580 attr = new LineAttribute( LineAttribute.MARK, 20, Color.red ); 581 attr.setMarkHeightP( 0.1 ); 582 graph.setData( line, attr ); 583 lkey.addLineGraph( (LineCartesianRenderer) graph.getRenderer(), 584 new SGLabel( "1st line", "Red Data", 585 new Point2D.Double( 0.0, 0.0 ) ) ); 586 /* 587 * Create the second layer and add it the the Pane. 588 * Create the second graph and associate it with the 589 * second layer. 590 */ 591 // layer2 = new Layer( "Second Layer", new Dimension2D( xsize, ysize ) ); 592 // mainPane.add( layer2 ); 593 // graph2 = new CartesianGraph( "Second Graph", xt, yt ); 594 // layer2.setGraph( graph2 ); 595 /* 596 * Create a LineAttribute for the display of the second 597 * line. Associate the attribute and the line with the 598 * second graph. Add the line to the LineKey. 599 */ 600 // LineAttribute attr2; 601 // attr2 = new LineAttribute( LineAttribute.MARK, 2, Color.blue ); 602 // attr2.setMarkHeightP( 0.1 ); 603 // graph2.setData( line2, attr2 ); 604 // lkey.addLineGraph( (LineCartesianRenderer) graph2.getRenderer(), 605 // new SGLabel( "2nd line", "Blue Data", 606 // new Point2D.Double( 0.0, 0.0 ) ) ); 607 608 return mainPane; 609 } 610 611 public JPane create2DPlot( @NotNull final MegapoliPlot megapoliPlot ) 612 { 613 /* 614 * This example uses a pre-created "Layout" for raster time 615 * series to simplify the construction of a plot. The 616 * JPlotLayout can plot a single grid with 617 * a ColorKey, time series with a LineKey, point collection with a 618 * PointCollectionKey, and general X-Y plots with a 619 * LineKey. JPlotLayout supports zooming, object selection, and 620 * object editing. 621 */ 622 SGTData newData; 623 TestData td; 624 JPlotLayout rpl; 625 ContourLevels clevels; 626 /* 627 * Create a test grid with sinasoidal-ramp data. 628 */ 629 Range2D xr = new Range2D( 190.0f, 250.0f, 1.0f ); 630 Range2D yr = new Range2D( 0.0f, 45.0f, 1.0f ); 631 td = new TestData( TestData.XY_GRID, xr, yr, 632 TestData.SINE_RAMP, 12.0f, 30.f, 5.0f ); 633 newData = td.getSGTData(); 634 /* 635 * Create the layout without a Logo image and with the 636 * ColorKey on a separate Pane object. 637 */ 638 rpl = new JPlotLayout( true, false, false, "JGridDemo Pane", null, true ); 639 rpl.setEditClasses( false ); 640 /* 641 * Create a GridAttribute for CONTOUR style. 642 */ 643 Range2D datar = new Range2D( -20.0f, 45.0f, 5.0f ); 644 clevels = ContourLevels.getDefault( datar ); 645 GridAttribute gridAttr_ = new GridAttribute( clevels ); 646 /* 647 * Create a ColorMap and change the style to RASTER_CONTOUR. 648 */ 649 ColorMap cmap = createColorMap( datar ); 650 gridAttr_.setColorMap( cmap ); 651 gridAttr_.setStyle( GridAttribute.RASTER_CONTOUR ); 652 /* 653 * Add the grid to the layout and give a label for 654 * the ColorKey. 655 */ 656 rpl.addData( newData, gridAttr_, "First Data" ); 657 /* 658 * Change the layout's three title lines. 659 */ 660 rpl.setTitles( "Raster Plot Demo", 661 "using a JPlotLayout", 662 "" ); 663 /* 664 * Resize the graph and place in the "Center" of the frame. 665 */ 666 rpl.setSize( new Dimension( 600, 400 ) ); 667 /* 668 * Resize the key Pane, both the device size and the physical 669 * size. Set the size of the key in physical units and place 670 * the key pane at the "South" of the frame. 671 */ 672 // rpl.setKeyLayerSizeP(new Dimension2D(6.0, 1.02)); 673 // rpl.setKeyBoundsP(new Rectangle2D.Double(0.01, 1.01, 5.98, 1.0)); 674 675 return rpl; 676 } 677 252 678 /** 253 679 * Create the center JPane with no graph (if no value) … … 364 790 return rpl; 365 791 } 366 367 792 368 793 @NotNull … … 477 902 } 478 903 479 public void makeControlPanel() 480 { 481 // final JPanel controlPanel = new JPanel(); 482 // final ButtonGroup gridtype = new ButtonGroup(); 483 // final JCheckBox stacked = new JCheckBox(); 484 // final JCheckBox grid = new JCheckBox(); 485 // 486 // controlPanel.setLayout( new GridBagLayout() ); 487 //// controlPanel.setBackground(new java.awt.Color(200,200,200)); 488 // controlPanel.setBounds( 0, 679, 426, 33 ); 489 // controlPanel.setBorder( new EtchedBorder() ); 490 // gridtype.add( stacked ); 491 // stacked.setSelected( true ); 492 // stacked.setText( "Overlayed" ); 493 // 494 // GridBagConstraints gbc = new GridBagConstraints(); 495 // gbc.gridx = 0; 496 // gbc.gridy = 0; 497 // gbc.gridwidth = 1; 498 // gbc.gridheight = 1; 499 // gbc.weightx = 0.0; 500 // gbc.weighty = 1.0; 501 // gbc.anchor = GridBagConstraints.EAST; 502 // gbc.fill = GridBagConstraints.BOTH; 503 // gbc.insets = new Insets( 5, 15, 5, 5 ); 504 // gbc.ipadx = 0; 505 // gbc.ipady = 0; 506 // controlPanel.add( stacked, gbc ); 507 // stacked.setBounds( 15, 5, 84, 23 ); 508 // gridtype.add( grid ); 509 // grid.setText( "Grid" ); 510 // 511 // gbc.gridx = 1; 512 // gbc.gridy = 0; 513 // gbc.gridwidth = 1; 514 // gbc.gridheight = 1; 515 // gbc.weightx = 0.5; 516 // gbc.weighty = 1.0; 517 // gbc.anchor = GridBagConstraints.WEST; 518 // gbc.fill = GridBagConstraints.VERTICAL; 519 // gbc.insets = new Insets( 5, 5, 5, 0 ); 520 // gbc.ipadx = 0; 521 // gbc.ipady = 0; 522 // controlPanel.add( grid, gbc ); 523 // grid.setBounds( 109, 5, 53, 23 ); 524 // showTree.setText( "Show Class Tree" ); 525 // 526 // gbc.gridx = 2; 527 // gbc.gridy = 0; 528 // gbc.gridwidth = 1; 529 // gbc.gridheight = 1; 530 // gbc.weightx = 1.0; 531 // gbc.weighty = 1.0; 532 // gbc.anchor = GridBagConstraints.EAST; 533 // gbc.fill = GridBagConstraints.VERTICAL; 534 // gbc.insets = new Insets( 5, 5, 5, 15 ); 535 // gbc.ipadx = 0; 536 // gbc.ipady = 0; 537 // controlPanel.add( showTree, gbc ); 538 // showTree.setBackground( Color.yellow.brighter() ); 539 // showTree.setBounds( 302, 5, 109, 23 ); 540 // 541 // SymItem lSymItem = new SymItem(); 542 // stacked.addItemListener( lSymItem ); 543 // grid.addItemListener( lSymItem ); 544 // SymAction lSymAction = new SymAction(); 545 // showTree.addActionListener( lSymAction ); 546 } 547 904 /** 905 * Change the Pane layout to StackedLayout. 906 * 907 * @param event 908 */ 909 910 void stacked_itemStateChanged( java.awt.event.ItemEvent event ) 911 { 912 /* 913 * Get the component list for mainPane_ and change 914 * the layout to StackedLayout. 915 */ 916 // Component[] comps = mainPane_.getComponents(); 917 // mainPane_.setBatch( true ); 918 // mainPane_.setLayout( new StackedLayout() ); 919 // /* 920 // * Remove any axes that have been associated with 921 // * the second graph. With the layers overlayed it 922 // * is not necessary to have duplicate axes. 923 // */ 924 // Graph gr2 = ( (Layer) comps[1] ).getGraph(); 925 // ( (CartesianGraph) gr2 ).removeAllXAxes(); 926 // ( (CartesianGraph) gr2 ).removeAllYAxes(); 927 // /* 928 // * Tell the Applet that the mainPane_ needs to 929 // * be layed out and re-draw the mainPane_. 930 // */ 931 // if( isApplet_ ) 932 // { 933 // validate(); 934 // } 935 // else 936 // { 937 // frame.validate(); 938 // } 939 // mainPane_.setBatch( false ); 940 // if( tree_ != null ) 941 // { 942 // if( tree_.isVisible() ) 943 // { 944 // tree_.setJPane( mainPane_ ); 945 // tree_.expandTree(); 946 // } 947 // } 948 } 949 950 /** 951 * Change the Pane layout to GridLayout. 952 * 953 * @param event 954 */ 955 956 void grid_itemStateChanged( java.awt.event.ItemEvent event ) 957 { 958 /* 959 * Get the component list for mainPane_ and change 960 * the layout to GridLayout. 961 */ 962 // Component[] comps = mainPane_.getComponents(); 963 // mainPane_.setBatch( true ); 964 // mainPane_.setLayout( new GridLayout( 2, 0 ) ); 965 // /* 966 // * Get the first and second graphs from the first 967 // * and second layers, respectively. 968 // */ 969 // Graph gr = ( (Layer) comps[0] ).getGraph(); 970 // Graph gr2 = ( (Layer) comps[1] ).getGraph(); 971 // /* 972 // * Create copies of all X-Axes associated with the first 973 // * graph for the second graph. If the axes are not copied then 974 // * the second graph will have the second line plotted, but without 975 // * any axes. 976 // */ 977 // for( Enumeration xa = ( (CartesianGraph) gr ).xAxisElements(); xa.hasMoreElements(); ) 978 // { 979 // ( (CartesianGraph) gr2 ).addXAxis( ( (Axis) xa.nextElement() ).copy() ); 980 // } 981 // /* 982 // * Create copies of all Y-Axes associated with the first 983 // * graph for the second graph. 984 // */ 985 // for( Enumeration ya = ( (CartesianGraph) gr ).yAxisElements(); ya.hasMoreElements(); ) 986 // { 987 // ( (CartesianGraph) gr2 ).addYAxis( ( (Axis) ya.nextElement() ).copy() ); 988 // } 989 // /* 990 // * Tell the Applet that the mainPane_ needs to 991 // * be layed out and re-draw the mainPane_. 992 // */ 993 // if( isApplet_ ) 994 // { 995 // validate(); 996 // } 997 // else 998 // { 999 // frame.validate(); 1000 // } 1001 // // mainPane_.draw(); 1002 // mainPane_.setBatch( false ); 1003 // if( tree_ != null ) 1004 // { 1005 // if( tree_.isVisible() ) 1006 // { 1007 // tree_.setJPane( mainPane_ ); 1008 // tree_.expandTree(); 1009 // } 1010 // } 1011 } 1012 1013 void showTree_ActionPerformed( java.awt.event.ActionEvent event ) 1014 { 1015 // /* 1016 // * Create the ClassTree dialog to display the classes used 1017 // * in the mainPane_ and allow editing. 1018 // */ 1019 // if( tree_ == null ) 1020 // { 1021 // tree_ = new JClassTree( "Classes for LayoutDemo" ); 1022 // } 1023 // tree_.setJPane( mainPane_ ); 1024 // tree_.show(); 1025 } 548 1026 549 1027 private static final Log LOGGER = LogFactory.getLog( EtherPlotServiceImpl.class ); -
ether_megapoli/trunk/service/interface/com/ether/EtherPlotService.java
r171 r178 2 2 3 3 import gov.noaa.pmel.sgt.JPane; 4 import gov.noaa.pmel.sgt.dm.SGTData;5 4 import org.jetbrains.annotations.NotNull; 6 5 import org.jetbrains.annotations.Nullable; 7 6 7 import javax.swing.*; 8 8 import java.awt.image.BufferedImage; 9 9 import java.util.Locale; … … 30 30 @NotNull 31 31 public BufferedImage createErrorPane( @NotNull final String mainError, @Nullable final String errorText, @Nullable final Locale locale ); 32 33 @NotNull 34 public JPanel createControlPanel(); 35 36 @NotNull 37 public JPane createTimeSeriePlot( @NotNull final MegapoliPlot megapoliPlot ); 32 38 } -
ether_megapoli/trunk/web/Web.iml
r89 r178 41 41 </facet> 42 42 </component> 43 <component name="NewModuleRootManager" inherit-compiler-output="true"> 43 <component name="NewModuleRootManager" inherit-compiler-output="false"> 44 <output url="file://$MODULE_DIR$/WEB-INF/classes" /> 45 <output-test url="file://$MODULE_DIR$/../out/test/Web" /> 44 46 <exclude-output /> 45 47 <content url="file://$MODULE_DIR$"> -
ether_megapoli/trunk/web/src/com/ether/Controller.java
r172 r178 51 51 throws ServiceException 52 52 { 53 final List<Plateforme> plateforms = _etherService.getAllPlateforms(); 54 // final List<Plateforme> plateforms = new ArrayList<Plateforme>(); 55 // final TypePlateforme type = new TypePlateforme( 1, "FIXE" ); 56 // final Plateforme pf = new Plateforme(); 57 // pf.setPlateformeId( 1 ); 58 // pf.setPlateformeNom( "LHVP" ); 59 // pf.setTypePlateforme( type ); 60 // plateforms.add( pf ); 61 // final Plateforme pf2 = new Plateforme(); 62 // pf2.setPlateformeId( 2 ); 63 // pf2.setPlateformeNom( "SIRTA" ); 64 // pf2.setTypePlateforme( type ); 65 // 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, "MOBILE" ) ); 64 plateforms.add( pf2 ); 66 65 67 66 final Map<String, Object> model = new HashMap<String, Object>(); … … 81 80 throws ServiceException, EtherException 82 81 { 83 final List<Parametre> parametersByPlateform = _etherService.getParametersByPlateformId( plateformId );84 //final List<Parametre> parametersByPlateform = new ArrayList<Parametre>( 2 );85 //final Parametre p1 = new Parametre();86 //p1.setParametreId( 1 );87 //p1.setParametreNom( "JNO2" );88 //parametersByPlateform.add( p1 );89 //final Parametre p2 = new Parametre();90 //p2.setParametreId( 2 );91 //p2.setParametreNom( "CO2" );92 //parametersByPlateform.add( p2 );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 ); 93 92 94 93 final JSONObject result = new JSONObject(); -
ether_megapoli/trunk/web/src/com/ether/ControllerPlot.java
r174 r178 111 111 if( AxeTypeForFixedPlateform.TIME_LINE.name().equals( axeType ) || AxeTypeForFixedPlateform.TIME_POINTS.name().equals( axeType ) ) 112 112 { 113 final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodForTimeSerie( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 113 // final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodForTimeSerie( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 114 final double[] values = new double[50]; 115 final Date[] dates = new Date[50]; 116 final Calendar cal = Calendar.getInstance(); 117 118 for( int i = 0; i < 50; i++ ) 119 { 120 values[i] = (double) i; 121 cal.set( Calendar.MINUTE, 5 * i ); 122 dates[i] = cal.getTime(); 123 } 124 final Data valuesLists = new Data( values, dates ); 125 114 126 megapoliPlot.setData( valuesLists ); 115 127 … … 120 132 else 121 133 { 122 final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodFor2D( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 134 // final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodFor2D( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 135 final double[] latitudeValues = new double[50]; 136 final double[] longitudeValues = new double[50]; 137 final double[] parameterValues = new double[50]; 138 139 for( int i = 0; i < 50; i++ ) 140 { 141 parameterValues[i] = Math.random() * i; 142 latitudeValues[i] = Math.random() * i; 143 longitudeValues[i] = Math.random() * i; 144 } 145 final Data valuesLists = new Data( parameterValues, latitudeValues, longitudeValues ); 146 123 147 megapoliPlot.setData( valuesLists ); 124 148 // final double[] latitudeArray = {2.1, 2.2, 2.3}; -
ether_megapoli/trunk/web/visualization/appletTest.jsp
r176 r178 6 6 <body> 7 7 8 <applet code=" AppletTimeSerie.class" codebase="../WEB-INF-Applets/classes"8 <applet code="com.ether.AppletTemp.class" codebase="../WEB-INF-Applets/classes" 9 9 archive="../lib/spring.jar, ../lib/commons-logging-1.1.1.jar, ../lib/hibernate-all.jar, ../lib/dom4j-1.6.1.jar, ../lib/jta-1.1.jar, ../lib/postgresql-8.2-504.jdbc3.jar, 10 10 ../lib/commons-collections-3.1.jar" … … 19 19 20 20 21 <%--<applet code=" AppletTemp.class" codebase="../appletsClasses_OLD" height="400px" width="400px"></applet>--%>21 <%--<applet code="com.ether.AppletTemp.class" codebase="../appletsClasses_OLD" height="400px" width="400px"></applet>--%> 22 22 23 23 </body> -
ether_megapoli/trunk/web/visualization/visu_parameter_by_pf-script.jsp
r175 r178 294 294 // + "&axeType=" + this.selectAxes.getValue(); 295 295 296 //var url = "visualization/plotEther?plateformId=14"297 //+ "¶meterId=90"298 //+ "&dateBegin=" + this.beginDate299 //+ "&dateEnd=" + this.endDate300 //+ "&title=" + encodeURIComponent( $( "textareaTitle" ).value )301 //+ "&axeType=" + this.selectAxes.getValue();302 303 //this.plotWindow.getContent().innerHTML = '<img src=' + url + ' />';304 305 this.plotWindow.getContent().innerHTML = '<applet code="AppletTimeSerie.class" codebase="<%=request.getContextPath()%>/applets" height="400px" width="400px"> ' +306 '<param name="plateformId" value="14"> ' +307 '<param name="parameterId" value="90"> ' +308 '<param name="dateBegin" value=""> ' +309 '<param name="dateEnd" value=""> ' +310 '<param name="title" value="zzzz"> ' +311 '<param name="axeType" value="MOBILE"> ' +312 '</applet>';296 var url = "visualization/plotEther?plateformId=14" 297 + "¶meterId=90" 298 + "&dateBegin=" + this.beginDate 299 + "&dateEnd=" + this.endDate 300 + "&title=" + encodeURIComponent( $( "textareaTitle" ).value ) 301 + "&axeType=" + this.selectAxes.getValue(); 302 303 this.plotWindow.getContent().innerHTML = '<img src=' + url + ' />'; 304 305 <%--this.plotWindow.getContent().innerHTML = '<applet code="AppletTimeSerie.class" codebase="<%=request.getContextPath()%>/applets" height="400px" width="400px"> ' +--%> 306 <%--'<param name="plateformId" value="14"> ' +--%> 307 <%--'<param name="parameterId" value="90"> ' +--%> 308 <%--'<param name="dateBegin" value=""> ' +--%> 309 <%--'<param name="dateEnd" value=""> ' +--%> 310 <%--'<param name="title" value="zzzz"> ' +--%> 311 <%--'<param name="axeType" value="MOBILE"> ' +--%> 312 <%--'</applet>';--%> 313 313 this.plotWindow.setSize( <%=EtherPlotServiceImpl.getMaxWidth()%>, <%=EtherPlotServiceImpl.getMaxHeight()%> ); 314 314 this.plotWindow.show();
Note: See TracChangeset
for help on using the changeset viewer.