001    package nl.cwi.sen1.visplugin.piechart;
002    
003    import nl.cwi.sen1.visplugin.VisualizationPluginController;
004    import nl.cwi.sen1.visplugin.VisualizationPluginWindow;
005    import aterm.ATerm;
006    
007    /**
008     * PieChart Plugin Visualisation Controller. Controller for the Pie Chart
009     * Window.
010     * 
011     * @author A. Belgraver
012     * @author R. van Remortel
013     * @author Aldert Boerhoop (reviewer)
014     * @author Anton Gerdessen (reviewer)
015     * @date 07-3-2007
016     */
017    public class PCVisualizationController extends
018            VisualizationPluginController {
019    
020        /**
021         * Constructor.
022         * 
023         * @author A. Belgraver
024         * @author R. van Remortel
025         * @author Aldert Boerhoop (reviewer)
026         * @author Anton Gerdessen (reviewer)
027         * @date 07-3-2007
028         */
029        public PCVisualizationController() {
030            super();
031        }
032    
033        /**
034         * Creates a PieChartVisualizationWindow.
035         * 
036         * @author A. Belgraver
037         * @author R. van Remortel
038         * @author Aldert Boerhoop (reviewer)
039         * @author Anton Gerdessen (reviewer)
040         * @date 07-3-2007
041         */
042        public VisualizationPluginWindow createWindow() {
043            return new PCVisualizationWindow();
044        }
045    
046        /**
047         * Creates a PieChartVisualizationWindow.
048         * 
049         * @return Name of this plugin.
050         * @author A. Belgraver
051         * @author R. van Remortel
052         * @author Aldert Boerhoop (reviewer)
053         * @author Anton Gerdessen (reviewer)
054         * @date 07-3-2007
055         */
056        public String getPluginName() {
057            return "Pie chart";
058        }
059    
060        /**
061         * Returns array holding the types supported by this plugin.
062         * 
063         * @return Array of supported ATerms
064         * @author A. Belgraver
065         * @author R. van Remortel
066         * @author Aldert Boerhoop (reviewer)
067         * @author Anton Gerdessen (reviewer)
068         * @date 07-3-2007
069         */
070        public ATerm[] getSupportedTypes() {
071            ATerm[] atermList = { makeATerm("relation([str,int])"),
072                    makeATerm("relation([int,str])"),
073                    makeATerm("relation([int])")
074                    };
075            return atermList;
076        }
077    
078        /**
079         * Creates an aterm based on a String.
080         * 
081         * @return ATerms created from String
082         * @author A. Belgraver
083         * @author R. van Remortel
084         * @author Aldert Boerhoop (reviewer)
085         * @author Anton Gerdessen (reviewer)
086         * @date 07-3-2007
087         */
088        private ATerm makeATerm(String type) {
089            return m_factory.RTypeFromString(type);
090        }
091    
092    }