Revision 4829 trunk/extensions/extGPS/src/org/gvsig/gps/panel/GPSControlPanel.java
GPSControlPanel.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.16 2006-04-12 06:51:56 jaume
|
|
46 |
* Revision 1.17 2006-04-12 10:03:32 jaume
|
|
47 | 47 |
* *** empty log message *** |
48 | 48 |
* |
49 |
* Revision 1.16 2006/04/12 06:51:56 jaume |
|
50 |
* *** empty log message *** |
|
51 |
* |
|
49 | 52 |
* Revision 1.14 2006/04/11 13:19:51 jaume |
50 | 53 |
* *** empty log message *** |
51 | 54 |
* |
... | ... | |
116 | 119 |
import com.iver.andami.ui.mdiManager.SingletonView; |
117 | 120 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
118 | 121 |
import com.iver.utiles.XMLEntity; |
122 |
import com.sun.media.jai.util.Rational; |
|
119 | 123 |
/** |
120 | 124 |
* Singleton view that allows the user to monitorize and configure the |
121 | 125 |
* status of the GPS. |
... | ... | |
139 | 143 |
private int dataBits; |
140 | 144 |
private int stopBits; |
141 | 145 |
private int parity; |
146 |
private boolean paused; |
|
142 | 147 |
|
143 | 148 |
private final static Extension thisExtension = PluginServices.getExtension(GPSExtension.class); |
144 | 149 |
private final static String kPos = PluginServices.getText(thisExtension, "GEO_position"); |
... | ... | |
333 | 338 |
btnPause = new JButton(); |
334 | 339 |
btnPause.setBounds(289, 405, 70, 25); |
335 | 340 |
btnPause.setText("pause"); |
341 |
paused = false; |
|
336 | 342 |
btnPause.addActionListener(new java.awt.event.ActionListener() { |
337 | 343 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
338 |
gps.silence();
|
|
344 |
pause();
|
|
339 | 345 |
} |
340 | 346 |
}); |
341 | 347 |
} |
342 | 348 |
return btnPause; |
343 | 349 |
} |
344 | 350 |
|
351 |
private void pause() { |
|
352 |
getBtnPause().setText((paused) ? PluginServices.getText(this, "pause") : PluginServices.getText(this, "resume") ); |
|
353 |
if (paused) |
|
354 |
gps.connect(); |
|
355 |
else |
|
356 |
gps.silence(); |
|
357 |
paused = !paused; |
|
358 |
} |
|
359 |
|
|
345 | 360 |
/** |
346 | 361 |
* This method initializes btnStop |
347 | 362 |
* |
... | ... | |
353 | 368 |
btnStop.setBounds(409, 405, 70, 25); |
354 | 369 |
btnStop.setText("stop"); |
355 | 370 |
btnStop.addActionListener(new java.awt.event.ActionListener() { |
356 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
357 |
gps.closePort(); |
|
371 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
372 |
stop(); |
|
373 |
|
|
358 | 374 |
} |
359 | 375 |
}); |
360 | 376 |
alreadyStarted = false; |
... | ... | |
362 | 378 |
return btnStop; |
363 | 379 |
} |
364 | 380 |
|
381 |
private void stop() { |
|
382 |
alreadyStarted = false; |
|
383 |
getBtnPause().setEnabled(false); |
|
384 |
getBtnPause().setText(PluginServices.getText(this, "pause")); |
|
385 |
getBtnStart().setEnabled(true); |
|
386 |
gps.close(); |
|
387 |
} |
|
388 |
|
|
365 | 389 |
protected void refresh() { |
366 | 390 |
this.repaint(); |
367 | 391 |
} |
... | ... | |
371 | 395 |
try { |
372 | 396 |
|
373 | 397 |
gps.setPort(port, portSpeed, dataBits, stopBits, parity); |
374 |
|
|
398 |
model.clear(); |
|
399 |
refreshTable(); |
|
400 |
paused = false; |
|
401 |
getBtnPause().setText(PluginServices.getText(this, "pause")); |
|
402 |
getBtnPause().setEnabled(true); |
|
403 |
getBtnStart().setEnabled(false); |
|
375 | 404 |
gps.addEventListener(new GPSEventListener() { |
376 | 405 |
private TableModelEvent e = new TableModelEvent(model); |
377 | 406 |
public void unhandledMessage(String message) { |
... | ... | |
429 | 458 |
} |
430 | 459 |
|
431 | 460 |
}); |
432 |
gps.start();
|
|
461 |
gps.connect();
|
|
433 | 462 |
alreadyStarted = true; |
434 | 463 |
} catch (PortInUseException e) { |
435 | 464 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "port_in_use")); |
... | ... | |
556 | 585 |
return "GPS Control Panel"; |
557 | 586 |
} |
558 | 587 |
|
588 |
public int getSampleRate() { |
|
589 |
return gps.getSampleRate(); |
|
590 |
} |
|
591 |
|
|
559 | 592 |
} // @jve:decl-index=0:visual-constraint="10,10" |
560 | 593 |
|
561 | 594 |
|
Also available in: Unified diff