Rev 1568 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1568 | Rev 1570 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | package dongfang.mkt.ui.offscreendisplay; |
1 | package dongfang.mkt.ui.offscreendisplay; |
Line 2... | Line 2... | ||
2 | 2 | ||
- | 3 | import java.awt.BorderLayout; |
|
3 | import java.awt.BorderLayout; |
4 | import java.awt.Font; |
4 | import java.awt.GridLayout; |
5 | import java.awt.GridLayout; |
5 | import java.util.Formatter; |
6 | import java.util.Formatter; |
6 | import java.util.Locale; |
7 | import java.util.Locale; |
7 | import java.util.Timer; |
8 | import java.util.Timer; |
Line 15... | Line 16... | ||
15 | import javax.swing.border.Border; |
16 | import javax.swing.border.Border; |
Line 16... | Line 17... | ||
16 | 17 | ||
Line 17... | Line 18... | ||
17 | import dongfang.mkt.frames.OSDDataResponseFrame; |
18 | import dongfang.mkt.frames.OSDDataResponseFrame; |
- | 19 | ||
- | 20 | public class VariousInfoPane extends JPanel implements OSDDataConsumer { |
|
- | 21 | ||
- | 22 | static class BigLabel extends JLabel { |
|
- | 23 | public BigLabel() { |
|
- | 24 | super(); |
|
- | 25 | setFont(getFont().deriveFont(Font.BOLD, 16)); |
|
Line 18... | Line 26... | ||
18 | 26 | } |
|
19 | public class VariousInfoPane extends JPanel implements OSDDataConsumer { |
27 | } |
20 | 28 | ||
21 | class PositionsPanel extends JPanel implements OSDDataConsumer { |
29 | class PositionsPanel extends JPanel implements OSDDataConsumer { |
Line 22... | Line 30... | ||
22 | class CurrentPositionPanel extends JPanel { |
30 | class CurrentPositionPanel extends JPanel { |
23 | JLabel lat; |
31 | BigLabel lat; |
24 | JLabel lon; |
32 | BigLabel lon; |
25 | 33 | ||
Line 26... | Line 34... | ||
26 | void init() { |
34 | void init() { |
27 | lat = new JLabel(); |
35 | lat = new BigLabel(); |
28 | lon = new JLabel(); |
36 | lon = new BigLabel(); |
Line 45... | Line 53... | ||
45 | layoutSubs(); |
53 | layoutSubs(); |
46 | } |
54 | } |
47 | } |
55 | } |
Line 48... | Line 56... | ||
48 | 56 | ||
49 | class HomePositionPanel extends CurrentPositionPanel { |
57 | class HomePositionPanel extends CurrentPositionPanel { |
Line 50... | Line 58... | ||
50 | JLabel home; |
58 | BigLabel home; |
51 | 59 | ||
52 | void init() { |
60 | void init() { |
53 | super.init(); |
61 | super.init(); |
Line 54... | Line 62... | ||
54 | home = new JLabel(); |
62 | home = new BigLabel(); |
55 | } |
63 | } |
56 | 64 | ||
Line 116... | Line 124... | ||
116 | } |
124 | } |
117 | } |
125 | } |
Line 118... | Line 126... | ||
118 | 126 | ||
119 | class HeightsPanel extends JPanel implements OSDDataConsumer { |
127 | class HeightsPanel extends JPanel implements OSDDataConsumer { |
120 | class HeightPanel extends JPanel implements OSDDataConsumer { |
128 | class HeightPanel extends JPanel implements OSDDataConsumer { |
121 | JLabel baroHeight; |
129 | BigLabel baroHeight; |
122 | JLabel GPSHeight; |
130 | BigLabel GPSHeight; |
123 | JLabel baroVVI; |
131 | BigLabel baroVVI; |
Line 124... | Line 132... | ||
124 | JLabel GPSVVI; |
132 | BigLabel GPSVVI; |
125 | 133 | ||
126 | void init() { |
134 | void init() { |
127 | baroHeight = new JLabel(); |
135 | baroHeight = new BigLabel(); |
128 | GPSHeight = new JLabel(); |
136 | GPSHeight = new BigLabel(); |
129 | baroVVI = new JLabel(); |
137 | baroVVI = new BigLabel(); |
Line 130... | Line 138... | ||
130 | GPSVVI = new JLabel(); |
138 | GPSVVI = new BigLabel(); |
131 | } |
139 | } |
132 | 140 | ||
Line 201... | Line 209... | ||
201 | vvi.setValue((int) (data.getVerticalVelocityByPressure() * 50)); |
209 | vvi.setValue((int) (data.getVerticalVelocityByPressure() * 50)); |
202 | } |
210 | } |
203 | } |
211 | } |
Line 204... | Line 212... | ||
204 | 212 | ||
205 | class SpeedHeadingPanel extends JPanel implements OSDDataConsumer { |
213 | class SpeedHeadingPanel extends JPanel implements OSDDataConsumer { |
206 | JLabel noseDirection; |
214 | BigLabel noseDirection; |
207 | JLabel flightDirection; |
215 | BigLabel flightDirection; |
Line 208... | Line 216... | ||
208 | JLabel speed; |
216 | BigLabel speed; |
209 | 217 | ||
210 | void init() { |
218 | void init() { |
211 | noseDirection = new JLabel(); |
219 | noseDirection = new BigLabel(); |
212 | flightDirection = new JLabel(); |
220 | flightDirection = new BigLabel(); |
213 | speed = new JLabel(); |
221 | speed = new BigLabel(); |
214 | Border b = BorderFactory.createTitledBorder( |
222 | Border b = BorderFactory.createTitledBorder( |
215 | BorderFactory.createEtchedBorder(), "Speed and heading"); |
223 | BorderFactory.createEtchedBorder(), "Speed and heading"); |
Line 251... | Line 259... | ||
251 | } |
259 | } |
Line 252... | Line 260... | ||
252 | 260 | ||
253 | class StatusPanel extends JPanel implements OSDDataConsumer { |
261 | class StatusPanel extends JPanel implements OSDDataConsumer { |
254 | JProgressBar dataAgeProgress; |
262 | JProgressBar dataAgeProgress; |
- | 263 | JProgressBar battery; |
|
Line 255... | Line 264... | ||
255 | JProgressBar battery; |
264 | BigLabel numberOfSatellites; |
Line 256... | Line 265... | ||
256 | 265 | ||
257 | long dataTime = 0; |
266 | long dataTime = 0; |
258 | 267 | ||
- | 268 | void init() { |
|
Line 259... | Line 269... | ||
259 | void init() { |
269 | dataAgeProgress = new JProgressBar(0, 5000); |
260 | dataAgeProgress = new JProgressBar(0, 5000); |
270 | battery = new JProgressBar(100, 130); |
261 | battery = new JProgressBar(100, 130); |
271 | numberOfSatellites = new BigLabel(); |
262 | 272 | ||
Line 280... | Line 290... | ||
280 | Timer t = new Timer(); |
290 | Timer t = new Timer(); |
281 | t.schedule(dataAgeTask, 0, 200); |
291 | t.schedule(dataAgeTask, 0, 200); |
282 | } |
292 | } |
Line 283... | Line 293... | ||
283 | 293 | ||
284 | int getNumRows() { |
294 | int getNumRows() { |
285 | return 2; |
295 | return 3; |
Line 286... | Line 296... | ||
286 | } |
296 | } |
287 | 297 | ||
288 | void layoutSubs() { |
298 | void layoutSubs() { |
289 | add(new JLabel("Data age")); |
299 | add(new JLabel("Data age")); |
290 | add(dataAgeProgress); |
300 | add(dataAgeProgress); |
- | 301 | add(new JLabel("Battery")); |
|
- | 302 | add(battery); |
|
291 | add(new JLabel("Battery")); |
303 | add(new JLabel("Satellites")); |
Line 292... | Line 304... | ||
292 | add(battery); |
304 | add(numberOfSatellites); |
293 | } |
305 | } |
294 | 306 | ||
Line 301... | Line 313... | ||
301 | public void update(OSDDataResponseFrame data, long timestamp) { |
313 | public void update(OSDDataResponseFrame data, long timestamp) { |
302 | if (data == null) |
314 | if (data == null) |
303 | return; |
315 | return; |
304 | dataTime = System.currentTimeMillis(); |
316 | dataTime = System.currentTimeMillis(); |
305 | battery.setValue(data.getBatteryVoltage()); |
317 | battery.setValue(data.getBatteryVoltage()); |
- | 318 | numberOfSatellites.setText("" + data.getNumberOfSatellites()); |
|
306 | } |
319 | } |
307 | } |
320 | } |
Line 308... | Line 321... | ||
308 | 321 | ||
309 | StatusPanel status = new StatusPanel(); |
322 | StatusPanel status = new StatusPanel(); |