ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
package com.vci.client.framework.systemConfig.stafforgmanage;
 
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
 
import com.vci.client.LogonApplication;
import com.vci.client.framework.systemConfig.stafforgmanage.listeners.MachSecurityImportActionListener;
import com.vci.client.ui.swing.KJButton;
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.common.locale.LocaleDisplay;
 
 
 
public class MachSecurityImportDialog extends VCIJDialog {
 
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
 
    private MachSecurityImportActionListener actionListener = new MachSecurityImportActionListener(this);
    private VCIJButton btnSave = VCISwingUtil.createVCIJButton("save", "提交", "save", "accept.png", actionListener);
    private KJButton cancelButton = new KJButton(
            LocaleDisplay.getI18nString("rmip.framework.button.cancel", "RMIPFramework", getLocale()),
            "bullet_delete.png");
    
    /**
     * 选择导入文件
     */
    private VCIJButton btnSelect = VCISwingUtil.createVCIJButton("select", "选择导入文件", "选择导入文件", "search.png", actionListener);
    
    private ArrayList<File> lists = new ArrayList<File>();
    /**
     * 如果是选择时记录用户选择的数据
     */
    private Object[] selectedDatas = null;
    
//    private RoleTablePanel actionExecute = null;
    
    //创建系统所有部门map
    private    HashMap<String, String> allDept = new HashMap<String, String>();
    
    public MachSecurityImportDialog() {
        super(LogonApplication.frame, true);
        init();
    }
    
    
    /**
     * 
     * @param type
     * @param context
     * @param defination
     * @param factory
     * @param paramsMap
     * @param operateType
     * @param roleTablePanel
     * @param isShowSelect 是否显示选择按钮
     */
 
    public void init(){
        setTitle("机器密级导入");
        initDialogSize(520, 320);
        
        setLayout(new BorderLayout());
        add(getNorthPanel(),BorderLayout.NORTH);
        add(new VCIJScrollPane(getCenterPanel()),BorderLayout.CENTER);
        add(getSouthButtonPanel(), BorderLayout.SOUTH);
        
        this.setVisible(true);
        //setSize(UIHelper.DIALOG_DEFAULT_WIDTH, UIHelper.DIALOG_DEFAULT_HEIGHT);
    }
    
    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(400);
        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);
        pal.add(cancelButton);
                
        cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(ActionEvent e) {
                cancelButton_ActionPerformed(e);
            }
        });
        
        btnSave.setEnabled(true);
        return pal;
    }
    
 
    /**
     * 取消按钮事件
     * 
     * @param e
     */
    private void cancelButton_ActionPerformed(ActionEvent e) {
        this.dispose();
    }
    
    public void refreshTableData() {
        tablePanel.refreshTableData();
    }
    /**
     * 获取选中的文件
     * @return
     */
    @SuppressWarnings("deprecation")
    public LinkedList<File> getSelectedFiles() {
        LinkedList<File> selectedFiles = this.tablePanel.getSelectedRowObjects();
        return selectedFiles;
    }
 
    public VCIJButton getBtnSave() {
        return btnSave;
    }    
//    public RoleTablePanel getActionExecute() {
//        return actionExecute;
//    }
//
//    public void setActionExecute(RoleTablePanel 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;
    }
}