packagecom.sunshine.setup;import javax.swing.*;import javax.swing.border.*;import javax.swing.table.*;import java.awt.*;import java.awt.event.*;import java.sql.*;import com.sunshine.sunsdk.sql.*; //公共类库
import com.sunshine.sunsdk.system.*;import com.sunshine.sunsdk.swing.*;import com.sunshine.mainframe.HotelFrame; //加载主窗口
public classSetupextendsJDialogimplementsActionListener, MouseListener {privateJLabel top,bott;privateJTabbedPane tp;privateJPanel panelMain;//=========房间项目设置
privateJTable tb11, tb12;private DefaultTableModel dtm11, dtm12; //房间类型列表//房间信息列表
privateJScrollPane sp11,sp12;privateJComboBox cb11,cb12;//房间类型,可供/清理状态
privateJButton bt11, bt12, bt13, bt14, bt15, bt16, bt17, bt18, bt19, bt20;//添加, 修改,删除LX,折扣,单个,批量添加,删除,修改FJ,保存,筛选
privateJTextField tf11;//=========客户类型设置
privateJTable tb21,tb22;privateDefaultTableModel dtm21,dtm22;//客户类型列表,房间费打折列表
privateJScrollPane sp21,sp22;privateJButton bt21, bt22, bt23, bt24;//添加, 修改,删除LX,房费打折//=========操作员设置
privateJTable tb31;privateDefaultTableModel dtm31;//操作员列表
privateJScrollPane sp31;private JComboBox cb31;//用户名
privateJPasswordField tf31, tf32, tf33;//原密码,新密码,确认密码
privateJRadioButton rb31, rb32, rb33, rb34, rb35;//新用户登记, 修改密码,删除用户,普通用户,管理员
privateJButton bt31, bt32, bt33;//登记, 修改, 删除//=========计费设置
privateJTextField tf41, tf42, tf43, tf44, tf45, tf46, tf47;privateJCheckBox ck;privateJButton bt41, bt42;//提示信息
String msg0 = "您确定要删除在表格中选中的资料条目吗?";
String msg1= "请在相应的表格中选定条目,再点删除键 ...";//日志信息
String journal;//INI文件中的键名
String ini[] = { "[SOFTINFO]", "UserName", "CompName", "[CONFIG]", "Soft_First","Default_Link" , "Default_Page", "Sys_style", "[NUMBER]","LodgName", "LodgNumber", "EngaName", "EngaNumber", "ChouName","ChouNumber", "[HABITUS]", "Ck_Habitus", "Ck_Minute", "[PARTTIME]","In_Room", "Out_Room1", "Out_Room2", "InsuDay", "ClockRoom1","ClockRoom2", "InsuHour1", "InsuHour2", "[JDBC]", "DBFname","UserID", "Password", "IP", "Access", "[ODBC]", "LinkName"};//实例化功能模块//========================================================================// AddRoomType art = new AddRoomType (this); //添加房间类型
ModiRoomType mrt = new ModiRoomType(this); //添加房间类型
AddCustomerType act = new AddCustomerType(this); //添加客户类型
ModiCustomerType mct = new ModiCustomerType(this); //添加客户类型
Discount dis = new Discount(this); //折扣设置
AddRoomInfo ari = new AddRoomInfo(this); //单个添加房间
AddRoomInfos aris = new AddRoomInfos(this); //批量添加房间
ModiRoomInfo mri = new ModiRoomInfo(this); //修改房间信息//========================================================================//
/**=======================================================================**
* [## public Setup(JFrame frame) {} ]: 构造函数
* 参数 :JDialog对象表示本对话框的父窗口
* 返回值 :无
* 修饰符 :public
* 功能 :组建系统设置模块
**=======================================================================***/
publicSetup(JFrame frame) {super (frame, "系统设置", true);
top= new JLabel(); //假空格
panelMain = new JPanel(new BorderLayout(0,10));
tab();//制作系统设置项目标签面板
addListener(); //加入事件监听
panelMain.add("North",top);
panelMain.add("Center",tp);this.setContentPane(panelMain);this.setPreferredSize (new Dimension (718,508));this.setMinimumSize (new Dimension (718,508));this.setResizable(false); //不允许改变窗口大小
pack();
sunswing.setWindowCenter(this); //窗口屏幕居中
}/**=======================================================================**
* [## private void addListener() {} ]: 加事件监听
* 参数 :无
* 返回值 :无
* 修饰符 :private
* 功能 :加事件监听
**=======================================================================***/
private voidaddListener() {
bt11.addActionListener(this); //加动作监听
bt12.addActionListener(this);
bt13.addActionListener(this);
bt14.addActionListener(this);
bt15.addActionListener(this);
bt16.addActionListener(this);
bt17.addActionListener(this);
bt18.addActionListener(this);
bt19.addActionListener(this);
bt20.addActionListener(this);
bt21.addActionListener(this);
bt22.addActionListener(this);
bt23.addActionListener(this);
bt24.addActionListener(this);
bt31.addActionListener(this);
bt32.addActionListener(this);
bt33.addActionListener(this);
bt41.addActionListener(this);
bt42.addActionListener(this);
rb31.addActionListener(this); //操作员作操范围监听
rb32.addActionListener(this);
rb33.addActionListener(this);
tf41.addActionListener(this); //计费设置文本框加监听
tf42.addActionListener(this);
tf43.addActionListener(this);
tf44.addActionListener(this);
tf45.addActionListener(this);
tf46.addActionListener(this);
bt11.addMouseListener(this); //加鼠标监听
bt12.addMouseListener(this);
bt13.addMouseListener(this);
bt14.addMouseListener(this);
bt15.addMouseListener(this);
bt16.addMouseListener(this);
bt17.addMouseListener(this);
bt18.addMouseListener(this);
bt19.addMouseListener(this);
bt20.addMouseListener(this);
bt21.addMouseListener(this);
bt22.addMouseListener(this);
bt23.addMouseListener(this);
bt24.addMouseListener(this);
bt31.addMouseListener(this);
bt32.addMouseListener(this);
bt33.addMouseListener(this);
bt41.addMouseListener(this);
bt42.addMouseListener(this);
}/**=======================================================================**
* [## private void tab() {} ]: 制作系统设置项目标签面板
* 参数 :无
* 返回值 :无
* 修饰符 :private
* 功能 :制作系统设置项目标签面板
**=======================================================================***/
private voidtab() {
JPanel jp1,jp2,jp3,jp4;///-------模块面板接口
jp1 = fangjian(); //房间项目设置
jp2 = kehu(); //客户类型设置
jp3 = caozuo(); //操作员设置
jp4 = jiFei(); //计费设置
// tp = newJTabbedPane();
tp.addTab("房间项目设置", new ImageIcon("pic/u01.gif"), jp1);
tp.addTab("客户类型设置", new ImageIcon("pic/u02.gif"), jp2);
tp.addTab("操作员设置", new ImageIcon("pic/u03.gif"), jp3);
tp.addTab("计费设置", new ImageIcon("pic/u04.gif"), jp4);
}/**=======================================================================**
* [## private JPanel fangjian() {} ]:
* 参数 :无
* 返回值 :JPanel
* 修饰符 :private
* 功能 :房间项目设置
**=======================================================================***/
privateJPanel fangjian() {
dtm11= newDefaultTableModel();
tb11= newJTable(dtm11);
sp11= newJScrollPane(tb11);
dtm12= newDefaultTableModel();
tb12= newJTable(dtm12);
sp12= newJScrollPane(tb12);
JPanel pfangjian,pTop,pBott,pTn,pTc,pBn,pBc,pTcc,pTcs,pBcc,pBcs;
pfangjian= new JPanel(new GridLayout(2,1,0,5));
pTop= new JPanel(newBorderLayout());
pBott= new JPanel(newBorderLayout());
pTn= new JPanel(); //放置保存按钮等...
pTc = new JPanel(new BorderLayout()); //放置房间类型列表及四个按钮
pBn = new JPanel(new FlowLayout(FlowLayout.LEFT,10,0));//放置下拉列表
pBc = new JPanel(new BorderLayout()); //放置房间信息列表及四个按钮
pTcc = new JPanel(new GridLayout(1,1));//放置房间类型列表
pTcs = new JPanel(new FlowLayout(FlowLayout.CENTER,20,5));//放置四个按钮
pBcc = new JPanel(new GridLayout(1,1));//放置房间信息列表
pBcs = new JPanel(new FlowLayout(FlowLayout.CENTER,20,5));//放置四个按钮//保存按钮等 ...
JLabel lb1,lb2,lb3;
lb1= new JLabel("结帐后房间状态变为: ");
lb2= new JLabel(" 结帐后");
lb3= new JLabel("分钟后变为可供状态 ");
tf11= new TJTextField(sunini.getIniKey(ini[17]),5); //根据INI文件给初值
tf11.setHorizontalAlignment(JTextField.RIGHT);
cb12= newJComboBox();
cb12.addItem(" 可供状态 ");
cb12.addItem(" 清理状态 "); //根据INI文件给初值
cb12.setSelectedIndex(Integer.parseInt(sunini.getIniKey(ini[16])));
bt19= new TJButton ("pic/save.gif", " 保 存 ", "保存设置");
pTn.add(lb1);
pTn.add(cb12);
pTn.add(lb2);
pTn.add(tf11);
pTn.add(lb3);
pTn.add(bt19);
pTn.setBorder(BorderFactory.createTitledBorder(""));//房间类型列表及四个按钮
bt11 = new TJButton ("pic/new.gif", "添加类型", "添加房间类型");
bt12= new TJButton ("pic/modi0.gif", "修改类型", "修改房间类型");
bt13= new TJButton ("pic/del.gif", "删除类型", "删除房间类型");
bt14= new TJButton ("pic/modi3.gif", "房费打折", "设置房间费折扣");
pTcc.add(sp11);
pTcs.add(bt11);
pTcs.add(bt12);
pTcs.add(bt13);
pTcs.add(bt14);
pTc.add(pTcc);
pTc.add("South",pTcs);
pTc.setBorder(BorderFactory.createTitledBorder("房间类型"));//完成上半部分
pTop.add("North",pTn);
pTop.add(pTc);//下拉列表
JLabel lb0 = new JLabel("按包厢类型过滤: ");
cb11= newJComboBox();
bt20= new TJButton ("pic/choose1.gif", "筛 选", "筛选房间信息");
bt20.setBorderPainted(false);
bt20.setFocusPainted(false);
pBn.add(lb0);
pBn.add(cb11);
pBn.add(bt20);
buildDTM11();//初始化房间类型列表和下拉列表的值
buildDTM12(""); //初始化房间号列表//房间信息列表及四个按钮
bt15 = new TJButton ("pic/new.gif", "单个添加", "添加单个房间信息");
bt16= new TJButton ("pic/book.gif", "批量添加", "批量添加房间信息");
bt17= new TJButton ("pic/del.gif", "删除房间", "删除某个房间信息");
bt18= new TJButton ("pic/modi0.gif", "修改房间", "修改某个房间信息");
pBcc.add(sp12);
pBcs.add(bt15);
pBcs.add(bt16);
pBcs.add(bt17);
pBcs.add(bt18);
pBc.add(pBcc);
pBc.add("South",pBcs);
pBc.setBorder ( BorderFactory.createTitledBorder ("房间信息") );//完成下半部分
pBott.add("North",pBn);
pBott.add(pBc);//组合
pfangjian.add(pTop);
pfangjian.add(pBott);returnpfangjian;
}// /**=======================================================================**
* [## private void buildDTM11() {} ]:
* 参数 :无
* 返回值 :无
* 修饰符 :private
* 功能 :房间类型列表和ComboBox
**=======================================================================***/
private voidbuildDTM11() {
String sqlCode2= "select pk,sysmark,id,foregift,r_t