001package csheets.ext.database.ui;
002
003import java.awt.event.ActionEvent;
004
005import csheets.core.Cell;
006import csheets.core.Spreadsheet;
007import csheets.core.formula.compiler.FormulaCompilationException;
008import csheets.ui.ctrl.*;
009import java.util.logging.Level;
010import java.util.logging.Logger;
011
012/**
013 * Import submenu
014 * 
015 * @author João Carreira
016 */
017public class ImportAction extends FocusOwnerAction 
018{
019
020    /* The user interface controller */
021    protected UIController uiController;
022
023    /**
024     * Import action
025     * @param uiController 
026     */
027    public ImportAction(UIController uiController) 
028    {
029        this.uiController = uiController;
030    }
031
032    /**
033     * return name of the Export submenu
034     * @return 
035     */
036    @Override
037    protected String getName() 
038    {
039        return "Import from database";
040    }
041
042    /**
043     * 
044     */
045    @Override
046    protected void defineProperties() 
047    {
048    }
049
050    /**
051     * A simple action that presents a confirmation dialog. this method catch
052     * the selected cells and create the UIExport
053     * 
054     * @param event
055     *            the event that was fired
056     */
057    @Override
058    public void actionPerformed(ActionEvent event) 
059    {
060        /* gettings the current spreadsheet  */
061        Spreadsheet spreadSheet = focusOwner.getSpreadsheet();
062        
063        try 
064        {
065            UIImport uiImp = new UIImport(spreadSheet);
066        } 
067        catch (Exception ex) 
068        {
069            Logger.getLogger(ImportAction.class.getName()).log(Level.SEVERE, null, ex);
070        }       
071    }
072}