1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
package com.iailab.netsdk.demo.frame.ThermalCamera;
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.Vector;
 
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
 
import com.iailab.netsdk.common.BorderEx;
import com.iailab.netsdk.common.DateChooserJButton;
import com.iailab.netsdk.common.Res;
import com.iailab.netsdk.demo.module.ThermalCameraModule;
import com.iailab.netsdk.lib.NetSDKLib.*;
import com.iailab.netsdk.lib.ToolKits;
 
public class TemperQueryDialog extends JDialog{
 
    
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    private NET_IN_RADIOMETRY_STARTFIND stuStartFind = new NET_IN_RADIOMETRY_STARTFIND();
    
    public TemperQueryDialog() {
        setTitle(Res.string().getShowInfo("TEMPER_INFO"));
        setLayout(new BorderLayout());
        setModal(true);
        pack();
        setSize(800, 550);
        setResizable(false);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        
        ///////////////////////////////
        queryPanel = new QueryPanel();
        showPanel = new QueryShowPanel();
        
        add(queryPanel, BorderLayout.NORTH);
        add(showPanel, BorderLayout.CENTER);
 
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e){
                try {
                    ThermalCameraModule.stopFind();
                }finally {
                    dispose();
                }
            }
        });
    }
    
    public void setSearchEnable(boolean b) {
        showPanel.setButtonEnable(b);
        queryPanel.setButtonEnable(b);
    }
    
    public void queryHistoryInfo(final QUERY_TYPE type) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                setSearchEnable(false);
                if (type == QUERY_TYPE.FIRST_PAGE_QUERY) {
                    showPanel.clearData();
                }
            }
        });
        new QuerySwingWorker(type).execute();
    }
    
    /**
     * 查询界面
     * */
    public class QueryPanel extends JPanel {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;
        
        public QueryPanel() {
            BorderEx.set(this, Res.string().getShowInfo("QUERY_CONDITION"), 1);
            setLayout(new BorderLayout());            
 
            JLabel startTimeLabel = new JLabel(Res.string().getShowInfo("START_TIME"), JLabel.LEFT);
            startTimeBtn = new DateChooserJButton();
            JLabel endTimeLabel = new JLabel(Res.string().getShowInfo("END_TIME"), JLabel.LEFT);
            endTimeBtn = new DateChooserJButton();
            JLabel meterTypeLabel = new JLabel(Res.string().getShowInfo("METER_TYPE"), JLabel.LEFT);
            meterTypeComboBox = new JComboBox();
            meterTypeComboBox.setModel(new DefaultComboBoxModel(Res.string().getMeterTypeList()));
            JLabel periodLabel = new JLabel(Res.string().getShowInfo("SAVE_PERIOD"), JLabel.LEFT);
            periodComboBox = new JComboBox();
            periodComboBox.setModel(new DefaultComboBoxModel(Res.string().getPeriodList()));
            queryBtn = new JButton(Res.string().getShowInfo("QUERY"));
            
            Dimension lableDimension = new Dimension(85, 20);
            Dimension btnDimension = new Dimension(125, 20);
            
            startTimeLabel.setPreferredSize(lableDimension);
            startTimeBtn.setPreferredSize(btnDimension);
            endTimeLabel.setPreferredSize(lableDimension);
            endTimeBtn.setPreferredSize(btnDimension);
            meterTypeLabel.setPreferredSize(lableDimension);
            meterTypeComboBox.setPreferredSize(btnDimension);
            periodLabel.setPreferredSize(lableDimension);
            periodComboBox.setPreferredSize(btnDimension);
            queryBtn.setPreferredSize(btnDimension);
            
            JPanel startTimePanel = new JPanel();
            startTimePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
            startTimePanel.add(startTimeLabel);
            startTimePanel.add(startTimeBtn);
            JPanel endTimePanel = new JPanel();
            endTimePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
            endTimePanel.add(endTimeLabel);
            endTimePanel.add(endTimeBtn);
            JPanel topPanel = new JPanel();
            topPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 2));
            topPanel.add(startTimePanel);
            topPanel.add(endTimePanel);
            
            JPanel meterTypePanel = new JPanel();
            meterTypePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
            meterTypePanel.add(meterTypeLabel);
            meterTypePanel.add(meterTypeComboBox);
            JPanel periodPanel = new JPanel();
            periodPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
            periodPanel.add(periodLabel);
            periodPanel.add(periodComboBox);
            JPanel bottomPanel = new JPanel();
            bottomPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 2));
            bottomPanel.add(meterTypePanel);
            bottomPanel.add(periodPanel);
            
            JPanel leftPanel = new JPanel(new GridLayout(2,1));
            BorderEx.set(leftPanel, "", 1);
            leftPanel.add(topPanel);
            leftPanel.add(bottomPanel);
            
            JPanel rightPanel = new JPanel();
            rightPanel.setLayout(null);
            BorderEx.set(rightPanel, "", 1);
            queryBtn.setBounds(50, 30, 125, 20);
            rightPanel.add(queryBtn);
            
            JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel);
            pane.setDividerSize(0);
            pane.setBorder(null);
            
            add(pane, BorderLayout.CENTER);
            
            queryBtn.addActionListener(new ActionListener() {
 
                @Override
                public void actionPerformed(ActionEvent e) {
                    setStuStartFind();
                    queryHistoryInfo(QUERY_TYPE.FIRST_PAGE_QUERY);
                }
            });
        }
        
        private void setStuStartFind() {
            
            setTime(stuStartFind.stStartTime, startTimeBtn.getText());
            setTime(stuStartFind.stEndTime, endTimeBtn.getText());
            stuStartFind.nMeterType = meterTypeComboBox.getSelectedIndex() + 1;
            stuStartFind.nChannel = ThermalCameraFrame.THERMAL_CHANNEL;
            int[] arrPeriod = {5, 10, 15, 30};
            stuStartFind.emPeriod = arrPeriod[periodComboBox.getSelectedIndex()];
        }
        
        private void setTime(NET_TIME netTime, String date) {
  
            String[] dateTime = date.split(" ");
            String[] arrDate = dateTime[0].split("-");
            String[] arrTime = dateTime[1].split(":");
            
            netTime.dwYear = Integer.parseInt(arrDate[0]);
            netTime.dwMonth = Integer.parseInt(arrDate[1]);
            netTime.dwDay = Integer.parseInt(arrDate[2]);
            netTime.dwHour = Integer.parseInt(arrTime[0]);
            netTime.dwMinute = Integer.parseInt(arrTime[1]);
            netTime.dwSecond = Integer.parseInt(arrTime[2]);
        }
        
        public void setButtonEnable(boolean b) {
            queryBtn.setEnabled(b);
        }
                
        private DateChooserJButton startTimeBtn;
        private DateChooserJButton endTimeBtn;
        private JComboBox meterTypeComboBox;
        private JComboBox periodComboBox;
        private JButton queryBtn;
    }
    
    /**
     * 热成像查询结果信息显示界面
     * */
    public class QueryShowPanel extends JPanel {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;
        public static final int INDEX = 0;
        public static final int RECORD_TIME = 1;
        public static final int PRESET_ID = 2;
        public static final int RULE_ID = 3;
        public static final int ITEM_NAME = 4;
        public static final int CHANNEL = 5;
        public static final int COORDINATE = 6;
        public static final int METER_TYPE = 7;
        public static final int TEMPER_UNIT = 8;
        public static final int TEMPER_AVER = 9;
        public static final int TEMPER_MAX = 10;
        public static final int TEMPER_MIN = 11;
        public static final int TEMPER_MID = 12;
        public static final int TEMPER_STD = 13;
        
        public final static int QUERY_SHOW_COUNT = 20; // 查询个数
        private int currentIndex = 0;        // 实际显示个数
        
        private String [] arrMeterType = Res.string().getMeterTypeList();
        private String [] arrTemperUnit = Res.string().getTemperUnitList(); // 减少次数
        
        public QueryShowPanel() {
            BorderEx.set(this, Res.string().getShowInfo("QUERY_LIST"), 1);
            setLayout(new BorderLayout());
            
            String[] columnNames = {
                    Res.string().getShowInfo("INDEX"), Res.string().getShowInfo("RECORD_TIME"),
                    Res.string().getShowInfo("PRESET_ID"), Res.string().getShowInfo("RULE_ID"),
                    Res.string().getShowInfo("ITEM_NAME"), Res.string().getShowInfo("CHANNEL"),
                    Res.string().getShowInfo("COORDINATE"), Res.string().getShowInfo("METER_TYPE"),
                    Res.string().getShowInfo("TEMPER_UNIT"), Res.string().getShowInfo("TEMPER_AVER"),
                    Res.string().getShowInfo("TEMPER_MAX"), Res.string().getShowInfo("TEMPER_MIN"),
                    Res.string().getShowInfo("TEMPER_MID"), Res.string().getShowInfo("TEMPER_STD")
            };
                        
            tableModel = new DefaultTableModel(null, columnNames);
            table = new JTable(tableModel) {
                private static final long serialVersionUID = 1L;
 
                public boolean isCellEditable(int rowIndex, int columnIndex) { // 不可编辑
                    return false;
                }
            };
 
            tableModel.setRowCount(QUERY_SHOW_COUNT);    // 设置最小显示行
            
            table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);  // 只能选中一行
            
            Enumeration<TableColumn> columns = table.getColumnModel().getColumns();
            while (columns.hasMoreElements()) {
                columns.nextElement().setPreferredWidth(140);
            }
            
            table.getColumnModel().getColumn(RECORD_TIME).setPreferredWidth(140);
            table.getColumnModel().getColumn(ITEM_NAME).setPreferredWidth(180);
 
            ((DefaultTableCellRenderer)
                    table.getTableHeader().getDefaultRenderer()).setHorizontalAlignment(SwingConstants.CENTER);
            
            DefaultTableCellRenderer tcr = new DefaultTableCellRenderer();
            tcr.setHorizontalAlignment(SwingConstants.CENTER);
            table.setDefaultRenderer(Object.class, tcr);
                        
            table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            
            JScrollPane scrollPane = new JScrollPane(table);
            scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
            scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
            
            JPanel functionPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 120, 5));
            prePageBtn = new JButton(Res.string().getPreviousPage());
            nextPageBtn = new JButton(Res.string().getNextPage());
            prePageBtn.setPreferredSize(new Dimension(120, 20));
            nextPageBtn.setPreferredSize(new Dimension(120, 20));
            
            setButtonEnable(false);
            
//            functionPanel.add(prePageBtn);
            functionPanel.add(nextPageBtn);
            
            add(scrollPane, BorderLayout.CENTER);
            add(functionPanel, BorderLayout.SOUTH);
            
            prePageBtn.addActionListener(new ActionListener() {
 
                @Override
                public void actionPerformed(ActionEvent e) {
                    queryHistoryInfo(QUERY_TYPE.PRE_PAGE_QUERY);
                }
            });
            
            nextPageBtn.addActionListener(new ActionListener() {
 
                @Override
                public void actionPerformed(ActionEvent e) {
                    queryHistoryInfo(QUERY_TYPE.NEXT_PAGE_QUERY);
                }
            });
        }
        
        public void setButtonEnable(boolean b) {
    
            prePageBtn.setEnabled(false);
            nextPageBtn.setEnabled(false);
            
            if (b) {
                if (currentIndex < ThermalCameraModule.getTotalCount()) {
                    nextPageBtn.setEnabled(true);
                }
                
                if (currentIndex > QUERY_SHOW_COUNT) {
                    prePageBtn.setEnabled(true);
                }
            }
        }
        
        public int getIndex() {
            return currentIndex;
        }
        
        public void setIndex(int index) {
            currentIndex = index;
        }
        
        public void insertData(NET_OUT_RADIOMETRY_DOFIND stuDoFind) {
            if (stuDoFind == null) {
                return;
            }
            
            tableModel.setRowCount(0);
            for (int i = 0; i < stuDoFind.nFound; ++i) {
                insertData(stuDoFind.stInfo[i]);
            }
 
            tableModel.setRowCount(QUERY_SHOW_COUNT);
            table.updateUI();
        }
    
        private void insertData(NET_RADIOMETRY_QUERY data) {
            ++currentIndex;
            Vector<String> vector = new Vector<String>();
            
            vector.add(String.valueOf(currentIndex));
            vector.add(data.stTime.toStringTimeEx());
            vector.add(String.valueOf(data.nPresetId));
            vector.add(String.valueOf(data.nRuleId));
            try {
                vector.add(new String(data.szName, "GBK").trim());
            } catch (UnsupportedEncodingException e) {
                vector.add(new String(data.szName).trim());
            }
            vector.add(String.valueOf(data.nChannel));
            
            if (data.stTemperInfo.nMeterType == NET_RADIOMETRY_METERTYPE.NET_RADIOMETRY_METERTYPE_SPOT) {
                vector.add("(" + data.stCoordinates[0].nx + "," + data.stCoordinates[0].ny + ")");
            }else if(data.stTemperInfo.nMeterType == NET_RADIOMETRY_METERTYPE.NET_RADIOMETRY_METERTYPE_LINE){
                vector.add("(" + data.stCoordinates[0].nx + "," + data.stCoordinates[0].ny + "),(" + data.stCoordinates[1].nx + "," + data.stCoordinates[1].ny + ")");
            }else{
                switch(data.nCoordinateNum){
                case 3:
                    vector.add("(" + data.stCoordinates[0].nx + "," + data.stCoordinates[0].ny + "),"
                            + "(" + data.stCoordinates[1].nx + "," + data.stCoordinates[1].ny + "),"
                            + "(" + data.stCoordinates[2].nx + "," + data.stCoordinates[2].ny + ")");
                    break;
                case 4:
                    vector.add("(" + data.stCoordinates[0].nx + "," + data.stCoordinates[0].ny + "),"
                            + "(" + data.stCoordinates[1].nx + "," + data.stCoordinates[1].ny + "),"
                            + "(" + data.stCoordinates[2].nx + "," + data.stCoordinates[2].ny + "),"
                            + "(" + data.stCoordinates[3].nx + "," + data.stCoordinates[3].ny + ")");
                    break;
                case 5:
                    vector.add("(" + data.stCoordinates[0].nx + "," + data.stCoordinates[0].ny + "),"
                            + "(" + data.stCoordinates[1].nx + "," + data.stCoordinates[1].ny + "),"
                            + "(" + data.stCoordinates[2].nx + "," + data.stCoordinates[2].ny + "),"
                            + "(" + data.stCoordinates[3].nx + "," + data.stCoordinates[3].ny + "),"
                            + "(" + data.stCoordinates[4].nx + "," + data.stCoordinates[4].ny + ")");
                    break;
                case 6:
                    vector.add("(" + data.stCoordinates[0].nx + "," + data.stCoordinates[0].ny + "),"
                            + "(" + data.stCoordinates[1].nx + "," + data.stCoordinates[1].ny + "),"
                            + "(" + data.stCoordinates[2].nx + "," + data.stCoordinates[2].ny + "),"
                            + "(" + data.stCoordinates[3].nx + "," + data.stCoordinates[3].ny + "),"
                            + "(" + data.stCoordinates[4].nx + "," + data.stCoordinates[4].ny + "),"
                            + "(" + data.stCoordinates[5].nx + "," + data.stCoordinates[5].ny + "),");
                    break;
                case 7:
                    vector.add("(" + data.stCoordinates[0].nx + "," + data.stCoordinates[0].ny + "),"
                            + "(" + data.stCoordinates[1].nx + "," + data.stCoordinates[1].ny + "),"
                            + "(" + data.stCoordinates[2].nx + "," + data.stCoordinates[2].ny + "),"
                            + "(" + data.stCoordinates[3].nx + "," + data.stCoordinates[3].ny + "),"
                            + "(" + data.stCoordinates[4].nx + "," + data.stCoordinates[4].ny + "),"
                            + "(" + data.stCoordinates[5].nx + "," + data.stCoordinates[5].ny + "),"
                            + "(" + data.stCoordinates[6].nx + "," + data.stCoordinates[6].ny + ")");
                    break;
                case 8:
                    vector.add("(" + data.stCoordinates[0].nx + "," + data.stCoordinates[0].ny + "),"
                            + "(" + data.stCoordinates[1].nx + "," + data.stCoordinates[1].ny + "),"
                            + "(" + data.stCoordinates[2].nx + "," + data.stCoordinates[2].ny + "),"
                            + "(" + data.stCoordinates[3].nx + "," + data.stCoordinates[3].ny + "),"
                            + "(" + data.stCoordinates[4].nx + "," + data.stCoordinates[4].ny + "),"
                            + "(" + data.stCoordinates[5].nx + "," + data.stCoordinates[5].ny + "),"
                            + "(" + data.stCoordinates[6].nx + "," + data.stCoordinates[6].ny + "),"
                            + "(" + data.stCoordinates[7].nx + "," + data.stCoordinates[7].ny + ")");
                    break;
                }
            }
            
            if (data.stTemperInfo.nMeterType >= 1 && 
                    data.stTemperInfo.nMeterType <= arrMeterType.length) {
                vector.add(arrMeterType[data.stTemperInfo.nMeterType-1]);
            }else {
                vector.add(Res.string().getShowInfo("UNKNOWN"));
            }
            
            if (data.stTemperInfo.nTemperUnit >= 1 && 
                    data.stTemperInfo.nTemperUnit <= arrTemperUnit.length) {
                vector.add(arrTemperUnit[data.stTemperInfo.nTemperUnit-1]);
            }else {
                vector.add(Res.string().getShowInfo("UNKNOWN"));
            }
            
            vector.add(String.valueOf(data.stTemperInfo.fTemperAver));
            vector.add(String.valueOf(data.stTemperInfo.fTemperMax));
            vector.add(String.valueOf(data.stTemperInfo.fTemperMin));
            vector.add(String.valueOf(data.stTemperInfo.fTemperMid));
            vector.add(String.valueOf(data.stTemperInfo.fTemperStd));
            
            tableModel.addRow(vector);
        }
            
        public void clearData() {
            currentIndex = 0;
            tableModel.setRowCount(0);
            tableModel.setRowCount(QUERY_SHOW_COUNT);
            table.updateUI();
            setButtonEnable(false);
        }
        
        private JTable table = null;
        private DefaultTableModel tableModel = null;
        public JButton prePageBtn;
        public JButton nextPageBtn;
    }
    
    /**
     * 查询类型
     * */
    public enum QUERY_TYPE {
        UNKNOWN,                        // 未知
        FIRST_PAGE_QUERY,                // 第一页
        PRE_PAGE_QUERY,                    // 上一页
        NEXT_PAGE_QUERY                    // 下一页
    };
    
    /**
     * 查找工作线程(完成异步搜索)
     */
    public class QuerySwingWorker extends SwingWorker<NET_OUT_RADIOMETRY_DOFIND, Object> {
        
        private QUERY_TYPE type;
        private int offset = 0;
        
        public QuerySwingWorker(QUERY_TYPE type) {
            this.type = type;
        }
        
        protected NET_OUT_RADIOMETRY_DOFIND doInBackground() {
 
            int currentIndex = showPanel.getIndex();
            try {
                switch(type) {
                    case FIRST_PAGE_QUERY:
                        ThermalCameraModule.stopFind();
                        if (!ThermalCameraModule.startFind(stuStartFind)) {
                            return null;
                        }
                        offset = 0;
                        break;
                    case PRE_PAGE_QUERY:
                        offset = ((currentIndex-1)/QueryShowPanel.QUERY_SHOW_COUNT-1) * QueryShowPanel.QUERY_SHOW_COUNT;
                        break;
                    case NEXT_PAGE_QUERY:
                        offset = currentIndex;
                        break;
                    default:
                        break;
                }
                
                
                NET_OUT_RADIOMETRY_DOFIND stuDoFind = ThermalCameraModule.doFind(offset, QueryShowPanel.QUERY_SHOW_COUNT);
    
                return stuDoFind;
            }catch (Exception e) {
                System.out.println(" -------- doInBackground Exception -------- ");
            }
            return null;
        }
        
        @Override
        protected void done() {    
            
            try {
 
                NET_OUT_RADIOMETRY_DOFIND stuDoFind = get();
                if (stuDoFind == null) {
                    JOptionPane.showMessageDialog(null, ToolKits.getErrorCodeShow(), Res.string().getErrorMessage(), JOptionPane.ERROR_MESSAGE);
                    return;
                }
                
//                System.out.println("offset " + offset + " nFound " + stuDoFind.nFound + " Total " + ThermalCameraModule.getTotalCount());
 
                if (stuDoFind.nFound == 0) {
                    JOptionPane.showMessageDialog(null, Res.string().getFailed(), Res.string().getErrorMessage(), JOptionPane.ERROR_MESSAGE);
                    return;
                }
                
                showPanel.setIndex(offset);
                showPanel.insertData(stuDoFind);                
            } catch (Exception e) {
//                e.printStackTrace();
            }finally {
                setSearchEnable(true);
            }
        }
    }
    
    private QueryPanel queryPanel;
    private QueryShowPanel showPanel;
}