⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 policyscreen.java

📁 这是一个用java和xml编写的流媒体服务器管理软件
💻 JAVA
字号:
/* * ==================================================================== * The Vovida Software License, Version 1.0 *  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved. *  * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: *  * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. *  * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. *  * 3. The names "VOCAL", "Vovida Open Communication Application Library", * and "Vovida Open Communication Application Library (VOCAL)" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact vocal@vovida.org. *  * 4. Products derived from this software may not be called "VOCAL", nor * may "VOCAL" appear in their name, without prior written * permission of Vovida Networks, Inc. *  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. *  * ==================================================================== *  * This software consists of voluntary contributions made by Vovida * Networks, Inc. and many individuals on behalf of Vovida Networks, * Inc.  For more information on Vovida Networks, Inc., please see * <http://www.vovida.org/>. *  *//** * Title:        <p> * Description:  <p> * Copyright:    Copyright (c) <p> * Company:      <p> * @author * @version 1.0 */package vocal.ui;import java.awt.*;import javax.swing.*;import java.awt.event.ActionEvent;import vocal.data.PDPData;import vocal.data.InvalidRequestException;import vocal.data.ConfigTree;/** * $RCSfile: PolicyScreen.java,v $ *  * @author $Author: bsamson $, $Date: 2001/05/18 23:17:07 $ * @version $Revision: 1.16 $ */public class PolicyScreen extends FormPanelScreen{  JPanel jPanel1 = new JPanel();  JScrollPane jScrollPane1 = new JScrollPane();  JPanel jPanel2 = new JPanel();  LabelFieldPanel labelFieldPanel1 = new LabelFieldPanel();  JLabel hostNameLabel = new JLabel();  HostNameField hostNameTextField = new HostNameField("Host Name");  JLabel portLabel = new JLabel();  WholeNumberField portTextField = new WholeNumberField("Port");  BorderLayout borderLayout2 = new BorderLayout();  BorderLayout borderLayout1 = new BorderLayout();  ConfigTree configTree1;  PDPData 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 serverNameLabel = new JLabel();  JLabel maxThreadsLabel = new JLabel();  WholeNumberField maxThreadsField = new WholeNumberField("Max Threads");  JLabel keepAliveTimerLabel = new JLabel();  WholeNumberField keepAliveTimerField =     new WholeNumberField("Keep Alive Time");  JLabel responseTimeLabel = new JLabel();  WholeNumberField responseTimeField = new WholeNumberField("Response Time");  private JLabel groupDescriptionLabel = new JLabel();  private JLabel groupLabel = new JLabel();  private FlowLayout flowLayout3 = new FlowLayout();  /**   *    * @param screen   */  public PolicyScreen(ConfigureServers screen)  {    mainScreen = screen;    try    {      jbInit();    }    catch (Exception e)    {      e.printStackTrace();    }  }  /**   *    * @throws Exception   */  private void jbInit() throws Exception  {    box1 = Box.createVerticalBox();    this.setLayout(borderLayout2);    jPanel1.setLayout(borderLayout1);    labelFieldPanel1.setPreferredSize(new Dimension(300, 200));    labelFieldPanel1.setHorizontalGap(30);    labelFieldPanel1.setVerticalGap(20);    hostNameLabel.setForeground(Color.black);    hostNameLabel.setText("Host Name:");    portLabel.setForeground(Color.black);    portLabel.setText("Port:");    jPanel2.setLayout(borderLayout4);    jPanel3.setLayout(flowLayout1);    jPanel4.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));    jPanel4.setLayout(flowLayout2);    flowLayout1.setVgap(0);    hostNameTextField.setToolTipText("IP address of this Policy server");    portTextField.setToolTipText("port number of this Policy server");    serverNameLabel.setForeground(Color.black);    serverNameLabel.setHorizontalAlignment(SwingConstants.CENTER);    serverNameLabel.setText("Policy Server ");    maxThreadsLabel.setForeground(Color.black);    maxThreadsLabel.setText("Max Threads:");    keepAliveTimerLabel.setForeground(Color.black);    keepAliveTimerLabel.setText("Keep Alive Time (s):");    responseTimeLabel.setForeground(Color.black);    responseTimeLabel.setText("Response Time (ms):");    groupDescriptionLabel.setForeground(Color.black);    groupDescriptionLabel.setText("Group:");    groupLabel.setForeground(Color.black);    groupLabel.setText("Unknown");    jPanel5.setLayout(flowLayout3);    flowLayout2.setVgap(20);    maxThreadsField.setToolTipText("maximum number of connections permitted");    keepAliveTimerField.setToolTipText("amount of time to maintain the TCP/IP connection");    responseTimeField.setToolTipText("time for PEP client to wait for a response from PDP");    this.add(jPanel1, BorderLayout.CENTER);    jPanel1.add(jScrollPane1, BorderLayout.CENTER);    jScrollPane1.getViewport().add(jPanel2, null);    jPanel2.add(jPanel3, BorderLayout.CENTER);    jPanel3.add(labelFieldPanel1, null);    labelFieldPanel1.add(groupDescriptionLabel, null);    labelFieldPanel1.add(groupLabel, null);    labelFieldPanel1.add(hostNameLabel, null);    labelFieldPanel1.add(hostNameTextField, null);    labelFieldPanel1.add(portLabel, null);    labelFieldPanel1.add(portTextField, null);    labelFieldPanel1.add(maxThreadsLabel, null);    labelFieldPanel1.add(maxThreadsField, null);    labelFieldPanel1.add(keepAliveTimerLabel, null);    labelFieldPanel1.add(keepAliveTimerField, null);    labelFieldPanel1.add(responseTimeLabel, null);    labelFieldPanel1.add(responseTimeField, null);    jPanel2.add(jPanel4, BorderLayout.NORTH);    jPanel4.add(box1, null);    box1.add(jPanel5, null);    jPanel5.add(serverNameLabel, null);    configTree1 = mainScreen.getConfigTree();  }  /**   */  public void displayData()  {    if (dataManager != null)    {      try      {        groupLabel.setText(dataManager.getGroupData());        hostNameTextField.setText(dataManager.getHostData());        portTextField.setText(dataManager.getPortData());        keepAliveTimerField.setText(dataManager.getKeepAliveTimerData());        maxThreadsField.setText(dataManager.getMaxThreadsData());        responseTimeField.setText(dataManager.getResponseTimeData());        toValidate.clear();        toValidate.add(hostNameTextField);        toValidate.add(portTextField);        toValidate.add(maxThreadsField);        toValidate.add(keepAliveTimerField);        toValidate.add(responseTimeField);      }      catch (InvalidRequestException e)      {        e.printStackTrace();      }    }  }  /**   */  public void getData()    throws InvalidRequestException  {    if (dataManager != null)    {        dataManager.setHostData(hostNameTextField.getText());        dataManager.setKeepAliveTimerData(keepAliveTimerField.getText());        dataManager.setMaxThreadsData(maxThreadsField.getText());        dataManager.setResponseTimeData(responseTimeField.getText());    }  }  /**   */  public void activate()  {    dataManager = configTree1.getPDPData();    displayData();    // changing host and port changes the filename    hostNameTextField.setEnabled(false);    portTextField.setEnabled(false);  }  /**   */  public void activateNew()  {    dataManager = configTree1.getNewPDPData();    hostNameTextField.setEnabled(true);    portTextField.setEnabled(true);    displayData();  }  // Action Listener  /**   *    * @param ev   */  public void actionPerformed(ActionEvent ev)  {    if (ev.getSource() == mainScreen.getOkButton())    {      if (!checkValidated())      {        return;      }      try      {        getData();      }      catch(InvalidRequestException e)      {        return;      }      if (dataManager != null)      {        try        {          System.out.println("saving data");          dataManager.saveData();        }        catch (InvalidRequestException e) {}      }      dataManager = configTree1.getPDPData();      mainScreen.enableTree();    }  }  public int confirmDelete()  {    return JOptionPane.showConfirmDialog(this,             new String("Are you sure you want to delete this Policy Server?"),             "Delete Policy Server Screen", JOptionPane.YES_NO_OPTION,             JOptionPane.WARNING_MESSAGE);  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -