📄 dvrscreen.java
字号:
/*
* ====================================================================
* The Class Description
* Version: 1.0.0
* Date: 11/08/2005
* Company: Adlink
* Author: Xing.zhou
* Function: dvr配置界面的建立
*
* ====================================================================
*
*/
package vocal.ui;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import vocal.data.DvrData;
import vocal.data.PDPData;
import vocal.data.InvalidRequestException;
import vocal.data.ConfigTree;
public class DvrScreen extends FormPanelScreen
{
JPanel jPanel1 = new JPanel();
JScrollPane jScrollPane1 = new JScrollPane();
JPanel jPanel2 = new JPanel();
LabelFieldPanel labelFieldPanel1 = new LabelFieldPanel();
JLabel groupDescript = new JLabel("Group: ");
JLabel groupName = new JLabel(" DvrClient");
JLabel host = new JLabel("Host: ");
JLabel port = new JLabel("Port: ");
JLabel hostname = new JLabel("Hostname: ");
HostNameField hostTextField = new HostNameField("Host Name");
HostNameField hostnameField = new HostNameField("Host Name");
WholeNumberField portTextField = new WholeNumberField("Port");
JLabel cameraLabel1 = new JLabel("Camera1: ");
JLabel cameraLabel2 = new JLabel("Camera2: ");
JLabel cameraLabel3 = new JLabel("Camera3: ");
JLabel cameraLabel4 = new JLabel("Camera4: ");
JLabel cameraLabel5 = new JLabel("Camera5: ");
JLabel cameraLabel6 = new JLabel("Camera6: ");
JLabel cameraLabel7 = new JLabel("Camera7: ");
JLabel cameraLabel8 = new JLabel("Camera8: ");
JTextField Name1 = new JTextField("Camera1",8);
JTextField Name2 = new JTextField("Camera2",8);
JTextField Name3 = new JTextField("Camera3",8);
JTextField Name4 = new JTextField("Camera4",8);
JTextField Name5 = new JTextField("Camera5",8);
JTextField Name6 = new JTextField("Camera6",8);
JTextField Name7 = new JTextField("Camera7",8);
JTextField Name8 = new JTextField("Camera8",8);
JCheckBox Preview1 = new JCheckBox("Preview");
JCheckBox Preview2 = new JCheckBox("Preview");
JCheckBox Preview3 = new JCheckBox("Preview");
JCheckBox Preview4 = new JCheckBox("Preview");
JCheckBox Preview5 = new JCheckBox("Preview");
JCheckBox Preview6 = new JCheckBox("Preview");
JCheckBox Preview7 = new JCheckBox("Preview");
JCheckBox Preview8 = new JCheckBox("Preview");
JCheckBox Alarm1 = new JCheckBox("Alarm");
JCheckBox Alarm2 = new JCheckBox("Alarm");
JCheckBox Alarm3 = new JCheckBox("Alarm");
JCheckBox Alarm4 = new JCheckBox("Alarm");
JCheckBox Alarm5 = new JCheckBox("Alarm");
JCheckBox Alarm6 = new JCheckBox("Alarm");
JCheckBox Alarm7 = new JCheckBox("Alarm");
JCheckBox Alarm8 = new JCheckBox("Alarm");
JCheckBox Record1 = new JCheckBox("Record");
JCheckBox Record2 = new JCheckBox("Record");
JCheckBox Record3 = new JCheckBox("Record");
JCheckBox Record4 = new JCheckBox("Record");
JCheckBox Record5 = new JCheckBox("Record");
JCheckBox Record6 = new JCheckBox("Record");
JCheckBox Record7 = new JCheckBox("Record");
JCheckBox Record8 = new JCheckBox("Record");
JCheckBox Control1 = new JCheckBox("Control");
JCheckBox Control2 = new JCheckBox("Control");
JCheckBox Control3 = new JCheckBox("Control");
JCheckBox Control4 = new JCheckBox("Control");
JCheckBox Control5 = new JCheckBox("Control");
JCheckBox Control6 = new JCheckBox("Control");
JCheckBox Control7 = new JCheckBox("Control");
JCheckBox Control8 = new JCheckBox("Control");
JLabel ControlPort1Text1 = new JLabel(" Port: ");
JLabel ControlPort1Text2 = new JLabel(" Port: ");
JLabel ControlPort1Text3 = new JLabel(" Port: ");
JLabel ControlPort1Text4 = new JLabel(" Port: ");
JLabel ControlPort1Text5 = new JLabel(" Port: ");
JLabel ControlPort1Text6 = new JLabel(" Port: ");
JLabel ControlPort1Text7 = new JLabel(" Port: ");
JLabel ControlPort1Text8 = new JLabel(" Port: ");
JComboBox ControlPort1 = new JComboBox(new String[]
{
"com1", "com2"
});
JComboBox ControlPort2 = new JComboBox(new String[]
{
"com1", "com2"
});
JComboBox ControlPort3 = new JComboBox(new String[]
{
"com1", "com2"
});
JComboBox ControlPort4 = new JComboBox(new String[]
{
"com1", "com2"
});
JComboBox ControlPort5 = new JComboBox(new String[]
{
"com1", "com2"
});
JComboBox ControlPort6 = new JComboBox(new String[]
{
"com1", "com2"
});
JComboBox ControlPort7 = new JComboBox(new String[]
{
"com1", "com2"
});
JComboBox ControlPort8 = new JComboBox(new String[]
{
"com1", "com2"
});
JLabel ControlAddressText1 = new JLabel(" Address: ");
JLabel ControlAddressText2 = new JLabel(" Address: ");
JLabel ControlAddressText3 = new JLabel(" Address: ");
JLabel ControlAddressText4 = new JLabel(" Address: ");
JLabel ControlAddressText5 = new JLabel(" Address: ");
JLabel ControlAddressText6 = new JLabel(" Address: ");
JLabel ControlAddressText7 = new JLabel(" Address: ");
JLabel ControlAddressText8 = new JLabel(" Address: ");
JComboBox ControlAddress1 = new JComboBox(new String[]
{
"0", "1","2","3","4","5","6","7"
});
JComboBox ControlAddress2 = new JComboBox(new String[]
{
"0", "1","2","3","4","5","6","7"
});
JComboBox ControlAddress3 = new JComboBox(new String[]
{
"0", "1","2","3","4","5","6","7"
});
JComboBox ControlAddress4 = new JComboBox(new String[]
{
"0", "1","2","3","4","5","6","7"
});
JComboBox ControlAddress5 = new JComboBox(new String[]
{
"0", "1","2","3","4","5","6","7"
});
JComboBox ControlAddress6 = new JComboBox(new String[]
{
"0", "1","2","3","4","5","6","7"
});
JComboBox ControlAddress7 = new JComboBox(new String[]
{
"0", "1","2","3","4","5","6","7"
});
JComboBox ControlAddress8 = new JComboBox(new String[]
{
"0", "1","2","3","4","5","6","7"
});
BorderLayout borderLayout2 = new BorderLayout();
BorderLayout borderLayout1 = new BorderLayout();
ConfigTree configTree1;
DvrData dataManager;
ConfigureServers mainScreen;
JPanel jPanel3 = new JPanel();
FlowLayout flowLayout1 = new FlowLayout();
JPanel jPanel4 = new JPanel();
BorderLayout borderLayout4 = new BorderLayout();
FlowLayout flowLayout2 = new FlowLayout();
Box box1;
JPanel jPanel5 = new JPanel();
JLabel dvrNameLabel = new JLabel();
private JLabel groupDescriptionLabel = new JLabel();
private JLabel groupLabel = new JLabel();
private FlowLayout flowLayout3 = new FlowLayout();
/**
*
* @param screen
*/
public DvrScreen(ConfigureServers screen)
{
mainScreen = screen;
try
{
jbInit();
}
catch (Exception e)
{
e.printStackTrace();
}
}
protected JPanel CreatePanel(JLabel cameraLabel,JTextField name,JCheckBox Preview,JCheckBox Alarm,JCheckBox Record,JCheckBox Control,JLabel ControlPortText,JComboBox ControlPort,JLabel ControlAddressText,JComboBox ControlAddress)
{
JPanel CameraPane1 = new JPanel();
CameraPane1.setLayout(new BoxLayout(CameraPane1, BoxLayout.X_AXIS));
CameraPane1.setBorder(new EmptyBorder(5, 1, 1, 1));
cameraLabel.setForeground(Color.black);
CameraPane1.add(cameraLabel, null);
CameraPane1.add(name, null);
CameraPane1.add(Preview, null);
CameraPane1.add(Alarm, null);
CameraPane1.add(Record, null);
CameraPane1.add(Control, null);
CameraPane1.add(ControlPortText,null);
Dimension dim = new Dimension(65, 5);
Dimension dimc = new Dimension(40, 5);
ControlPort.setPreferredSize(dim);
ControlAddress.setPreferredSize(dimc);
CameraPane1.add(ControlPort, null);
CameraPane1.add(ControlAddressText,null);
CameraPane1.add(ControlAddress, null);
ControlPort.setEnabled(false);
ControlAddress.setEnabled(false);
return CameraPane1;
}
private JPanel createLabelGroup(JComponent label1, JComponent label2)
{
JPanel temp = new JPanel();
temp.setBorder(new EmptyBorder(5, 1, 10, 200));
Dimension dim1 = new Dimension(100, label1.getHeight());
Dimension dim2 = new Dimension(100, label2.getHeight());
label1.setPreferredSize(dim1);
label2.setPreferredSize(dim2);
temp.setLayout(new BoxLayout(temp, BoxLayout.X_AXIS));
temp.add(label1);
temp.add(label2);
return temp;
}
private JPanel createLabelComponentPair(JLabel labelText, HostNameField comp)
{
JPanel temp = new JPanel();
temp.setBorder(new EmptyBorder(10, 1, 5, 200));
Dimension dim = new Dimension(100, labelText.getHeight());
labelText.setPreferredSize(dim);
temp.setLayout(new BoxLayout(temp, BoxLayout.X_AXIS));
temp.add(labelText);
temp.add(comp);
return temp;
}
private JPanel createLabelPort(JLabel labelText, WholeNumberField comp)
{
JPanel temp = new JPanel();
temp.setBorder(new EmptyBorder(10, 1, 5, 200));
Dimension dim = new Dimension(100, labelText.getHeight());
labelText.setPreferredSize(dim);
temp.setLayout(new BoxLayout(temp, BoxLayout.X_AXIS));
temp.add(labelText);
temp.add(comp);
return temp;
}
/**
*
* @throws Exception
*/
private void jbInit() throws Exception
{
box1 = Box.createVerticalBox();
this.setLayout(borderLayout2);
jPanel1.setLayout(borderLayout1);
labelFieldPanel1.setPreferredSize(new Dimension(400, 300));
//labelFieldPanel1.setHorizontalGap(30);
//labelFieldPanel1.setVerticalGap(20);
JPanel tmp_group = createLabelGroup(groupDescript,groupName);
JPanel tmp_host = createLabelComponentPair(host, hostTextField);
JPanel tmp_port = createLabelPort(port, portTextField);
JPanel tmp_hostname = createLabelComponentPair(hostname, hostnameField);
JPanel tmp_camera1 = CreatePanel(cameraLabel1,Name1,Preview1,Alarm1,Record1,Control1,ControlPort1Text1,ControlPort1,ControlAddressText1,ControlAddress1);
JPanel tmp_camera2 = CreatePanel(cameraLabel2,Name2,Preview2,Alarm2,Record2,Control2,ControlPort1Text2,ControlPort2,ControlAddressText2,ControlAddress2);
JPanel tmp_camera3 = CreatePanel(cameraLabel3,Name3,Preview3,Alarm3,Record3,Control3,ControlPort1Text3,ControlPort3,ControlAddressText3,ControlAddress3);
JPanel tmp_camera4 = CreatePanel(cameraLabel4,Name4,Preview4,Alarm4,Record4,Control4,ControlPort1Text4,ControlPort4,ControlAddressText4,ControlAddress4);
JPanel tmp_camera5 = CreatePanel(cameraLabel5,Name5,Preview5,Alarm5,Record5,Control5,ControlPort1Text5,ControlPort5,ControlAddressText5,ControlAddress5);
JPanel tmp_camera6 = CreatePanel(cameraLabel6,Name6,Preview6,Alarm6,Record6,Control6,ControlPort1Text6,ControlPort6,ControlAddressText6,ControlAddress6);
JPanel tmp_camera7 = CreatePanel(cameraLabel7,Name7,Preview7,Alarm7,Record7,Control7,ControlPort1Text7,ControlPort7,ControlAddressText7,ControlAddress7);
JPanel tmp_camera8 = CreatePanel(cameraLabel8,Name8,Preview8,Alarm8,Record8,Control8,ControlPort1Text8,ControlPort8,ControlAddressText8,ControlAddress8);
Control1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if (Control1.isSelected()== false)
{
ControlPort1.setEnabled(false);
ControlAddress1.setEnabled(false);
}
else
{
ControlPort1.setEnabled(true);
ControlAddress1.setEnabled(true);
}
}
});
Control2.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if (Control2.isSelected()== false)
{
ControlPort2.setEnabled(false);
ControlAddress2.setEnabled(false);
}
else
{
ControlPort2.setEnabled(true);
ControlAddress2.setEnabled(true);
}
}
});
Control3.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if (Control3.isSelected()== false)
{
ControlPort3.setEnabled(false);
ControlAddress3.setEnabled(false);
}
else
{
ControlPort3.setEnabled(true);
ControlAddress3.setEnabled(true);
}
}
});
Control4.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if (Control4.isSelected()== false)
{
ControlPort4.setEnabled(false);
ControlAddress4.setEnabled(false);
}
else
{
ControlPort4.setEnabled(true);
ControlAddress4.setEnabled(true);
}
}
});
Control5.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if (Control5.isSelected()== false)
{
ControlPort5.setEnabled(false);
ControlAddress5.setEnabled(false);
}
else
{
ControlPort5.setEnabled(true);
ControlAddress5.setEnabled(true);
}
}
});
Control6.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if (Control6.isSelected()== false)
{
ControlPort6.setEnabled(false);
ControlAddress6.setEnabled(false);
}
else
{
ControlPort6.setEnabled(true);
ControlAddress6.setEnabled(true);
}
}
});
Control7.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if (Control7.isSelected()== false)
{
ControlPort7.setEnabled(false);
ControlAddress7.setEnabled(false);
}
else
{
ControlPort7.setEnabled(true);
ControlAddress7.setEnabled(true);
}
}
});
Control8.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if (Control8.isSelected()== false)
{
ControlPort8.setEnabled(false);
ControlAddress8.setEnabled(false);
}
else
{
ControlPort8.setEnabled(true);
ControlAddress8.setEnabled(true);
}
}
});
jPanel2.setLayout(borderLayout4);
jPanel3.setLayout(flowLayout1);
jPanel4.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));
jPanel4.setLayout(flowLayout2);
flowLayout1.setVgap(0);
dvrNameLabel.setForeground(Color.black);
dvrNameLabel.setHorizontalAlignment(SwingConstants.CENTER);
dvrNameLabel.setText("Dvr Client ");
groupDescriptionLabel.setForeground(Color.black);
groupDescriptionLabel.setText("Group:");
groupLabel.setForeground(Color.black);
groupLabel.setText("Unknown");
jPanel5.setLayout(flowLayout3);
jPanel5.setBorder(new EmptyBorder(10, 50, 1, 1));
//flowLayout2.setVgap(20);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -