View Javadoc

1   package es.inteco.eni.swing;
2   
3   import java.awt.event.ActionEvent;
4   import java.awt.event.ActionListener;
5   import java.io.IOException;
6   
7   import javax.swing.JOptionPane;
8   
9   import org.apache.log4j.Logger;
10  
11  import es.inteco.eni.commons.MessagesHelper;
12  import es.inteco.eni.utils.ExceptionUtils;
13  
14  /**
15   * Action listener para gestionar el click en el botón de guardar XML como...
16   * 
17   * 
18   *
19   */
20  public class SaveAsXmlButtonActionListener implements ActionListener{
21  	/**
22  	 * Log
23  	 */
24  	private static Logger log = Logger.getLogger(SaveAsXmlButtonActionListener.class);
25  	/**
26  	 * Ventana del validador
27  	 */
28  	private ENIValidator eniValidator;
29  
30  	/**
31  	 * Constructor
32  	 * @param eniValidator
33  	 */
34  	public SaveAsXmlButtonActionListener(ENIValidator eniValidator){
35  		this.eniValidator = eniValidator;
36  	}
37  
38  	/**
39  	 * 
40  	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
41  	 */
42  	@Override
43  	public void actionPerformed(ActionEvent e) {
44  		try{
45  			SaveXmlButtonActionListener.showAndSaveFileChooser(eniValidator);
46  		}catch (IOException ioe) {
47  			log.error(ExceptionUtils.stackTraceToString(ioe));
48  			JOptionPane.showMessageDialog(eniValidator, 
49  					MessagesHelper.getText("eni.save.xml.error.message"),
50  					MessagesHelper.getText("eni.save.xml.error.title"),
51  					JOptionPane.ERROR_MESSAGE); 
52  		}
53  	} 
54  }