package com.vci.ubcs.codeapply;
|
|
import java.awt.BorderLayout;
|
import java.awt.Dimension;
|
import java.awt.FlowLayout;
|
import java.awt.Toolkit;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseEvent;
|
import java.util.LinkedList;
|
|
|
|
import com.vci.base.ui.swing.VCIOptionPane;
|
import com.vci.base.ui.swing.VCISwingUtil;
|
import com.vci.base.ui.swing.components.*;
|
import com.vci.base.ui.swing.components.table.VCIJTablePanel;
|
import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateVO;
|
import com.vci.ubcs.codeapply.object.BaseModel;
|
import com.vci.ubcs.codeapply.object.CodeClassify;
|
|
public class CodeApplyFor410SearchDialog extends VCIJDialog {
|
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
private CodeApplyPanelFor410 ownerPanel;
|
private VCIJLabel codeName = new VCIJLabel("代码:");
|
private VCIJTextField txtCodeName = new VCIJTextField(false);
|
private VCIJButton btnSearch= VCISwingUtil.createVCIJButton("btnSearch", "查询", "查询", "search.png", null);
|
private VCIJButton btnOk = VCISwingUtil.createVCIJButton("replace", "确定", "确定", "ok.gif",null);
|
private VCIJButton btnCancel = VCISwingUtil.createVCIJButton("cancel", "取消", "取消", "cancel.gif",null);
|
private String strName = "";
|
private String str = "";
|
public CodeApplyFor410SearchDialog(CodeApplyPanelFor410 ownerPanel){
|
//super(LogonApplication.frame,true);
|
this.ownerPanel = ownerPanel;
|
this.setTitle("查询代码");
|
Dimension dime = Toolkit.getDefaultToolkit().getScreenSize();
|
int x = dime.width/2 - 300;
|
int y = dime.height/2 - 300;
|
this.setLocation(x, y);
|
this.setSize(new Dimension(700, 600));
|
init();
|
setModal(true);
|
setVisible(true);
|
}
|
private LinkedList<VCIJButton> selfCustomButtons = new LinkedList<VCIJButton>();
|
{
|
selfCustomButtons.add(btnOk);
|
selfCustomButtons.add(btnCancel);
|
}
|
|
public void init(){
|
setLayout(new BorderLayout());
|
add(nothPanel(),BorderLayout.NORTH);
|
add(createCenterTPanel(), BorderLayout.CENTER);
|
cancel();
|
}
|
private VCIJPanel nothPanel(){
|
VCIJPanel pal = new VCIJPanel();
|
VCIJPanel nothPanel = new VCIJPanel();
|
nothPanel.setLayout(null);
|
nothPanel.setPreferredSize(new Dimension(300,40));
|
codeName.setBounds(10, 5, 60, 28);
|
txtCodeName.setBounds(70, 5, 200, 28);
|
btnSearch.setBounds(300, 5, 80, 25);
|
nothPanel.add(codeName);
|
nothPanel.add(txtCodeName);
|
nothPanel.add(btnSearch);
|
pal.setLayout(new BorderLayout());
|
pal.add(nothPanel);
|
pal.setVisible(true);
|
return pal;
|
}
|
private CodeApplyFor410SearchMainPanel codeDataMainPanel=null;
|
private VCIJPanel createCenterTPanel(){
|
codeDataMainPanel=new CodeApplyFor410SearchMainPanel();
|
CodeApplyFor410SearchProvider dataProvider=new CodeApplyFor410SearchProvider(this);
|
codeDataMainPanel.setDataProvider(dataProvider);
|
codeDataMainPanel.setCustomTopPanel(nothPanel());
|
codeDataMainPanel.buildPanel();
|
VCIJTable table = codeDataMainPanel.getTablePanel().getTable();
|
table.addMouseListener(new MouseAdapter() {
|
public void mouseClicked(MouseEvent e) {
|
if (e.getButton() == 1 && e.getClickCount() == 2) {
|
btnOk.doClick();
|
}
|
}
|
});
|
return codeDataMainPanel;
|
}
|
|
|
public VCIJTablePanel<BaseModel> getPanel() {
|
return codeDataMainPanel.getTablePanel();
|
}
|
/**
|
* 按钮事件
|
*/
|
public void cancel(){
|
btnCancel.addActionListener(new ActionListener() {
|
@Override
|
public void actionPerformed(ActionEvent e) {
|
// TODO Auto-generated method stub
|
btn_Cancel(); //取消
|
}
|
});
|
btnSearch.addActionListener(new ActionListener(){
|
public void actionPerformed(ActionEvent arg0) {
|
searchButton_action();//查询
|
}
|
});
|
btnOk.addActionListener(new ActionListener(){
|
public void actionPerformed(ActionEvent arg0) {
|
okButton_action();//确定
|
}
|
});
|
}
|
public void okButton_action(){
|
int len = codeDataMainPanel.getTablePanel().getSelectedRowObjects().size();
|
if (len==0) {
|
VCIOptionPane.showMessage(this, "请先选择要操作的数据");
|
return;
|
}else if (len>1) {
|
VCIOptionPane.showMessage(this, "一次只能选择一条数据进行操作");
|
return;
|
}
|
LinkedList<BaseModel> list = codeDataMainPanel.getTablePanel().getSelectedRowObjects();
|
for (BaseModel object : list) {
|
str = object.getId();
|
setStr(str);
|
}
|
this.dispose();
|
}
|
|
public void searchButton_action(){
|
strName = txtCodeName.getText();
|
setStrName(strName);
|
codeDataMainPanel.getTablePanel().refreshTableData();
|
}
|
|
public CodeApplyPanelFor410 getOwnerPanel() {
|
return ownerPanel;
|
}
|
|
public void setOwnerPanel(CodeApplyPanelFor410 ownerPanel) {
|
this.ownerPanel = ownerPanel;
|
}
|
|
public String getStr() {
|
return str;
|
}
|
public void setStr(String str) {
|
this.str = str;
|
}
|
public String getStrName() {
|
return strName;
|
}
|
public void setStrName(String strName) {
|
this.strName = strName;
|
}
|
public void btn_Cancel(){
|
this.dispose();
|
}
|
}
|