package com.vci.client.omd.lifecycle.ui; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import com.vci.client.omd.provider.LifeCycleProvider; import com.vci.corba.omd.lcm.LifeCycle; public class ExpActionListener implements ActionListener{ private JFileChooser fileChooser; public ExpActionListener(){ fileChooser = new JFileChooser(); fileChooser.setDialogTitle("导出"); } @Override public void actionPerformed(ActionEvent e) { List list = LifeCyclePanel.getInstance().getSelectedLCs(); if(list == null || list.size() < 1){ JOptionPane.showMessageDialog(LifeCyclePanel.getInstance(), "请选中数据", "请选中数据", JOptionPane.ERROR_MESSAGE); return; } fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setApproveButtonText("导出"); int result = fileChooser.showOpenDialog(LifeCyclePanel.getInstance()); if(result == JFileChooser.APPROVE_OPTION){ String dir = fileChooser.getSelectedFile().getAbsolutePath(); boolean rs = LifeCycleProvider.getInstance().expData(dir, list.toArray(new LifeCycle[0])); if(rs){ JOptionPane.showMessageDialog(LifeCyclePanel.getInstance(), "导出成功", "导出成功", JOptionPane.INFORMATION_MESSAGE); return; }else{ JOptionPane.showMessageDialog(LifeCyclePanel.getInstance(), "导出失败", "导出失败", JOptionPane.INFORMATION_MESSAGE); return; } } } }