001    package nl.cwi.sen1.visplugin.table;
002    
003    import nl.cwi.sen1.visplugin.VisualizationPluginController;
004    import nl.cwi.sen1.visplugin.VisualizationPluginWindow;
005    import aterm.ATerm;
006    
007    /**
008     * The TableVisualizationController class
009     *
010     * @author Srinivasan Tharmarajah
011     * @author Wasim Alsaqaf
012     * @author Antoine Savelkoul
013     * @author Arend van Beelen
014     * @date 07-03-2007
015     */
016    public class TableVisualizationController extends VisualizationPluginController {
017    
018        private TableVisualizationWindow m_window;
019    
020        /**
021         * Default constructor.
022         *
023         */
024        public TableVisualizationController() {
025            super();
026    
027            m_window = null;
028        }
029    
030        /**
031         * Return Table visualization window
032         *
033         */
034        public VisualizationPluginWindow createWindow() {
035            m_window = new TableVisualizationWindow();
036            return m_window;
037        }
038    
039        /**
040         * Gets the plugin name [Table Visualization Plugin]
041         *
042         */
043        public String getPluginName() {
044            return "Table";
045        }
046    
047        /**
048         * Called when a file open dialog is accepted.
049         *
050         * @param windowId ID of the window that requested the export.
051         * @param filename Filename returned by the file open dialog.
052         *
053         */
054        public void vpFileDialogResult(int windowId, String filename) {
055            TableVisualizationWindow window = (TableVisualizationWindow) getWindowById(windowId);
056    
057            switch (getWindowExportRequestType(windowId)) {
058            case rStore:
059                window.exportToRStore(filename);
060                break;
061    
062            default:
063                super.vpFileDialogResult(windowId, filename);
064            }
065        }
066    
067        /**
068         * Define the supported types. Not implemented because we override the
069         * isTypeSupported() function.
070         *
071         */
072        public ATerm[] getSupportedTypes() {
073            ATerm[] atermList = new ATerm[0];
074            return atermList;
075        }
076    
077        /**
078         * Check if a type is supported
079         *
080         * @param type The type to check
081         */
082        protected boolean isTypeSupported(ATerm type) {
083           return true;
084        }
085    }