📄 configureservers.java
字号:
/* * ==================================================================== * The File Description * Version: 1.0.0 * Date: 11/08/2005 * Author: Xing.zhou * Function: 技术管理界面的建立 * * ==================================================================== * */package vocal.ui;import vocal.comm.VPPTransactionWrapper;import vocal.data.*;import vocal.data.TreeNodeTypes;import vocal.userEditor.Editor;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.EmptyBorder;import javax.swing.event.TreeSelectionEvent;import javax.swing.event.TreeSelectionListener;import vocal.comm.VPPException;/* * ==================================================================== * The Class Description * Version: 1.0.0 * Date: 11/08/2005 * Author: Xing.zhou * Function: 这个类中定义了技术管理的界面和怎么通过管理树来管理Server的数据 * * ==================================================================== * */public class ConfigureServers extends JDialog implements TreeNodeTypes{ private int currentNodeType = UNKNOWN; private FormPanelScreen currentScreen = null; // used for JOptionPane display private Container parent; BlankScreen blankScreen; GroupScreen groupScreen; CdrScreen cdrScreen; HeartbeatScreen heartbeatScreen; PolicyScreen pdpScreen; FeatureScreen featureScreen; MarshalScreen marshalScreen; RedirectScreen redirectScreen; OSPServerScreen ospScreen; SystemData systemData; DialPlanScreen ipDialPlanScreen; DialPlanScreen digitalDialPlanScreen; DvrScreen dvrScreen; EnvScreen envScreen; JPanel jPanel1 = new JPanel(); JPanel topPanel = new JPanel(); JPanel jPanel3 = new JPanel(); JButton backButton = new JButton(); JButton accountButton = new JButton(); JButton techButton = new JButton(); JButton accreditButton = new JButton(); JSplitPane jSplitPane1 = new JSplitPane(); JPanel buttonPanel = new JPanel(); FlowLayout flowLayout1 = new FlowLayout(); BorderLayout borderLayout1 = new BorderLayout(); FlowLayout flowLayout3 = new FlowLayout(); JButton okButton = new JButton(); JButton newButton = new JButton(); JButton deleteButton = new JButton(); JPanel buttonGridPanel = new JPanel(); GridLayout gridLayout1 = new GridLayout(); JButton cancelButton = new JButton(); JPanel treePanel = new JPanel(); JPanel formPanel = new JPanel(); JPanel tempPanel = new JPanel(); JScrollPane jScrollPane2 = new JScrollPane(); ConfigTree configTree1 = new ConfigTree(); BorderLayout borderLayout2 = new BorderLayout(); BorderLayout borderLayout3 = new BorderLayout(); private AccreditPanel accreditDialog; public JDialog accountDialog = null; //帐号管理editor private Editor editor = null; protected VPPTransactionWrapper connect; //public JDialog adminDialog = null; /** * * @param aParent */ public ConfigureServers(Container aParent) { parent = aParent; setTitle("Configure Servers"); init(); try { jbInit(); pack(); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2); } catch (Exception e) { e.printStackTrace(); } }//目前不用它 public void AccountPanel(Container aParent) { if (editor == null) { if (accountDialog==null) { //adminDialog = new AccreditPanel(this); //adminDialog.setModal(true); } //用户数据显示表格区 editor = new Editor(connect); // The user editor goes in the center panel of a border layout JPanel temp = new JPanel(); temp.setLayout(new BorderLayout()); temp.add(editor, BorderLayout.CENTER); // add another panel at the bottom which has the back button JPanel temp2 = new JPanel(); temp2.setLayout(new BoxLayout(temp2, BoxLayout.X_AXIS)); /* JButton back = new JButton("Back"); back.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { return_login(); //adminDialog.setVisible(false); } }); temp2.add(back); */ JButton acc_manage = new JButton("帐号管理"); acc_manage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); temp2.add(acc_manage); JButton tech_manage = new JButton("技术管理"); tech_manage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //adminDialog.setVisible(false); //tech_dialog(); } }); temp2.add(tech_manage); JButton accredit = new JButton("帐号授权中心"); accredit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //adminDialog.setVisible(false); accredit_dialog(); } }); temp2.add(accredit); temp2.add(Box.createHorizontalGlue()); temp2.setBorder(new EmptyBorder(5, 5, 5, 5)); temp.add(temp2, BorderLayout.NORTH); accountDialog.getContentPane().add(temp); accountDialog.pack(); accountDialog.setSize(700, 500); temp2 = new JPanel(); temp2.setLayout(new BoxLayout(temp2, BoxLayout.X_AXIS)); temp2.setBorder(new EmptyBorder(2, 4, 2, 4)); temp2.add(vocal.util.Logger.getLogLabel()); temp.add(temp2, BorderLayout.SOUTH); temp2 = new JPanel(); temp2.setLayout(new BoxLayout(temp2, BoxLayout.X_AXIS)); temp2.add(Box.createHorizontalGlue()); temp2.setBorder(new EmptyBorder(5, 5, 5, 5)); temp.add(temp2, BorderLayout.SOUTH); } } // public methods /** * *///用户进入帐号管理 protected void account_dialog() { if (accountDialog == null) { accountDialog = new AccountPanel(this); accountDialog.setModal(true); } ConfigureServers.this.setVisible(false); //parent.setVisible(false); accountDialog.setVisible(true); //parent.setVisible(true); if (JFrame.class.isInstance(parent)) { ((JFrame) parent).toFront(); ((JFrame) parent).setState(JFrame.NORMAL); } } //用户进入帐号授权中心 protected void accredit_dialog() { if (accreditDialog == null) { accreditDialog = new AccreditPanel(this,connect); accreditDialog.setModal(true); } //Container parent = ConfigureServers.this.getTopLevelAncestor(); ConfigureServers.this.setVisible(false); //parent.setVisible(false); accreditDialog.setVisible(true); //parent.setVisible(true); if (JFrame.class.isInstance(parent)) { ((JFrame) parent).toFront(); ((JFrame) parent).setState(JFrame.NORMAL); } } /** * @return */private Container getTopLevelAncestor() { // TODO Auto-generated method stub return null;}public ConfigTree getConfigTree() { return configTree1; } /** * */ public void enableTree() { configTree1.setEnabled(true); } public void disableTree() { configTree1.setEnabled(false); } /** * */ public JButton getNewButton() { return newButton; } /** * */ public JButton getOkButton() { return okButton; } /** * */ public JButton getCancelButton() { return cancelButton; } /** * */ public JButton getDeleteButton() { return deleteButton; } // get screen methods /** * */ public FormPanelScreen getCdrScreen() { return cdrScreen; } /** * */ public FormPanelScreen getHeartbeatScreen() { return heartbeatScreen; } /** * */ public FormPanelScreen getFeatureScreen() { return featureScreen; } /** * */ public FormPanelScreen getMarshalScreen() { return marshalScreen; } /** * */ public FormPanelScreen getPdpScreen() { return pdpScreen; } public FormPanelScreen getDvrScreen() { return dvrScreen; } /** * */ public FormPanelScreen getRedirectScreen() { return redirectScreen; } /** */ private void init() { blankScreen = new BlankScreen(); groupScreen = new GroupScreen(this); cdrScreen = new CdrScreen(this); heartbeatScreen = new HeartbeatScreen(this); pdpScreen = new PolicyScreen(this); featureScreen = new FeatureScreen(this); marshalScreen = new MarshalScreen(this); redirectScreen = new RedirectScreen(this); ospScreen = new OSPServerScreen(this); systemData = new SystemData(this); ipDialPlanScreen = new DialPlanScreen(this, "IP"); digitalDialPlanScreen = new DialPlanScreen(this, "Digital"); dvrScreen = new DvrScreen(this); envScreen = new EnvScreen(this); initializeButtons(); setTreeListener(); } /** * * @throws Exception */ private void jbInit() throws Exception { jPanel1.setLayout(borderLayout1); topPanel.setLayout(flowLayout3); jPanel3.setLayout(borderLayout2); backButton.setToolTipText("Return to Login screen to configure users"); backButton.setText("Back"); accountButton.setText("帐号管理"); accountButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //vocal.ui.AdministrativeLoginPanel.account_dialog(); //AdministrativeLoginPanel accountDialog = null; //accountDialog.account_dialog(); account_dialog(); /* if (accountDialog == null) { accountDialog = new AdministrativeLoginPanel(this); accountDialog.setModal(true); } //Container parent = ConfigureServers.this.getTopLevelAncestor(); ConfigureServers.this.setVisible(false); //parent.setVisible(false); accountDialog.setVisible(true); //parent.setVisible(true); if (JFrame.class.isInstance(parent)) { ((JFrame) parent).toFront(); ((JFrame) parent).setState(JFrame.NORMAL); } */ } }); techButton.setText("技术管理"); accreditButton.setText("帐号授权中心"); accreditButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //vocal.ui.AdministrativeLoginPanel.account_dialog(); accredit_dialog(); } }); buttonPanel.setLayout(flowLayout1); flowLayout1.setHgap(0); flowLayout1.setVgap(0); okButton.setText("OK"); newButton.setText("New"); deleteButton.setText("Delete"); buttonGridPanel.setLayout(gridLayout1); gridLayout1.setColumns(4); gridLayout1.setVgap(5); cancelButton.setText("Cancel"); this.setModal(true); jSplitPane1.setTopComponent(null); buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); flowLayout3.setAlignment(FlowLayout.LEFT); formPanel.setPreferredSize(new Dimension(150, 200)); formPanel.setLayout(borderLayout3); jPanel1.setPreferredSize(new Dimension(660, 440)); this.getContentPane().add(jPanel1, BorderLayout.CENTER); jPanel1.add(topPanel, BorderLayout.NORTH); topPanel.add(backButton, null); LoginPanel loginpanel = null; if((1==loginpanel.userlevel)||(2==loginpanel.userlevel)) { topPanel.add(accountButton, null); } topPanel.add(techButton, null); if((1==loginpanel.userlevel)||(2==loginpanel.userlevel)) { topPanel.add(accreditButton, null); } jPanel1.add(jPanel3, BorderLayout.CENTER); jPanel3.add(jSplitPane1, BorderLayout.CENTER); jSplitPane1.add(formPanel, JSplitPane.RIGHT); formPanel.add(tempPanel, BorderLayout.NORTH); jSplitPane1.add(jScrollPane2, JSplitPane.LEFT); this.getContentPane().add(buttonPanel, BorderLayout.SOUTH); buttonPanel.add(buttonGridPanel, null); buttonGridPanel.add(newButton, null); buttonGridPanel.add(okButton, null); buttonGridPanel.add(cancelButton, null); buttonGridPanel.add(deleteButton, null); jScrollPane2.getViewport().add(configTree1, BorderLayout.CENTER); jSplitPane1.setDividerLocation(275); } /** * * @param newScreen */ private void setCurrentScreen(FormPanelScreen newScreen) { if (currentScreen == null) { formPanel.remove(tempPanel); } else { formPanel.remove(currentScreen); } formPanel.add(newScreen); setOKButtonListener(newScreen); currentScreen = newScreen; validate(); getContentPane().repaint(); } /** */ private void setTreeListener() { configTree1.addTreeSelectionListener(new TreeSelectionListener() { /** * * @param e */ public void valueChanged(TreeSelectionEvent e) { int type = configTree1.getSelectedNodeType(); System.out.println("select type: " + type); System.out.println("selected node is " + TreeNodeTypes.strings[type] + " (" + Integer.toString(type) + ")"); currentNodeType = configTree1.getSelectedNodeType(); /* * We do two switch statements here so that we can * first set the buttons for sets of similar screens * and then deal with each screen individually. */ switch (currentNodeType) { case UNKNOWN: case SYSTEM: case SERVERS: { newButton.setEnabled(false); okButton.setEnabled(false); cancelButton.setEnabled(false); deleteButton.setEnabled(false); break; } case GLOBAL: case DIGITAL_DIAL_PLAN: case IP_DIAL_PLAN: case OSP_SERVER: { // set buttons newButton.setEnabled(false); okButton.setEnabled(true); cancelButton.setEnabled(true); deleteButton.setEnabled(false); break; } // feature and marshal servers cannot make new types case FEATURE_SERVERS: case MARSHAL_SERVERS: { newButton.setEnabled(false); okButton.setEnabled(false); cancelButton.setEnabled(false); deleteButton.setEnabled(false); break; } // feature and marshal types can make new groups case FEATURE_TYPE: case MARSHAL_TYPE: // these four top-level servers can make new groups case CDR_SERVERS: case HEARTBEAT_SERVERS: case JTAPI_SERVERS:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -