📄 groupscreen.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.GroupData;import vocal.data.InvalidRequestException;import vocal.userEditor.AccreditAdd;/** * $RCSfile$ * * @author $Author$, $Date$ * @version $Revision$ */public class GroupScreen extends FormPanelScreen{ JPanel jPanel1 = new JPanel(); JScrollPane jScrollPane1 = new JScrollPane(); JPanel jPanel2 = new JPanel(); LabelFieldPanel labelFieldPanel1 = new LabelFieldPanel(); JLabel jLabel1 = new JLabel(); InternalClipboardField groupTextField = new InternalClipboardField(); BorderLayout borderLayout1 = new BorderLayout(); BorderLayout borderLayout2 = new BorderLayout(); GroupData dataManager; ConfigureServers mainScreen; AccreditAdd accreditmainScreen; vocal.data.ConfigTree configTree1; vocal.data.AccreditConfigTree accreditconfigTree1; JPanel jPanel3 = new JPanel(); BorderLayout borderLayout3 = new BorderLayout(); JPanel jPanel4 = new JPanel(); FlowLayout flowLayout1 = new FlowLayout(); BorderLayout borderLayout4 = new BorderLayout(); /** * */ public FormPanelScreen getNewScreen() { return null; } /** * * @param screen */ public GroupScreen(ConfigureServers screen) { mainScreen = screen; try { jbInit(); } catch (Exception e) { e.printStackTrace(); } } public GroupScreen(AccreditAdd screen) { accreditmainScreen = screen; try { jbInitAccredit(); } catch (Exception e) { e.printStackTrace(); } } /** * * @throws Exception */ private void jbInit() throws Exception { this.setLayout(borderLayout2); jPanel1.setLayout(borderLayout1); jScrollPane1.setBorder(null); jPanel2.setLayout(borderLayout4); labelFieldPanel1.setPreferredSize(new Dimension(300, 50)); labelFieldPanel1.setHorizontalGap(15); labelFieldPanel1.setVerticalGap(20); jLabel1.setFont(new java.awt.Font("SansSerif", 1, 12)); jLabel1.setForeground(Color.black); jLabel1.setText("Group Name: "); jPanel3.setPreferredSize(new Dimension(48, 50)); jPanel3.setLayout(borderLayout3); jPanel4.setLayout(flowLayout1); flowLayout1.setVgap(50); groupTextField.setToolTipText("group name must be unique"); this.add(jPanel1, BorderLayout.CENTER); jPanel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.getViewport().add(jPanel2, null); jPanel2.add(jPanel3, BorderLayout.NORTH); jPanel2.add(jPanel4, BorderLayout.CENTER); jPanel4.add(labelFieldPanel1, null); labelFieldPanel1.add(jLabel1, null); labelFieldPanel1.add(groupTextField, null); configTree1 = mainScreen.getConfigTree(); } private void jbInitAccredit() throws Exception { this.setLayout(borderLayout2); jPanel1.setLayout(borderLayout1); jScrollPane1.setBorder(null); jPanel2.setLayout(borderLayout4); labelFieldPanel1.setPreferredSize(new Dimension(300, 50)); labelFieldPanel1.setHorizontalGap(15); labelFieldPanel1.setVerticalGap(20); jLabel1.setFont(new java.awt.Font("SansSerif", 1, 12)); jLabel1.setForeground(Color.black); jLabel1.setText("Group Name: "); jPanel3.setPreferredSize(new Dimension(48, 50)); jPanel3.setLayout(borderLayout3); jPanel4.setLayout(flowLayout1); flowLayout1.setVgap(50); groupTextField.setToolTipText("group name must be unique"); this.add(jPanel1, BorderLayout.CENTER); jPanel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.getViewport().add(jPanel2, null); jPanel2.add(jPanel3, BorderLayout.NORTH); jPanel2.add(jPanel4, BorderLayout.CENTER); jPanel4.add(labelFieldPanel1, null); labelFieldPanel1.add(jLabel1, null); labelFieldPanel1.add(groupTextField, null); accreditconfigTree1 = accreditmainScreen.getConfigTree(); } /** * * @param str */ public void setGroupName(String str) { groupTextField.setText(str); } // Get Functions /** * */ public String getGroupName() { return groupTextField.getText(); } // Action Listener /** * * @param ev */ public void actionPerformed(ActionEvent ev) { if (ev.getSource() == mainScreen.getOkButton()) { System.out.println("\n GroupScreen -> Ok Button Pressed"); getData(); if (dataManager != null) { try { dataManager.saveData(); } catch (InvalidRequestException e) { e.printStackTrace(); } dataManager = configTree1.getGroupData(); mainScreen.enableTree(); } } } /** */ public void displayData() { if (dataManager != null) { try { setGroupName(dataManager.getGroupName()); } catch (InvalidRequestException e) { e.printStackTrace(); } } } /** */ protected void getData() { if (dataManager != null) { try { dataManager.setGroupName(getGroupName()); } catch (InvalidRequestException e) { e.printStackTrace(); } } } /** */ public void activate() { dataManager = configTree1.getGroupData(); groupTextField.setEnabled(false); displayData(); } /** */ public void activateNew() { System.out.println("\n Inside GroupScreen New Button "); dataManager = configTree1.getNewGroupData(); groupTextField.setEnabled(true); displayData(); } /** * */ public int confirmDelete() { return JOptionPane.showConfirmDialog(this, new String("This delete will fail if group has members. Continue?"), "Delete Group", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -