xiejun
2025-01-23 9ac3bd680a350c1cc4baad082d92cd2c5f158f3e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
package com.vci.rmip.code.client.codeapply.Apply410;
 
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.rmip.code.client.codeapply.Apply410.object.TokenUserObject;
import com.vci.rmip.code.client.codeapply.Apply410.object.UIFormRefer;
import com.vci.rmip.code.client.codeapply.Apply410.object.ubcscode.model.BaseModel;
 
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
 
public class CodeDataMainPanel extends VCIJPanel {
 
    /**
     * 自定义顶部控件区域
     */
    private AttarSearchPanel 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);
    private TokenUserObject tokenUserObject=null;
    public CodeDataMainPanel(UIFormRefer uiFormRefer, TokenUserObject tokenUserObject) {
        this.uiFormRefer=uiFormRefer;
        this.tokenUserObject=tokenUserObject;
    }
    private Map<String,String> customCondtionMap=new HashMap<>();
    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<BaseModel> tablePanel = null;
    private AbstractVCIJTableDataProvider<BaseModel> dataProvider = null;
    private VCIJPanel createCenterDataTablePanel() {
        tablePanel = new VCIJTablePanel<BaseModel>(dataProvider);
        //tablePanel.setCustomButtons(getCombinedButtons());
        //tablePanel.setShowExport(true);
        tablePanel.setShowPaging(true);
        tablePanel.setShowProgressBar(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 AttarSearchPanel getCustomTopPanel() {
        return customTopPanel;
    }
 
    public void setCustomTopPanel(AttarSearchPanel customTopPanel) {
        this.customTopPanel = customTopPanel;
    }
 
    public VCIJTablePanel<BaseModel> getTablePanel() {
        return tablePanel;
    }
 
    public void setTablePanel(VCIJTablePanel<BaseModel> tablePanel) {
        this.tablePanel = tablePanel;
    }
 
 
    public UIFormRefer getUiFormRefer() {
        return uiFormRefer;
    }
 
    public void setUiFormRefer(UIFormRefer uiFormRefer) {
        this.uiFormRefer = uiFormRefer;
    }
 
    public TokenUserObject getTokenUserObject() {
        return tokenUserObject;
    }
 
    public void setTokenUserObject(TokenUserObject tokenUserObject) {
        this.tokenUserObject = tokenUserObject;
    }
 
    public AbstractVCIJTableDataProvider<BaseModel> getDataProvider() {
        return dataProvider;
    }
 
    public void setDataProvider(AbstractVCIJTableDataProvider<BaseModel> dataProvider) {
        this.dataProvider = dataProvider;
    }
 
    public Map<String, String> getCustomCondtionMap() {
        customCondtionMap=new HashMap<>();
        if(this.getCustomTopPanel()!=null){
            Map<String,String> newCustomCondtionMap= this.getCustomTopPanel().getAttrSearchFilterString();
            customCondtionMap.putAll(newCustomCondtionMap);
        }
        return customCondtionMap;
    }
 
    public void setCustomCondtionMap(Map<String, String> customCondtionMap) {
        this.customCondtionMap = customCondtionMap;
    }
 
    /**
     * 清空条件
     * <p>Description: </p>
     *
     * @author liujw
     */
    public void clearCustomTopPanel(){
        customCondtionMap.clear();
        AttarSearchPanel search = (AttarSearchPanel)getCustomTopPanel();
        search.clear();
    }
}