📄 userpopeditdialog.java
字号:
package com.ciash.bms.gui.impl;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Collection;
import java.util.Iterator;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import com.ciash.bms.entity.Popedom;
import com.ciash.bms.entity.User;
import com.ciash.bms.gui.search.UserSearchPanel;
import com.ciash.bms.gui.selecter.PopedomSelecter;
import com.ciash.bms.gui.selecter.UserSelecter;
import com.ciash.bms.gui.selecter.event.UserSelectEvent;
import com.ciash.bms.gui.selecter.event.UserSelectListener;
import com.ciash.bms.gui.uiInter.UserPopEditDialogUI;
import com.ciash.common.gui.tool.ToolKit;
/**
* <p>
* Title: BMS
* </p>
* <p>
* Description:
* </p>
* <p>
* Copyright: Copyright (c) 2009
* </p>
* <p>
* Company: Cigarette Ash Inc.
* </p>
*
* @author Cigarette Ash
* @version 1.0
*/
public class UserPopEditDialog
extends JDialog
implements UserPopEditDialogUI {
private UserSearchPanel userSearchPanel;
private PopedomChooser popedomChooser;
public JButton jButton1 = new JButton();
public JButton jButton2 = new JButton();
private int option;
private PopedomSelecter popedomSelecter;
Listener l = new Listener();//查看内部类
public UserPopEditDialog(UserSearchPanel searchPanel,
PopedomChooser popedomLoader) {
this.setPopedomChooser(popedomLoader);
this.setUserSearchPanel(searchPanel);
jbInit();
setModal(true);
}
public UserPopEditDialog() {
jbInit();
setModal(true);
}
private void jbInit() {
this.getContentPane().setLayout(null);
jButton1.setBounds(new Rectangle(584, 430, 91, 34));
jButton1.setText("保存");
jButton1.addActionListener(l);
jButton1.setActionCommand("保存");
jButton2.setBounds(new Rectangle(691, 430, 90, 32));
jButton2.setText("取消");
jButton2.addActionListener(l);
jButton2.setActionCommand("取消");
getContentPane().add(jButton1);
getContentPane().add(jButton2);
this.addWindowListener(l);
setResizable(false);
}
public Collection getPops() {
return getPopedomChooser().uninstall();
}
public void setPops(Collection c) {
getPopedomChooser().install(c);
}
public int getOption() {
return option;
}
public int showDialog() {
userSearchPanel.getUserLoader().clearResult();
setSize(850, 550);
setLocation(ToolKit.getScreenCenterLocation(getSize()));
setVisible(true);
return option;
}
public void clearPops() {
getPopedomChooser().clearResult();
}
public void setUserSearchPanel(UserSearchPanel userSearchPanel) {
this.userSearchPanel = userSearchPanel;
userSearchPanel.setBounds(new Rectangle(3, 2, 500, 500));
getContentPane().add(userSearchPanel);
}
public UserSearchPanel getUserSearchPanel() {
return userSearchPanel;
}
public void setPopedomChooser(PopedomChooser popedomLoader) {
this.popedomChooser = popedomLoader;
this.popedomChooser.setBounds(new Rectangle(520, 3, 320, 250));
getContentPane().add(popedomLoader);
}
public PopedomChooser getPopedomChooser() {
return popedomChooser;
}
public Collection getChangeUsers() {
return popedomChooser.getChangeUser();
}
public void setUsers(Collection c) {
userSearchPanel.getUserLoader().install(c);
}
public void setPopedomSelecter(PopedomSelecter popedomSelecter) {
this.popedomSelecter = popedomSelecter;
}
public PopedomSelecter getPopedomSelecter() {
return popedomSelecter;
}
private class Listener extends WindowAdapter implements ActionListener{
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
if (command.equals("保存")) {
int result = JOptionPane.showConfirmDialog(null, "确定要保存吗?",
"提示!", JOptionPane.WARNING_MESSAGE);
if (result == JOptionPane.OK_OPTION) {
option = OK_OPTION;
popedomChooser.clearResult();
setVisible(false);
}
} else {
option = CANCEL_OPTION;
popedomChooser.clearResult();
setVisible(false);
}
}
public void windowClosing(WindowEvent e) {
option = CANCEL_OPTION;
popedomChooser.clearResult();
setVisible(false);
}
}
public User getUser() {
return null;
}
public void setPopedom(Collection popedoms) {
popedomChooser.install(popedoms);
}
public int showDialog(Collection popedoms) {
setPopedom(popedoms);
return showDialog();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -