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 lists = new ArrayList(); /** * 如果是选择时记录用户选择的数据 */ private Object[] selectedDatas = null; // private RoleTablePanel actionExecute = null; //创建系统所有部门map private HashMap allDept = new HashMap(); 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 tablePanel = null; //table用于存放选择的文件列表。 private VCIJTablePanel getCenterPanel(){ MyDataProvider dataProvider = new MyDataProvider(); tablePanel = new VCIJTablePanel(dataProvider); tablePanel.setColumnDefaultWidth(400); tablePanel.setShowPaging(false); tablePanel.setShowExport(false); tablePanel.buildTablePanel(); return tablePanel; } class MyDataProvider extends AbstractVCIJTableDataProvider{ @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 getNewRowNode(File file) { VCIJTableNode node = new VCIJTableNode(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 getSelectedFiles() { LinkedList 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 getLists() { return lists; } public void setLists(ArrayList lists) { this.lists = lists; } public HashMap getAllDept() { return allDept; } public void setAllDept(HashMap allDept) { this.allDept = allDept; } }