1
zhanghua
2024-09-26 c775c6953d9759e70f08acbfa8f6d7490aaae3d1
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
package com.netsdk.demo.customize.surfaceEventDemo.frame;
 
import com.netsdk.demo.customize.surfaceEventDemo.frame.basic.GroupListPanel;
import com.netsdk.demo.customize.surfaceEventDemo.frame.basic.LoginPanel;
 
import javax.swing.*;
import java.awt.*;
 
/**
 * PTZ 主界面
 *
 * @author 47040
 * @since Created in 2021/3/25 17:32
 */
public class SurfaceMainFrame extends JFrame {
 
    // 登录组件
    private final LoginPanel loginPanel;
    // 播放组件
    private final RealPlayPanel realPlayPanel;
    // 控制组件
    private final ControlPanel controlPanel;
    // 事件图片组件
    private final EventPicPanel eventPicPanel;
    // 事件列表组件
    private final GroupListPanel groupListPanel;
    // 事件详情组
    private final EventGroupPanel eventGroupPanel;
 
    public SurfaceMainFrame(String ipAddress, Integer port, String userName, String password) {
 
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }
 
        setTitle("水面监测事件 Demo");
        setMinimumSize(new Dimension(1366, 768));
        setLayout(new BorderLayout());
        setLocationRelativeTo(null);
        setVisible(true);
 
        JPanel placeHolderLeft = new JPanel();
        placeHolderLeft.setLayout(new BorderLayout());
 
        loginPanel = new LoginPanel(ipAddress, port, userName, password);
        placeHolderLeft.add(loginPanel, BorderLayout.NORTH);
 
        realPlayPanel = new RealPlayPanel();
        placeHolderLeft.add(realPlayPanel, BorderLayout.CENTER);
 
        JPanel placeHolderInner = new JPanel();
        placeHolderInner.setLayout(new BorderLayout());
 
        controlPanel = new ControlPanel();
        controlPanel.setEnabled(false);
        eventPicPanel = new EventPicPanel();
        placeHolderInner.add(controlPanel, BorderLayout.NORTH);
        placeHolderInner.add(eventPicPanel, BorderLayout.CENTER);
        placeHolderLeft.add(placeHolderInner, BorderLayout.EAST);
 
        groupListPanel = new GroupListPanel(
                new String[]{"EventID", "通道", "事件", "UTC", "详情"},
                new int[]{10, 10, 50, 80, 480}
        );
        placeHolderLeft.add(groupListPanel, BorderLayout.SOUTH);
        eventGroupPanel = new EventGroupPanel("事件组");
 
        add(placeHolderLeft, BorderLayout.CENTER);
        add(eventGroupPanel, BorderLayout.EAST);
    }
 
    public LoginPanel getLoginPanel() {
        return loginPanel;
    }
 
    public RealPlayPanel getRealPlayPanel() {
        return realPlayPanel;
    }
 
    public ControlPanel getControlPanel() {
        return controlPanel;
    }
 
    public EventPicPanel getEventPicPanel() {
        return eventPicPanel;
    }
 
    public GroupListPanel getGroupListPanel() {
        return groupListPanel;
    }
 
    public EventGroupPanel getEventGroupPanel() {
        return eventGroupPanel;
    }
 
    public void clearInfoAndDisableControl() {
        this.getGroupListPanel().clearTableContent();
        this.getEventPicPanel().clearPic();
        this.getEventGroupPanel().clearAll();
        this.getControlPanel().setEnabled(false);
    }
}