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

📄 featureaccrcallblocking.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/>. * */package vocal.userEditor;import vocal.ui.WholeNumberField;import javax.swing.Box;import javax.swing.BoxLayout;import javax.swing.JCheckBox;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.JLabel;import javax.swing.event.ChangeListener;import javax.swing.event.ChangeEvent;import java.awt.Dimension;import java.awt.event.KeyListener;import java.awt.event.KeyEvent;import java.text.ParseException;class FeatureAccrCallBlocking extends FeatureAccr{  private JCheckBox adminBlockLong;  private JCheckBox userSetLong;  private JCheckBox adminBlock900;  private JCheckBox userSet900;  private WholeNumberField prefix;  private boolean adminBlockLongChanged = false;  private boolean userSetLongChanged = false;  private boolean adminBlock900Changed = false;  private boolean userSet900Changed = false;  private boolean prefixChanged = false;  protected FeatureAccrCallBlocking(String[] newGroups, String name,          PServerAccrInterface psInt)  {    super(newGroups, name, psInt);    adminBlockLong = new JCheckBox("Long Distance Blocked by Administrator");    adminBlockLong.setToolTipText("check box to stop customer from making long distance calls");    userSetLong = new JCheckBox("Long Distance Blocked by User");    userSetLong.setToolTipText("check box to block long distance calls from your phone");    adminBlock900 = new JCheckBox("900 Calls Blocked by Administrator");    adminBlock900.setToolTipText("check box to stop customer from making 900/976 calls");    userSet900 = new JCheckBox("900 Calls Blocked by User");    userSet900.setToolTipText("check box to block 900/976 calls from your phone");    prefix = new WholeNumberField();    prefix.setEmptyOk();    prefix.addKeyListener(new KeyListener()    {      public void keyReleased(KeyEvent event)      {      }      public void keyPressed(KeyEvent event)      {      }      public void keyTyped(KeyEvent event)      {        prefixChanged = true;      }    });    prefix.setToolTipText("append this prefix to blocked numbers");    JPanel temp = new JPanel();    temp.setLayout(new BoxLayout(temp, BoxLayout.X_AXIS));    temp.add(adminBlockLong);    temp.add(Box.createHorizontalGlue());    adminLayout.add(temp);    temp = new JPanel();    temp.setLayout(new BoxLayout(temp, BoxLayout.X_AXIS));    temp.add(adminBlock900);    temp.add(Box.createHorizontalGlue());    adminLayout.add(temp);    temp = new JPanel();    temp.setLayout(new BoxLayout(temp,BoxLayout.X_AXIS));    JLabel label = new JLabel("Prefix: ");    temp.add(label);    temp.add(prefix);    adminLayout.add(temp);    temp = new JPanel();    temp.setLayout(new BoxLayout(temp, BoxLayout.X_AXIS));    temp.add(userSetLong);    temp.add(Box.createHorizontalGlue());    userLayout.add(temp);    temp = new JPanel();    temp.setLayout(new BoxLayout(temp, BoxLayout.X_AXIS));    temp.add(userSet900);    temp.add(Box.createHorizontalGlue());    userLayout.add(temp);    addChangeListener();  }  protected void addChangeListener()  {    adminBlockLong.addChangeListener(new ChangeListener()    {      public void stateChanged(ChangeEvent e)      {        FeatureAccrCallBlocking.this.adminBlockLongChanged = true;        enableUserFields(adminEnabled.isSelected(),                         adminBlock900.isSelected(),                         adminBlockLong.isSelected());      }    });    userSetLong.addChangeListener(new ChangeListener()    {      public void stateChanged(ChangeEvent e)      {        FeatureAccrCallBlocking.this.userSetLongChanged = true;      }    });    adminBlock900.addChangeListener(new ChangeListener()    {      public void stateChanged(ChangeEvent e)      {        FeatureAccrCallBlocking.this.adminBlock900Changed = true;        enableUserFields(adminEnabled.isSelected(),                         adminBlock900.isSelected(),                         adminBlockLong.isSelected());      }    });    userSet900.addChangeListener(new ChangeListener()    {      public void stateChanged(ChangeEvent e)      {        FeatureAccrCallBlocking.this.userSet900Changed = true;      }    });    adminEnabled.addChangeListener(new ChangeListener()    {      public void stateChanged(ChangeEvent e)      {        enableUserFields(adminEnabled.isSelected(),                         adminBlock900.isSelected(),                         adminBlockLong.isSelected());      }    });  }  public String getData(int dataId)  {    switch (dataId)    {      case AccreditGroupModel.BLOCK_LONG_DISTANCE_ADMIN_ENABLED:      {        if (adminBlockLongChanged)        {          return adminBlockLong.isSelected() + "";        }      }      break;      case AccreditGroupModel.BLOCK_LONG_DISTANCE_USER_SET:      {        if (userSetLongChanged)        {          return userSetLong.isSelected() + "";        }      }      break;      case AccreditGroupModel.BLOCK_900_ADMIN_ENABLED:      {        if (adminBlock900Changed)        {          return adminBlock900.isSelected() + "";        }      }      break;      case AccreditGroupModel.BLOCK_900_USER_SET:      {        if (userSet900Changed)        {          return userSet900.isSelected() + "";        }      }      break;      case AccreditGroupModel.CALL_BLOCK_ADMIN_ENABLED:      {        if (adminEnabledChanged)        {          return adminEnabled.isSelected() + "";        }      }      break;      case AccreditGroupModel.CALL_BLOCK_GROUP:      {        if (!featureGroups.getSelectedItem().equals(""))        {          return featureGroups.getSelectedItem().toString();        }      }      break;      case AccreditGroupModel.CALL_BLOCK_PREFIX:      {        if(prefixChanged)        {          return prefix.getText();        }      }    }    return null;  }  public boolean setData(int dataId, String data)  {    switch (dataId)    {      case AccreditGroupModel.BLOCK_LONG_DISTANCE_ADMIN_ENABLED:      {        if (data.equalsIgnoreCase("true"))        {          adminBlockLong.setSelected(true);        }        else        {          adminBlockLong.setSelected(false);        }        return true;      }      case AccreditGroupModel.BLOCK_LONG_DISTANCE_USER_SET:      {        if (data.equalsIgnoreCase("true"))        {          userSetLong.setSelected(true);        }        else        {          userSetLong.setSelected(false);        }        return true;      }      case AccreditGroupModel.BLOCK_900_ADMIN_ENABLED:      {        if (data.equalsIgnoreCase("true"))        {          adminBlock900.setSelected(true);        }        else        {          adminBlock900.setSelected(false);        }        return true;      }      case AccreditGroupModel.BLOCK_900_USER_SET:      {        if (data.equalsIgnoreCase("true"))        {          userSet900.setSelected(true);        }        else        {          userSet900.setSelected(false);        }        return true;      }      case AccreditGroupModel.CALL_BLOCK_ADMIN_ENABLED:      {        if (data.equalsIgnoreCase("true"))        {          adminEnabled.setSelected(true);        }        else        {          adminEnabled.setSelected(false);        }        return true;      }      case AccreditGroupModel.CALL_BLOCK_GROUP:      {        featureGroups.setSelectedItem(data);        return true;      }      case AccreditGroupModel.CALL_BLOCK_PREFIX:      {        prefix.setText(data);        return true;      }    }    return false;  }  public void clearFeatureSpecificFields()  {    adminBlockLong.setSelected(false);    userSetLong.setSelected(false);    adminBlock900.setSelected(false);    userSet900.setSelected(false);    prefix.setText("");    adminBlockLongChanged = false;    userSetLongChanged = false;    adminBlock900Changed = false;    userSet900Changed = false;    prefixChanged = false;  }  public void setMode(int mode)  {    // nothing to do so far  }  private void enableUserFields(boolean adminEnable, boolean adminBlock900,          boolean adminBlockLong)  {    if (!adminEnable)    {      userSet900.setEnabled(false);      userSetLong.setEnabled(false);      userSet900.setSelected(false);      userSetLong.setSelected(false);    }    else    {      if (adminBlockLong)      {        userSetLong.setEnabled(false);        userSetLong.setSelected(false);        userSetLongChanged = true;      }      else      {        userSetLong.setEnabled(true);      }      if (adminBlock900)      {        userSet900.setEnabled(false);        userSet900.setSelected(false);        userSet900Changed = true;      }      else      {        userSet900.setEnabled(true);      }    }  }  protected void disableFeature()  {    enableUserFields(false, false, false);    adminBlock900.setEnabled(false);    adminBlockLong.setEnabled(false);    prefix.setEnabled(false);    // turn the featue off    adminBlock900.setSelected(false);    adminBlock900Changed = true;    adminBlockLong.setSelected(false);    adminBlockLongChanged = true;    userSet900.setSelected(false);    userSet900Changed = true;    userSetLong.setSelected(false);    userSetLongChanged = true;  }  protected void enableFeature()  {    enableUserFields(adminEnabled.isSelected(), adminBlock900.isSelected(),                     adminBlockLong.isSelected());    adminBlock900.setEnabled(true);    adminBlockLong.setEnabled(true);    prefix.setEnabled(true);  }  public boolean isDataValid()  {    try    {      prefix.verifyContent();    }    catch (ParseException e)    {      return false;    }    return true;  }}

⌨️ 快捷键说明

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