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;
|
}
|
|
}
|