dangsn
2024-12-26 4e9ff2ce6a830bb2340d7c8612c72eea0c5a553e
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
package com.vci.client.framework.rightConfig.functiontree;
 
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
 
import com.vci.client.framework.rightConfig.modelConfig.ModuleConfigMainPanel;
import com.vci.client.ui.swing.VCISwingUtil;
import com.vci.client.ui.swing.components.VCIJButton;
import com.vci.client.ui.swing.components.VCIJDialog;
import com.vci.client.ui.swing.components.VCIJPanel;
import com.vci.client.ui.swing.components.VCIJScrollPane;
import com.vci.client.ui.swing.components.table.AbstractVCIJTableDataProvider;
import com.vci.client.ui.swing.components.table.VCIJTableNode;
import com.vci.client.ui.swing.components.table.VCIJTablePanel;
import com.vci.mw.ClientContextVariable;
 
/**
 * 成员导入 窗口。
 * @author caicong
 *
 */
public class FunOperateImportDialog extends VCIJDialog {
    
    private static final long serialVersionUID = 6400165410571370254L;
    private FunOperateExcelImportDialogActionListener actionListener = new FunOperateExcelImportDialogActionListener(this);
    private VCIJButton btnSave = VCISwingUtil.createVCIJButton("save", "提交", "save", "accept.png", actionListener);
    private VCIJButton btnExport = VCISwingUtil.createVCIJButton("export", "导出Excel模板", "导出Excel模板", "search.png", actionListener);
    
    /**
     * 选择导入文件
     */
    private VCIJButton btnSelect = VCISwingUtil.createVCIJButton("select", "选择导入文件", "选择导入文件", "search.png", actionListener);
    
    
    private ArrayList<File> lists = new ArrayList<File>();
    /**
     * 如果是选择时记录用户选择的数据
     */
    private Object[] selectedDatas = null;
    
    private ModuleConfigMainPanel actionExecute = null;
    
    //创建系统所有部门map
    private    HashMap<String, String> allDept = new HashMap<String, String>();
    
    /**
     * 
     * @param type
     * @param context
     * @param defination
     * @param factory
     * @param paramsMap
     * @param operateType
     * @param userTablePanel
     * @param isShowSelect 是否显示选择按钮
     */
    public FunOperateImportDialog(ModuleConfigMainPanel modelManagementPanel) {
        super(ClientContextVariable.getFrame(), true);
        this.actionExecute = modelManagementPanel;
    }
 
    public void init(){
        setTitle("功能模块管理导入");
        setLayout(new BorderLayout());
        add(getNorthPanel(),BorderLayout.NORTH);
        add(new VCIJScrollPane(getCenterPanel()),BorderLayout.CENTER);
        add(getSouthButtonPanel(), BorderLayout.SOUTH);
    }
    
    private VCIJPanel getNorthPanel() {
        
        VCIJPanel pal = new VCIJPanel();
        pal.setLayout(new FlowLayout());
        pal.add(btnSelect,BorderLayout.CENTER);
        return pal;
    }
    
    VCIJTablePanel<File> tablePanel = null;
    //table用于存放选择的文件列表。
    private VCIJTablePanel<File> getCenterPanel(){
        MyDataProvider dataProvider = new MyDataProvider();
        tablePanel = new VCIJTablePanel<File>(dataProvider);
        tablePanel.setColumnDefaultWidth(500);
        tablePanel.setShowPaging(false);
        tablePanel.setShowExport(false);
        tablePanel.buildTablePanel();
        return tablePanel;
    }
    
    class MyDataProvider extends AbstractVCIJTableDataProvider<File>{
            @Override
            public int getTotal() {
                return this.total;
            }
            String[]  strs = null;
            @Override
            public String[] getSpecialColumns() {
                strs = new String[1];
                strs[0] ="文件";
                return strs;
            }
    
            @Override
            public VCIJTableNode<File> getNewRowNode(File file) {
                VCIJTableNode<File> node = new VCIJTableNode<File>(file);
                for(String f:strs){
                    node.setPropertyValue(f, file.getName());
                    }
                return node;
            }
    
            @Override
            public File[] getDatas(int paramInt1, int paramInt2) {
                return lists.toArray(new File[]{});
            }
        }
    
    private VCIJPanel getSouthButtonPanel(){
        VCIJPanel pal = new VCIJPanel();
        pal.setLayout(new FlowLayout());
        /*pal.add(btnExport);*/
        pal.add(btnSave);
        btnSave.setEnabled(true);
        return pal;
    }
    /**
     * 获取选中的文件
     * @return
     */
    @SuppressWarnings("deprecation")
    public LinkedList<File> getSelectedFiles() {
        LinkedList<File> selectedFiles = this.tablePanel
                .getSelectedRowObjects();
        return selectedFiles;
    }
 
    public VCIJButton getBtnSave() {
        return btnSave;
    }
    
    public VCIJButton getBtnExport() {
        return btnExport;
    }
 
    public ModuleConfigMainPanel getActionExecute() {
        return actionExecute;
    }
 
    public void setActionExecute(ModuleConfigMainPanel actionExecute) {
        this.actionExecute = actionExecute;
    }
 
 
    public Object[] getSelectedDatas() {
        return selectedDatas;
    }
 
    public VCIJButton getBtnSelect() {
        return btnSelect;
    }
 
    public void setSelectedDatas(Object[] selectedDatas) {
        this.selectedDatas = selectedDatas;
    }
 
    public ArrayList<File> getLists() {
        return lists;
    }
 
    public void setLists(ArrayList<File> lists) {
        this.lists = lists;
    }
 
    public HashMap<String, String> getAllDept() {
        return allDept;
    }
 
    public void setAllDept(HashMap<String, String> allDept) {
        this.allDept = allDept;
    }
    
}