📄 systemsettingframe.java
字号:
package view.SystemSetting;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Iterator;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableModel;
import vo.Goods;
import vo.Operator;
import vo.Room;
import vo.RoomType;
import vo.WaiterInfo;
import dao.goodssetting.GoodsSettingDao;
import dao.operator.OperatorDao;
import dao.RoomSettingDao;
import dao.WaiterConsumedDao;
public class SystemSettingFrame extends JDialog {
private JDialog jDialog = null;
private JPanel jContentPane = null;
private JTabbedPane jTabbedPane = null;
private JPanel RoomjPanel = null;
private JPanel ProductionjPanel = null;
private JButton AddjButton = null;
private JButton ModifyjButton = null;
private JButton DeletejButton = null;
private JButton jButton2 = null;
private JButton Delete2jButton = null;
private JButton Modify2jButton = null;
private JButton BatchAddjButton = null;
private JButton SingleAddjButton = null;
private JLabel RoomConditionjLabel = null;
private JComboBox RoomConditionjComboBox = null;
private JScrollPane RoomTypejScrollPane = null;
private JTable RoomTypejTable = null;
private JScrollPane RoomInfojScrollPane = null;
private JTable RoomInfojTable = null;
private JPanel ChargePlanjPanel = null;
private JPanel OperatorjPanel = null;
private JPanel WaiterjPanel = null;
private JTabbedPane ChargePlanjTabbedPane = null;
private JPanel ChargeMethodjPanel = null;
private JPanel WeekendjPanel = null;
private JCheckBox AbatejCheckBox = null;
private JLabel AbatePercentjLabel = null;
private JTextField AbatePercentjTextField = null;
private JLabel RemarkAbatePercentjLabel = null;
private JButton SavejButton = null;
private JScrollPane jScrollPane = null;
private JTable jTable = null;
private JButton AbateModifyjButton = null;
private JButton AbateAddjButton = null;
private JButton AbateDeletejButton = null;
private JButton AbateClosejButton = null;
private JLabel Weenkend1jLabel = null;
private JCheckBox Mon1jCheckBox = null;
private JCheckBox Tues1jCheckBox = null;
private JCheckBox Wed1jCheckBox = null;
private JCheckBox Sat1jCheckBox = null;
private JCheckBox Fri1jCheckBox = null;
private JCheckBox Thurs1jCheckBox = null;
private JCheckBox Sun1jCheckBox = null;
private JLabel Weekend2jLabel = null;
private JCheckBox Mon2jCheckBox = null;
private JCheckBox Tues2jCheckBox = null;
private JCheckBox Wed2jCheckBox = null;
private JCheckBox Thur2jCheckBox = null;
private JCheckBox Fri2jCheckBox = null;
private JCheckBox Sat2jCheckBox = null;
private JCheckBox Sun2jCheckBox = null;
private JLabel SpecialFeteDayjLabel = null;
private JTextField FeteDayjTextField = null;
private JLabel FeteDayNamejLabel = null;
private JTextField FeteDayNamejTextField = null;
private JScrollPane jScrollPane1 = null;
private JTable jTable1 = null;
private JButton FeteDayAddjButton = null;
private JButton FeteDayDeletejButton = null;
private JPanel jPanel = null;
private JPanel jPanel1 = null;
private JPanel jPanel2 = null;
private JLabel Remark1jLabel = null;
private JButton FeteDaySavejButton = null;
private JButton FeteDayClosejButton = null;
private JLabel Remark2jLabel = null;
private JLabel Remark3jLabel = null;
private JButton FreshjButton = null;
private JLabel GoodsTypejLabel = null;
private JComboBox GoodsTypejComboBox = null;
private JScrollPane GoodsInfojScrollPane = null;
private JTable GoodsInfojTable = null;
private JButton GoodsAddjButton = null;
private JButton GoodsModifyjButton = null;
private JButton GoodsDeletejButton = null;
private JScrollPane OperatorjScrollPane = null;
private JTable OperatorjTable = null;
private JButton OperatorAddjButton = null;
private JButton OperatorModifyjButton = null;
private JButton OperatorDeletejButton = null;
private JScrollPane WaiterjScrollPane = null;
private JTable WaiterjTable = null;
private JButton WaiterAddjButton = null;
private JButton WaiterModifyjButton = null;
private JButton WaiterDeletejButton = null;
// 构造方法
private SystemSettingFrame() {
super();
init();
getJDialog().setVisible(true);
}
// 初始化对话框
public void init() {
centerWindow(getJDialog());
}
// 居中显示
private void centerWindow(Window w) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension windowSize = w.getSize();
w.setBounds((int) (screenSize.getWidth() - windowSize.getWidth()) / 2,
(int) (screenSize.getHeight() - windowSize.getHeight()) / 2,
(int) windowSize.getWidth(), (int) windowSize.getHeight());
}
/**
* /** This method initializes jDialog
*
* @return javax.swing.JDialog
*/
private JDialog getJDialog() {
if (jDialog == null) {
jDialog = new JDialog();
jDialog.setSize(new java.awt.Dimension(671, 533));
jDialog.setTitle("系统设置");
jDialog.setContentPane(getJContentPane());
}
return jDialog;
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJTabbedPane(), null);
}
return jContentPane;
}
/**
* This method initializes jTabbedPane
*
* @return javax.swing.JTabbedPane
*/
private JTabbedPane getJTabbedPane() {
if (jTabbedPane == null) {
jTabbedPane = new JTabbedPane();
jTabbedPane.setBounds(new java.awt.Rectangle(-1, 1, 663, 500));
jTabbedPane.addTab("包间项目设置", null, getRoomjPanel(), null);
jTabbedPane.addTab("商品项目设置", null, getProductionjPanel(), null);
jTabbedPane.addTab("计费设置", null, getChargePlanjPanel(), null);
jTabbedPane.addTab("管理员设置", null, getOperatorjPanel(), null);
jTabbedPane.addTab("服务员设置", null, getWaiterjPanel(), null);
}
return jTabbedPane;
}
/**
* This method initializes RoomjPanel
*
* @return javax.swing.JPanel
*/
private JPanel getRoomjPanel() {
if (RoomjPanel == null) {
RoomConditionjLabel = new JLabel();
RoomConditionjLabel.setBounds(new java.awt.Rectangle(15, 225, 106,
17));
RoomConditionjLabel.setText("按包间类型过滤:");
RoomjPanel = new JPanel();
RoomjPanel.setLayout(null);
RoomjPanel.add(getAddjButton(), null);
RoomjPanel.add(getModifyjButton(), null);
RoomjPanel.add(getDeletejButton(), null);
RoomjPanel.add(getJButton2(), null);
RoomjPanel.add(getDelete2jButton(), null);
RoomjPanel.add(getModify2jButton(), null);
RoomjPanel.add(getBatchAddjButton(), null);
RoomjPanel.add(getSingleAddjButton(), null);
RoomjPanel.add(RoomConditionjLabel, null);
RoomjPanel.add(getRoomConditionjComboBox(), null);
RoomjPanel.add(getRoomTypejScrollPane(), null);
RoomjPanel.add(getRoomInfojScrollPane(), null);
RoomjPanel.add(getFreshjButton(), null);
}
return RoomjPanel;
}
/**
* This method initializes ProductionjPanel
*
* @return javax.swing.JPanel
*/
private JPanel getProductionjPanel() {
if (ProductionjPanel == null) {
GoodsTypejLabel = new JLabel();
GoodsTypejLabel.setBounds(new java.awt.Rectangle(16, 15, 106, 16));
GoodsTypejLabel.setText("按商品类别过滤:");
ProductionjPanel = new JPanel();
ProductionjPanel.setLayout(null);
ProductionjPanel.add(GoodsTypejLabel, null);
ProductionjPanel.add(getGoodsTypejComboBox(), null);
ProductionjPanel.add(getGoodsInfojScrollPane(), null);
ProductionjPanel.add(getGoodsAddjButton(), null);
ProductionjPanel.add(getGoodsModifyjButton(), null);
ProductionjPanel.add(getGoodsDeletejButton(), null);
}
return ProductionjPanel;
}
/**
* This method initializes ConfirmjButton
*
* @return javax.swing.JButton
*/
private JButton getAddjButton() {
if (AddjButton == null) {
AddjButton = new JButton();
AddjButton.setBounds(new java.awt.Rectangle(510, 15, 91, 32));
AddjButton.setText("添加");
}
return AddjButton;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getModifyjButton() {
if (ModifyjButton == null) {
ModifyjButton = new JButton();
ModifyjButton.setBounds(new java.awt.Rectangle(510, 60, 92, 32));
ModifyjButton.setText("修改");
}
return ModifyjButton;
}
/**
* This method initializes jButton1
*
* @return javax.swing.JButton
*/
private JButton getDeletejButton() {
if (DeletejButton == null) {
DeletejButton = new JButton();
DeletejButton.setBounds(new java.awt.Rectangle(510, 104, 91, 32));
DeletejButton.setText("删除");
}
return DeletejButton;
}
/**
* This method initializes jButton2
*
* @return javax.swing.JButton
*/
private JButton getJButton2() {
if (jButton2 == null) {
jButton2 = new JButton();
jButton2.setBounds(new java.awt.Rectangle(510, 149, 92, 32));
jButton2.setText("包间打折");
}
return jButton2;
}
/**
* This method initializes Delete2jButton
*
* @return javax.swing.JButton
*/
private JButton getDelete2jButton() {
if (Delete2jButton == null) {
Delete2jButton = new JButton();
Delete2jButton.setBounds(new java.awt.Rectangle(510, 405, 91, 30));
Delete2jButton.setText("删除");
Delete2jButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DefaultTableModel model = (DefaultTableModel) getJTable()
.getModel();
int row = getJTable().getSelectedRow();
RoomSettingDao dao = new RoomSettingDao();
String roomNumber = getJTable().getValueAt(row, 0)
.toString();
// System.out.println("row:= " + row);
// System.out.println("empId:= " + empId);
if (dao.deleteRoomInfo(roomNumber)) {
JOptionPane.showMessageDialog(null, "数据删除成功", "删除提示",
JOptionPane.YES_OPTION);
model.removeRow(row);
}
}
});
}
return Delete2jButton;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getModify2jButton() {
if (Modify2jButton == null) {
Modify2jButton = new JButton();
Modify2jButton.setBounds(new java.awt.Rectangle(510, 361, 91, 30));
Modify2jButton.setText("修改");
Modify2jButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if (getJTable() == null) {
JOptionPane.showMessageDialog(null,
"请先单击刷新键取得数据后再进行修改!", "提示信息",
JOptionPane.YES_OPTION);
}
DefaultTableModel model = (DefaultTableModel) getJTable()
.getModel();
int row = getJTable().getSelectedRow();
RoomSettingDao dao = new RoomSettingDao();
SingelAddJDialog sajd = new SingelAddJDialog();
sajd.getJDialog().setTitle("修改包房信息");
String roomNumber = getJTable().getValueAt(row, 0)
.toString();
String roomType = getJTable().getValueAt(row, 1).toString();
String roomPrice = null;
if (getJTable().getValueAt(row, 2) != null) {
roomPrice = getJTable().getValueAt(row, 2).toString();
} else {
roomPrice = "";
}
String roomName = getJTable().getValueAt(row, 3).toString();
String roomStatement = getJTable().getValueAt(row, 4)
.toString();
String roomCapacity = null;
if (getJTable().getValueAt(row, 5) != null) {
roomCapacity = getJTable().getValueAt(row, 5)
.toString();
} else {
roomCapacity = "";
}
String consumedId = null;
if (getJTable().getValueAt(row, 6) != null) {
consumedId = getJTable().getValueAt(row, 6).toString();
} else {
consumedId = "";
}
System.out.println(roomNumber);
// if(dao.findModifyColumn(roomNumber)){
// sajd.getRoomTypejComboBox().setSelectedItem(roomType);
// sajd.getRoomIdjTextField().setText(roomNumber);
// sajd.getRoomNamejTextField().setText(roomName);
// sajd.getJDialog().setVisible(true);
// }
}
});
}
return Modify2jButton;
}
/**
* This method initializes jButton1
*
* @return javax.swing.JButton
*/
private JButton getBatchAddjButton() {
if (BatchAddjButton == null) {
BatchAddjButton = new JButton();
BatchAddjButton.setBounds(new java.awt.Rectangle(510, 315, 91, 31));
BatchAddjButton.setText("批量添加");
BatchAddjButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
BatchAddJDialog bajd = new BatchAddJDialog();
bajd.getJDialog().setTitle("批量添加包房");
bajd.getJDialog().setVisible(true);
}
});
}
return BatchAddjButton;
}
/**
* This method initializes jButton3
*
* @return javax.swing.JButton
*/
private JButton getSingleAddjButton() {
if (SingleAddjButton == null) {
SingleAddjButton = new JButton();
SingleAddjButton
.setBounds(new java.awt.Rectangle(510, 271, 92, 31));
SingleAddjButton.setText("单个添加");
SingleAddjButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SingelAddJDialog sajd = new SingelAddJDialog();
sajd.getJDialog().setTitle("单个添加包房");
sajd.getJDialog().setVisible(true);
}
});
}
return SingleAddjButton;
}
/**
* This method initializes RoomConditionjComboBox
*
* @return javax.swing.JComboBox
*/
private JComboBox getRoomConditionjComboBox() {
if (RoomConditionjComboBox == null) {
RoomConditionjComboBox = new JComboBox();
RoomConditionjComboBox.setBounds(new java.awt.Rectangle(149, 226,
167, 17));
}
return RoomConditionjComboBox;
}
/**
* This method initializes RoomTypejScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getRoomTypejScrollPane() {
if (RoomTypejScrollPane == null) {
RoomTypejScrollPane = new JScrollPane();
RoomTypejScrollPane.setBounds(new java.awt.Rectangle(15, 15, 465,
182));
RoomTypejScrollPane.setViewportView(getRoomTypejTable());
}
return RoomTypejScrollPane;
}
/**
* This method initializes RoomTypejTable
*
* @return javax.swing.JTable
*/
private JTable getRoomTypejTable() {
if (RoomTypejTable == null) {
Object[][] date = {};
String[] name = { "包间类型", "最低消费", "包间计费方式", "包间容量" };
DefaultTableModel model = new DefaultTableModel(date, name);
RoomSettingDao dao = new RoomSettingDao();
RoomTypejTable = new JTable(model);
RoomTypejTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
RoomTypejTable.setDragEnabled(true);
Vector v = dao.findRoomType();
Iterator iter = v.iterator();
while (iter.hasNext()) {
RoomType value = (RoomType) iter.next();
Object[] data = { value.getRoomType(), String.valueOf(value.getRoomPrice()),
value.getChargePlan(), String.valueOf(value.getRoomCapacity()) };
model.addRow(data);
}
}
return RoomTypejTable;
}
/**
* This method initializes RoomInfojScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getRoomInfojScrollPane() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -