zsh_root
2024-01-02 7b595546af704983dbafcd0d385c8768ddacefc2
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
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
package Frame;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import javax.swing.Box;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import ColorAndFont.English;
import ColorAndFont.UIColor;
import ColorAndFont.buttonTitle;
import DataBase.DatabaseManagement;
import PbuliClass.JButtonModel;
import PbuliClass.JlableModel;
import PbuliClass.OutButton;
import PbuliClass.ShowMessage;
import PbuliClass.Systems;
import PbuliClass.WarningMessage;
import PbuliClass.greateTables;
import PbuliClass.jinternalFrame;
import Xunjian.Dell_xunjianset;
import fence.Fences;
import tbDataModel.TbFence;
import tbDataModel_Dell.Dell_Fenceinout;
import tbDataModel_Dell.Dell_Polygon;
import tbDataModel_Dell.Dell_tbline;
@SuppressWarnings("rawtypes")
public class FenceTable extends jinternalFrame {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;    
    JPanel northJpanel=null;//±±²¿Ãæ°å
    JButtonModel jbut;//°´Å¥Ä£ÐÍ
    JTextField searchFileld=null;//ËÑË÷Îı¾¿ò
    JButtonModel search=null;//ËÑË÷°´Å¥
    JButtonModel shuaxin=null;//ˢа´Å¥
    JButtonModel xiu_gai=null;//Ð޸İ´Å¥
    JButtonModel delete=null;//ɾ³ý°´Å¥
    JButtonModel deleteAll=null;//È«²¿É¾³ý°´Å¥
    JButtonModel jtb_qiyongfence=null;//ÆôÓÃΧÀ¸
    JButtonModel jtb_stopfence=null;//ÔÝÍ£ÆôÓÃΧÀ¸
    JScrollPane gd;
    JTable table=null;//ÉêÃ÷±í¸ñ
    Vector rowData=null;
    DefaultTableModel tableModel;//±í¸ñÄ£ÐÍ
    int selectedRow;//±»Ñ¡ÖеÄÐР   
    List list=null;//½«ÁбíÖÐËùÓнá¹û¼¯¸øµ½list¼¯ºÏ    ;
    Container rq;
 
    public FenceTable() {
        rowData=new Vector();
        String title="ΧÀ¸Áбí";
        if(Systems.sys().getLanguage().equals("English")) {
            title="Fence list";
        }
        this.setTitle(title);
        rq=getContentPane();//»ñÈ¡ÈÝÆ÷
        rq.setLayout(new BorderLayout());
        rq.setBackground(Color.white);
        rq.add(getNorthJpanel(),BorderLayout.NORTH);
        rq.add(getGd());
        this.setFrameIcon(new ImageIcon("image/icon/fenceicon.png"));//ÉèÖô°Ìåͼ±ê        
        this.setBounds(175,0,980,610);
    }
 
 
    /**»ñÈ¡±±²¿Ãæ°å*/
    public JPanel getNorthJpanel() {
        if(northJpanel==null) {
            northJpanel=new JPanel();
            Box topicBox = Box.createHorizontalBox();// ´´½¨Ò»¸öˮƽÏäÈÝÆ÷
            topicBox.add(getSearchFileld());//Ìí¼ÓËÑË÷Îı¾¿ò
            topicBox.add(Box.createHorizontalStrut(3));// Ìí¼ÓÒ»¸ö3ÏñËØ¿íµÄˮƽ֧Öù
            topicBox.add(getSearch());//Ìí¼ÓËÑË÷°´Å¥
            topicBox.add(Box.createHorizontalStrut(10));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
            topicBox.add(getShuaxin());//Ìí¼Óˢа´Å¥
            topicBox.add(Box.createHorizontalStrut(10));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
            topicBox.add(getXiu_gai());//Ìí¼ÓÐ޸İ´Å¥
            topicBox.add(Box.createHorizontalStrut(10));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
            topicBox.add(getDelete());//Ìí¼Óɾ³ý°´Å¥
            topicBox.add(Box.createHorizontalStrut(10));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
            topicBox.add(getDeleteAll());//Ìí¼Óɾ³ýÈ«²¿°´Å¥ 
            topicBox.add(Box.createHorizontalStrut(10));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
            topicBox.add(getOutport());//Ìí¼Óµ¼³ö°´Å¥
            topicBox.add(Box.createHorizontalStrut(10));
            topicBox.add(getJtb_qiyongfence());
            topicBox.add(Box.createHorizontalStrut(10));
            topicBox.add(getJtb_jtb_stopfence());
            northJpanel.add(topicBox );    
        }
 
        return northJpanel;
    }
 
 
 
    /**»ñÈ¡ËÑË÷Îı¾¿òµÄ·½·¨*/
    public JTextField getSearchFileld() {
        if(searchFileld==null){
            searchFileld=new JTextField(10);
            searchFileld.addKeyListener(new KeyListener() {    //¼üÅÌʼþ¼àÌý                
                public void keyTyped(KeyEvent e) {        
                }                    
                public void keyReleased(KeyEvent e) {
                    int keyCode=e.getKeyCode();
                    if(keyCode==KeyEvent.VK_ENTER) {
                        getSearch().doClick();//ËÑË÷°´Å¥±»µã»÷
                    }                        
                }                    
                public void keyPressed(KeyEvent e) {                
                }
            });
        }
        return searchFileld;
    }
 
 
    /**»ñÈ¡ËÑË÷°´Å¥µÄ·½·¨*/    
    public JButtonModel getSearch() {
        if(search==null){
            search=new JButtonModel(buttonTitle.getSerch());
            search.addActionListener(new ActionListener() {    
                public void actionPerformed(ActionEvent e) {
                    // Ö´ÐÐSQL²éѯÓï¾ä»ñµÃµÄ½á¹û¼¯    
                    try {
                        if(getSearchFileld().getText().length()>=1) {
                            String go=getSearchFileld().getText();
                            updateSerch(go);    
                        }
                    } catch (Exception er) {
                        er.printStackTrace();
                    }
                }
            });
        }
        return search;
    }
 
 
    /**»ñȡˢа´Å¥µÄ·½·¨*/    
    public JButtonModel getShuaxin() {
        if(shuaxin==null){
            shuaxin=new JButtonModel(buttonTitle.getRefresh());
            shuaxin.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    updateTable();
                }
            });
        }
        return shuaxin;
    }
 
    /**»ñÈ¡Ð޸İ´Å¥µÄ·½·¨*/    
    public JButtonModel getXiu_gai() {
        if(xiu_gai==null){
            xiu_gai=new JButtonModel(buttonTitle.getAlert());
            xiu_gai.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    int[] selectedRows=table.getSelectedRows();//±»Ñ¡ÖÐÐеÄË÷Òý¼¯ºÏ
                    if(selectedRows.length !=0) {
                        String type = (String) getTable().getValueAt(getSelectedRow(), 1);
                        if ("¶¨Î»ÇøÓò".equals(type)){
                            ShowMessage.zidingyi_24("¶¨Î»ÇøÓòΧÀ¸ÇëÔÚÇøÓòÉèÖÃÐÞ¸Ä");
                            return;
                        }
                        new Xiu_gai_Dialog("ÐÞ¸ÄΧÀ¸ÐÅÏ¢");
                    }
                    else {
                        ShowMessage.zidingyi("ÇëÑ¡ÖÐÐèÒªÐ޸ĵÄÐУ¡");            
                    }
                    updateTable();
 
                }
            });
        }
        return xiu_gai;
    }
 
    /**»ñȡɾ³ý°´Å¥µÄ·½·¨*/    
    public JButtonModel getDelete() {
        if(delete==null){
            delete=new JButtonModel(buttonTitle.getDelete());
            delete.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    int[] selectedRows=table.getSelectedRows();//±»Ñ¡ÖÐÐеÄË÷Òý¼¯ºÏ
                    int ok=0;
                    if(selectedRows.length !=0) {
                        for(int i=0;i<selectedRows.length;i++){        
                            String name=(String) table.getValueAt(selectedRows[i], 2);
                            String deleteSql="DELETE FROM tb_fence WHERE name='"+name+"'";
                            ok=DatabaseManagement.update(deleteSql);// É¾³ý±êÇ©ÐÅÏ¢
                            Fences.delete_fence(name);
                            Dell_Polygon.delete_a_PolygonNew(name);
                            String valueAt =(String) table.getValueAt(selectedRows[i], 4);
                            if (valueAt.equals("һάÏß")){    
                                Dell_tbline.delete_line(name);
                            }
                        }
                        //ɾ³ý³É¹¦ÌáʾÐÅÏ¢
                        if(ok ==0) {
                            ShowMessage.zidingyi("дÈëÊý¾Ý¿â³ö´í£¡");
                            return;
                        }                            
                        //ɾ³ýËùÓб»Ñ¡ÖеÄÐÐ
                        for(int j=selectedRows.length-1;j>=0;j--){//ÕâÊǹؼü´úÂë
                            tableModel.removeRow(selectedRows[j]);//ɾ³ýÈÎÒⱻѡÖÐÐÐ
 
                        }
                        table.setModel(tableModel);//¸üбí¸ñÄ£ÐÍ
                        ShowMessage.zidingyi(selectedRows.length+"Ìõ¼Ç¼ɾ³ý³É¹¦£¡");
                    }else {
                        ShowMessage.zidingyi( "ÇëÑ¡ÖÐÐèҪɾ³ýµÄÐУ¡");            
                    }
                    updateTable();
                }
            });
        }
        return delete;
    }
 
 
    /**»ñȡȫ²¿É¾³ý°´Å¥µÄ·½·¨*/    
    public JButtonModel getDeleteAll() {
        if(deleteAll==null){
            deleteAll=new JButtonModel(buttonTitle.getDeleteall());
            deleteAll.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    //Ñ¡Ôñ¶Ô»°¿òÈçyes·µ»Ø0£¬NO·µ»Ø1£¬È¡Ïû·µ»Ø2
                    WarningMessage warning=new WarningMessage();
                    warning.setMessage("Ñ¡Ôñɾ³ýÈ«²¿½«»á°Ñ±í¸ñÊý¾ÝÈ«²¿É¾³ýÈ·¶¨Âð£¿");
                    int warn=warning.getwarMss(northJpanel );
                    int tagnum=table.getRowCount();//±í¸ñ×ÜÐÐÊý
                    if(tagnum!=0 && warn==0) {
                        String deleteSql="TRUNCATE TABLE tb_fence";
                        String deleteSql2="TRUNCATE TABLE tb_line";
                        DatabaseManagement.update(deleteSql);// É¾³ýËùÓмǼ
                        DatabaseManagement.update(deleteSql2);// É¾³ýËùÓмǼ
                        Fences.delete_all_fence();
                        Dell_xunjianset.deleteall();
                        Dell_Fenceinout.delteall();
                        Dell_Polygon.delete_all();
                        Dell_tbline.delete_all();
                        ShowMessage.zidingyi("È«²¿É¾³ý³É¹¦£¡");    
                    }
                    rq.repaint();
                }
            });
 
        }
        return deleteAll;
    }
 
    /**»ñÈ¡µ¼³ö±í¸ñ°´Å¥µÄ·½·¨*/    
    public JButtonModel getOutport() {
        OutButton.setAddtime("addtime");
        OutButton.setDataName("tb_fence");
        return new OutButton().get_ouotport_button();
    }
 
    /**»ñÈ¡¹ö¶¯Ãæ°åµÄ·½·¨*/    
    public JScrollPane getGd() {
        gd=new JScrollPane(getTable());
        gd.getViewport().setBackground(UIColor.getNorth_color());
        return gd;
    }
 
 
    /**Ìí¼Ó±í¸ñÐÐÏòÁ¿Êý¾Ý·½·¨*/ 
    public void getRowData(Vector<TbFence> fences) {        
        for(int i=0;i<fences.size();i++) {
            Vector<String> row = new Vector<>();
            TbFence info=fences.get(i);
            row.add(info.getFloor());
            row.add(info.getType());
            row.add(info.getName());
            row.add(info.getBumen());
            row.add(info.getShape());
            row.add(info.getZuobiao());
            row.add(info.getStart());
            row.add(info.getStop());
            row.add(info.getColor());
            String baoliu7=info.getBaoliu7();
            if(baoliu7==null || baoliu7.equals("0")) {
                baoliu7="²»ÆôÓÃ";
            }else {
                baoliu7="ÆôÓÃ";
            }
            row.add(baoliu7);
            row.add(info.getBaoliu12());//ΧÀ¸µ×²¿¸ß
            row.add(info.getBaoliu11());//ΧÀ¸¶¥²¿¸ß        
            row.add(info.getAddtime());
            tableModel.addRow(row);// Ïò±í¸ñ¶ÔÏóÌí¼ÓÐÐÊý¾Ý
        }
    }
 
 
    /**»ñÈ¡±í¸ñµÄ·½·¨*/    
    @SuppressWarnings("serial")
    public JTable getTable() {
        if(table==null) {
            String[] name1= {"ͼ²ã","ÀàÐÍ","Ãû³Æ","¹ØÁª²¿ÃÅ","ÐÎ×´","ÓÐЧ·¶Î§","ÉúЧʱ¼ä",
                    "ʧЧʱ¼ä","ÑÕÉ«","ÊÇ·ñÆôÓÃ","µ×¸ß","¶¥¸ß","ʱ¼ä"};//±í¸ñÁÐÃû
            String[] name2= { "Layer", "Fence Type","Fence Name", "Associated Object", 
                    "Shape","Valid Range",  "Effective Time", "Expiration Time", 
                    "Color ","bottom","top","Add Time"};//±í¸ñÁÐÃû
            String[] columnNames=English.columnNames(name1, name2);
            //Ìí¼Ó±í¸ñÁÐÏòÁ¿
            Vector<String> columnName=new Vector<>();
            for(int i=0;i<columnNames.length;i++){
                columnName.add(columnNames[i]);            
            }
            greateTables tables=new greateTables();
            tableModel=new DefaultTableModel(rowData, columnName){  
                //  ÊµÏÖÈÃÕû¸ö±í¸ñ²»²»ÔÊÐí±»±à¼­
                public boolean isCellEditable(int row,int column){  
                    return false;  
                }  
            };
            table=tables.getTable(tableModel);    
            getRowData(Fences.getFeces());
        }
        return table;
    }
 
 
    /**ˢбí¸ñ·½·¨*/
    public void updateTable() {            
        if(tableModel !=null) {
            tableModel.getDataVector().clear();
            getRowData(Fences.getFeces());
            gd.validate();
        }        
    }
 
    /**»ñÈ¡±í¸ñ±»Ñ¡ÖеÄÐз½·¨*/    
    public int getSelectedRow() {
        selectedRow=getTable().getSelectedRow();
        return selectedRow;
 
    }
 
    /**ËÑË÷·½·¨*/
    public void updateSerch(String serch) {    
        if(Fences.get_fences(serch).size()==0) {
            ShowMessage.zidingyi("ÄãËÑË÷µÄ»ùÕ¾"+serch+"²»´æÔÚ...");
            return;
        }
        int tagnum=getTable().getRowCount();//±í¸ñ×ÜÐÐÊý
        if(tagnum !=0 ) {
            for (int i = 0; i < tagnum; i++) {//ɾ³ýËùÓÐÐР               
                tableModel.removeRow(0);                            
            }            
            getRowData(Fences.get_fences(serch));
        }
    }
 
    //ÄÚ²¿Àà
    class Xiu_gai_Dialog extends JDialog{
 
        /**
         * 
         */
        private static final long serialVersionUID = 1L;
 
        JlableModel bumen=new JlableModel("¹ØÁª²¿ÃÅ£º ");
        JlableModel fenceName=new JlableModel("ΧÀ¸Ãû³Æ£º");
        JlableModel qu_yu=new JlableModel("ÓÐЧ·¶Î§£º");
        JlableModel start_time=new JlableModel("ÉúЧʱ¼ä£º");
        JlableModel stop_time=new JlableModel("ʧЧʱ¼ä£º");
        JlableModel jl_bottom=new JlableModel("µ×²¿¸ß¶È£º");
        JlableModel jl_top=new JlableModel("¶¥²¿¸ß¶È£º");
        JButtonModel que_ding=null;//È·¶¨°´Å¥
        JButtonModel qu_xiao=null;//È¡Ïû°´Å¥
        JPanel mb=null;//ÉêÃ÷Ò»¸öÃæ°å
        JComboBox<String > departmentBox=null;//Ñ¡Ôñ²¿ÃÅÀàÐÍÏÂÀ­¿ò
        JTextField fenceNameText=null;//ΧÀ¸Ãû³ÆÊäÈëÎı¾¿ò
        JTextField fenceArea=null;//ΧÀ¸ÇøÓò
        JTextField start_time_text;//ÉúЧʱ¼ä
        JTextField stop_time_text;//ʧЧʱ¼ä
        JTextField jt_bottom;//µ×²¿¸ß¶È
        JTextField jt_top;//¶¥²¿¸ß¶È
        String id;
        public Xiu_gai_Dialog(String title) {    
            this.setAlwaysOnTop(true);//×ÜÊÇÖö¥
            Toolkit toolkit = getToolkit();// »ñµÃ´°Ì幤¾ß°ü
            Dimension screenSize = toolkit.getScreenSize();// »ñÈ¡ÆÁÄ»´óС
            int width = (int) (screenSize.width* 0.5);// ¼ÆËã´°Ìåпí¶È
            int height = (int) (screenSize.height * 0.5);// ¼ÆËã´°Ìåпí¶È
            int x0=width-370;//´°Ìåx0×ø±ê
            int y0=height-175;//´°Ìåy0×ø±ê
            Container rq=getContentPane();
            rq.add(getMb());
            this.setTitle(title);
            this.setBounds(x0, y0,800,450);
            this.setVisible(true);
        }
 
 
 
        /**»ñȡȷ¶¨°´Å¥µÄ·½·¨*/    
        public JButtonModel getQue_ding() {
            if(que_ding==null){
                que_ding=new JButtonModel("È·¶¨");
                String shape = (String) getTable().getValueAt(getSelectedRow(), 4);
                String type = (String) getTable().getValueAt(getSelectedRow(), 1);
                que_ding.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        String bumen=(String)departmentBox.getSelectedItem();//¹ØÁª¶ÔÏó
                        String name=fenceNameText.getText().trim();//ΧÀ¸Ãû³Æ
                        String zuobiao=fenceArea.getText().trim();//ΧÀ¸ÇøÓò
                        String regex="[0-9]{1,2}:[0-9]{1,2}:[0-5]{0,1}[0-9]{1}";//ʱ¼äµÄÕýÔò±í´ïʽ
                        String start=start_time_text.getText().trim();//ΧÀ¸ÉúЧ¿ªÊ¼Ê±¼ä
                        String stop=stop_time_text.getText().trim();//ΧÀ¸Ê§Ð§Ê±¼ä
                        String baoliu11=jt_top.getText().trim();//ΧÀ¸¶¥²¿¸ß
                        String baoliu12=jt_bottom.getText().trim();//ΧÀ¸µ×²¿¸ß
                        
                        if("".equals(baoliu11)) {
                            baoliu11="-1";
                        }
                        if("".equals(baoliu12)) {
                            baoliu12="-1";
                        }
                        
                        if("".equals(name)) {
                            ShowMessage.zidingyi("ΧÀ¸Ãû³Æ²»ÄÜΪ¿Õ");
                            return;
                        }
 
                        if("".equals(zuobiao)) {
                            ShowMessage.zidingyi("ΧÀ¸ÇøÓò²»ÄÜΪ¿Õ");
                            return;
                        }
                        if(stop.equals(start)) {
                            ShowMessage.zidingyi("ʱ¼ä²»ÄÜÏàµÈ£¡");
                            return;
 
                        }
                        if(!start.matches(regex) || !stop.matches(regex)) {
                            ShowMessage.zidingyi("ÇëÊäÈëÕýÈ·µÄʱ¼ä¸ñʽ¡¾Ê±£º·Ö£ºÃë¡¿");
                            return;
                        }
                        if ("һάÏß".equals(shape)&&"¶¨Î»ÇøÓò".equals(type)){
                            String[] ziduan={"px","py","lineId"};
                            String[] split = zuobiao.split(";");
                            int length = split.length;
                            int[] xj=new int[length];
                            int[] yj=new int[length];
                            for (int i = 0; i<length; i++){
                                String[] split1 = split[i].split(",");
                                if (split1.length>1&&!("".equals(split1[1]))) {
                                    xj[i] = Integer.parseInt(split1[0]);
                                    yj[i] = Integer.parseInt(split1[1]);
                                } else{
                                    ShowMessage.zidingyi_24("×ø±ê¸ñʽ²»ÕýÈ·£¡");
                                    return;
                                }
 
                            }
                            String[] zhi={Arrays.toString(xj),Arrays.toString(yj),name};
                            boolean tb_line = DatabaseManagement.fast_alert_dbase("tb_line", ziduan, zhi);
                            if (tb_line){
                                Dell_tbline.alert(xj,xj,name);
                            }
                        }
                        String[] split = zuobiao.split(";");
                        int length = split.length;
                        String[] split2 = zuobiao.split(",");
                        int length1 = split2.length;
                        if (shape.equals("¾ØÐÎ")&&length1<4){
                            ShowMessage.zidingyi_24("×ø±ê¸ñʽ²»ÕýÈ·£¡");
                            return;
                        }
                        for (int i = 0; i<length; i++) {
                            String[] split1 = split[i].split(",");
                            if (split1.length < 2) {
                                ShowMessage.zidingyi_24("×ø±ê¸ñʽ²»ÕýÈ·£¡");
                                return;
                            }
                            String[] ziduan = {"bumen", "zuobiao", "start", "stop","baoliu11","baoliu12", "name"};
                            String[] zhi = {bumen, zuobiao, start, stop, baoliu11,baoliu12,name};
                            boolean ast = DatabaseManagement.fast_alert_dbase("tb_fence", ziduan, zhi);
                            if (ast) {
                                Fences.alertfence(name, bumen, start, stop, zuobiao,baoliu11,baoliu12);
                                Dell_Polygon.alert(name, bumen, shape, start, stop, zuobiao);
                                updateTable();//ˢбí¸ñ
                                ShowMessage.zidingyi("Êý¾ÝÐ޸ijɹ¦£¡");
                            } else {
                                ShowMessage.zidingyi("дÈëÊý¾Ý¿â³ö´í£¡");
                            }
                        }
                    }
                });
 
            }
            return que_ding;
        }
        /**»ñȡȡÏû°´Å¥µÄ·½·¨*/    
        public JButtonModel getQu_xiao() {
            if(qu_xiao==null){
                qu_xiao=new JButtonModel("È¡Ïû");
                qu_xiao.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        closeTagDialog();
 
                    }
                });
 
            }
            return qu_xiao;
        }
 
 
 
        /**»ñȡΧÀ¸Ãû³Æ*/
        public JTextField getFenceNameText() {
            if(fenceNameText==null) {
                fenceNameText=new JTextField(15);
                fenceNameText.setText((String)getTable().getValueAt(getSelectedRow(),2));
 
            }
            return fenceNameText;
        };
 
        /**ΧÀ¸ÇøÓòÉèÖÃ*/
        public JTextField getFenceArea() {
            if(fenceArea==null) {
                fenceArea=new JTextField(55);
                fenceArea.setText((String)getTable().getValueAt(getSelectedRow(), 5));
                id=(String)getTable().getValueAt(getSelectedRow(), 0);
            }
            return fenceArea;
        }
 
        /**¿ªÊ¼Ê±¼ä*/
        public JTextField getStart_time_text() {
            if(start_time_text==null) {
                start_time_text=new JTextField(15);
                start_time_text.setText((String)getTable().getValueAt(getSelectedRow(),6));
            }
            return start_time_text;
        }
 
        /**ʧЧʱ¼ä*/
        public JTextField getStop_time_text() {
            if(stop_time_text==null) {
                stop_time_text=new JTextField(15);
                stop_time_text.setText((String)getTable().getValueAt(getSelectedRow(), 7));
            }
            return stop_time_text;
        }
 
        public JTextField getJt_bottom() {
            if(jt_bottom==null) {
                jt_bottom=new JTextField(15);
                jt_bottom.setText((String)getTable().getValueAt(getSelectedRow(),10));
                jt_bottom.setToolTipText("ΧÀ¸µÄµ×²¿¸ß¶Èµ¥Î»ÀåÃ×");
            }
            return jt_bottom;
        }
        public JTextField getJt_top() {
            if(jt_top==null) {
                jt_top=new JTextField(15);
                jt_top.setText((String)getTable().getValueAt(getSelectedRow(), 11));
                jt_bottom.setToolTipText("ΧÀ¸µÄ¶¥²¿¸ß¶Èµ¥Î»ÀåÃ×");
            }
            return jt_top;
        }
 
        /**¹Ø±Õ¶Ô»°¿ò·½·¨*/
        public void closeTagDialog() {
            this.dispose();
 
        }
 
 
        /**»ñÈ¡Ãæ°å*/
        public JPanel getMb() {
            if(mb==null){
                mb=new JPanel();
                mb.setLayout(null);
                mb.setBackground(Color.white);
 
                int x=30;
                int y=10;
                int width=80;
                int width2=170;
                int height=30;
                int h=40;
 
                mb.add(bumen);                
                mb.add(getDepartmentBox());
                bumen.setBounds(x, y, width, height);
                getDepartmentBox().setBounds(x+width, y, width2, height);
 
                int y1=1*(y+h)+y;
                mb.add(fenceName);
                mb.add(getFenceNameText());
                fenceName.setBounds(x, y1, width, height);
                getFenceNameText().setBounds(x+width, y1, width2, height);
                
                int y2=2*(y+h)+y;
                mb.add(qu_yu);
                mb.add(getFenceArea());
                qu_yu.setBounds(x, y2, width, height);
                getFenceArea().setBounds(x+width, y2, 630, height);
 
                int y3=3*(y+h)+y;
                mb.add(start_time);            
                mb.add(getStart_time_text());
                start_time.setBounds(x, y3, width, height);
                getStart_time_text().setBounds(x+width, y3, width2, height);
 
                int y4=4*(y+h)+y;
                mb.add(stop_time);
                mb.add(getStop_time_text());
                stop_time.setBounds(x, y4, width, height);
                getStop_time_text().setBounds(x+width, y4, width2, height);
                
                int y5=5*(y+h)+y;
                JlableModel jl_tip=new JlableModel("µ×ºÍ¶¥¸ßʹÓó¡¾°Óò»ÉÏ¿ÉÒÔ²»Ìîд¸ÃÖµ");
                mb.add(jl_bottom);
                mb.add(jl_tip);
                mb.add(getJt_bottom());                
                jl_bottom.setBounds(x, y5, width, height);
                getJt_bottom().setBounds(x+width, y5, width2, height);
                jl_tip.setBounds(x+width+width2+5, y5, 400, height);
                
                int y6=6*(y+h)+y;
                mb.add(jl_top);
                mb.add(getJt_top());
                jl_top.setBounds(x, y6, width, height);
                getJt_top().setBounds(x+width, y6, width2, height);
 
                int y7=7*(y+h)+y;
                mb.add(getQue_ding());
                mb.add(getQu_xiao());
                getQue_ding().setBounds(x, y7, width, height);
                getQu_xiao().setBounds(x+width+50, y7, width, height);
 
                
            }
 
            return mb;
        }
 
        /**»ñȡѡÔñ²¿ÃÅÏÂÀ­¿ò*/
        public JComboBox<String> getDepartmentBox() {    
 
            if(departmentBox==null) {                        
                departmentBox=new JComboBox<>();//´´½¨ÏÂÀ­¿ò¶ÔÏó
                departmentBox.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 12));//ÉèÖÃ×ÖÌå
                ComboBoxModel<String > coModel=new DefaultComboBoxModel<>(getDepartMentName());//ÏÂÀ­ÁбíÄ£ÐÍ
                Object bum=getTable().getValueAt(getSelectedRow(), 3);
                departmentBox.setModel(coModel);
                departmentBox.setSelectedItem(bum);//ÉèÖÃĬÈϱ»Ñ¡ÖÐÏî
                departmentBox.updateUI();//¸üÐÂUI
 
            }
 
            return departmentBox;
        }
 
        /**»ñÈ¡ËùÓв¿ÃÅÃû³Æ·½·¨*/
        public Vector<String> getDepartMentName(){
            List list = DatabaseManagement.get_alldate_indatabase("tb_department");//½«²¿ÃÅÁбíÖÐËùÓнá¹û¼¯¸øµ½list¼¯ºÏ
            Iterator iterator = list.iterator();//´´½¨µü´úÆ÷    
            Vector<String> departMentName= new Vector<>();
            departMentName.add("È«²¿¶ÔÏó");
            while (iterator.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ            
                List info = (List) iterator.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½list¼¯ºÏ        
                String tagId=(String) info.get(1);//±êÇ©ID            
                departMentName.add(tagId);
 
            }
            return departMentName;
        }
 
 
    }
 
    public JButtonModel getJtb_qiyongfence() {
        if(jtb_qiyongfence==null) {
            jtb_qiyongfence=new JButtonModel("ÆôÓÃΧÀ¸");
            jtb_qiyongfence.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    int[] selectedRows=table.getSelectedRows();//±»Ñ¡ÖÐÐеÄË÷Òý¼¯ºÏ
                    if(selectedRows.length !=0) {
                        for(int i=0;i<selectedRows.length;i++){        
                            String name=(String) table.getValueAt(selectedRows[i], 2);
                            String[] ziduan= {"baoliu7","name"};
                            String[] zhi= {"1",name};
                            DatabaseManagement.fast_alert_dbase("tb_fence", ziduan, zhi);
                            Fences.get_fence(name).setBaoliu7("1");                                
                        }
                        getShuaxin().doClick();    
                        ShowMessage.zidingyi("ÐÞ¸ÄÍê±Ï");
                    }else {
                        ShowMessage.zidingyi("ÇëÑ¡ÖÐÐèÒªÐ޸ĵÄΧÀ¸");
                    }
                }
            });
        }
        return jtb_qiyongfence;
    }
 
 
 
    public JButtonModel getJtb_jtb_stopfence() {
        if(jtb_stopfence==null) {
            jtb_stopfence=new JButtonModel("ÔÝͣΧÀ¸");
            jtb_stopfence.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    int[] selectedRows=table.getSelectedRows();//±»Ñ¡ÖÐÐеÄË÷Òý¼¯ºÏ
                    if(selectedRows.length !=0) {
                        for(int i=0;i<selectedRows.length;i++){        
                            String name=(String) table.getValueAt(selectedRows[i], 2);
                            String[] ziduan= {"baoliu7","name"};
                            String[] zhi= {"0",name};
                            DatabaseManagement.fast_alert_dbase("tb_fence", ziduan, zhi);    
                            Fences.get_fence(name).setBaoliu7("0");                                                    
                        }
                        getShuaxin().doClick();    
                        ShowMessage.zidingyi("ÐÞ¸ÄÍê±Ï");
                    }
                }
            });
        }else {
            ShowMessage.zidingyi("ÇëÑ¡ÖÐÐèÒªÐ޸ĵÄΧÀ¸");
        }
        return jtb_stopfence;
    }
 
}