package com.vci.ubcs.codeapply;
|
|
import com.vci.base.ui.swing.VCISwingUtil;
|
import com.vci.base.ui.swing.components.VCIJButton;
|
import com.vci.base.ui.swing.components.VCIJPanel;
|
import com.vci.base.ui.swing.components.table.AbstractVCIJTableDataProvider;
|
import com.vci.base.ui.swing.components.table.VCIJTablePanel;
|
import com.vci.ubcs.codeapply.object.UIFormRefer;
|
import org.apache.poi.ss.formula.functions.T;
|
|
import java.awt.*;
|
|
public class CodeDataMainPanel extends VCIJPanel {
|
|
/**
|
* 自定义顶部控件区域
|
*/
|
private VCIJPanel customTopPanel = null;
|
private UIFormRefer uiFormRefer;
|
private CodeDataMainPanelActionListener actionListener = new CodeDataMainPanelActionListener(this);
|
private VCIJButton btnSearch = VCISwingUtil.createVCIJButton("search", "查询", "查询", "search.png", actionListener);
|
private VCIJButton btnClear = VCISwingUtil.createVCIJButton("clear_search", "清空查询条件", "清空查询条件", "clear.gif", actionListener);
|
public CodeDataMainPanel(UIFormRefer uiFormRefer) {
|
this.uiFormRefer=uiFormRefer;
|
}
|
|
public void buildPanel(){
|
this.init();
|
}
|
private void init(){
|
initComponents();
|
}
|
|
private void initComponents(){
|
setLayout(new BorderLayout());
|
add(createNorthBaseAttrsPanel(), BorderLayout.NORTH);
|
add(createCenterDataTablePanel(), BorderLayout.CENTER);
|
}
|
/**
|
* 根据类型显示table
|
*/
|
private VCIJTablePanel<T> tablePanel = null;
|
private AbstractVCIJTableDataProvider<T> dataProvider = null;
|
private VCIJPanel createCenterDataTablePanel() {
|
tablePanel = new VCIJTablePanel<T>(dataProvider);
|
//tablePanel.setCustomButtons(getCombinedButtons());
|
tablePanel.setShowExport(true);
|
tablePanel.setShowPaging(true);
|
tablePanel.setPageButtonFlowAlign(FlowLayout.CENTER);
|
tablePanel.setCustomButtonFlowAlign(FlowLayout.CENTER);
|
tablePanel.buildTablePanel();
|
int columnCount = tablePanel.getTable().getColumnCount();
|
//tablePanel.getTable().getColumnModel().getColumn(columnCount - 2).setPreferredWidth(150);
|
//tablePanel.getTable().getColumnModel().getColumn(columnCount - 4).setPreferredWidth(150);
|
/**
|
* 禁止table表头拖动,防止第一列的复选框和第二列的序号拖动出问题:
|
* 点击某行,表格中的复选框看不到,且选中表头上的复选框系统会报错;数据信息显示不正确。
|
* 2012-12-4 wangxl
|
*/
|
tablePanel.getTable().getTableHeader().setReorderingAllowed(false);
|
tablePanel.refreshTableData();
|
return tablePanel;
|
}
|
|
private VCIJPanel createNorthBaseAttrsPanel(){
|
VCIJPanel palRes = new VCIJPanel(new BorderLayout());
|
if(getCustomTopPanel() != null){
|
|
VCIJPanel pal = new VCIJPanel();
|
pal.setLayout(new GridBagLayout());
|
GridBagConstraints c = new GridBagConstraints();
|
int x = 0;
|
int y = 0;
|
|
c.gridx = x++;
|
c.gridy = y++;
|
c.gridheight = 1;
|
c.gridwidth = 1;
|
c.weightx = 0;
|
c.weighty = 0;
|
c.fill = GridBagConstraints.NONE;
|
c.anchor = GridBagConstraints.EAST;
|
c.insets = new Insets(1, 1, 1, 1);
|
c.ipadx = 1;
|
c.ipady = 1;
|
pal.add(btnSearch, c);
|
c.gridx = x++;
|
pal.add(btnClear, c);
|
palRes.add(pal, BorderLayout.SOUTH);
|
palRes.add(getCustomTopPanel(), BorderLayout.CENTER);
|
}
|
return palRes;
|
}
|
|
public VCIJPanel getCustomTopPanel() {
|
return customTopPanel;
|
}
|
|
public void setCustomTopPanel(VCIJPanel customTopPanel) {
|
this.customTopPanel = customTopPanel;
|
}
|
|
public VCIJTablePanel<T> getTablePanel() {
|
return tablePanel;
|
}
|
|
public void setTablePanel(VCIJTablePanel<T> tablePanel) {
|
this.tablePanel = tablePanel;
|
}
|
|
|
public UIFormRefer getUiFormRefer() {
|
return uiFormRefer;
|
}
|
|
public void setUiFormRefer(UIFormRefer uiFormRefer) {
|
this.uiFormRefer = uiFormRefer;
|
}
|
|
public AbstractVCIJTableDataProvider<T> getDataProvider() {
|
return dataProvider;
|
}
|
|
public void setDataProvider(AbstractVCIJTableDataProvider<T> dataProvider) {
|
this.dataProvider = dataProvider;
|
}
|
}
|