001 package nl.cwi.sen1.visplugin.graphplugin;
002
003 import nl.cwi.sen1.visplugin.VisualizationPluginController;
004 import nl.cwi.sen1.visplugin.VisualizationPluginWindow;
005 import aterm.ATerm;
006
007 /**
008 * Graph Plugin Visualisation Controller. Controller for the graph
009 * window.
010 *
011 * @author A. Belgraver
012 * @author Anton Gerdessen (reviewer)
013 * @date 07-3-2007
014 */
015 public class GraphVisualizationController extends
016 VisualizationPluginController {
017
018 private final String m_pluginName = "Graph";
019
020 /**
021 * @todo Needs better implementation needs to be resolved reflection, dynamic
022 * dispatch... in a the base or utility class for all plugins, remark by Anton G.
023 */
024 private final String m_relationGraph = "relation([str,str])";
025 private final String m_relationGraphTuple = "relation([tuple([str,loc]),tuple([str,loc])])";
026 private final String m_attributedGraphTuple = "relation([tuple([str,relation([str,str])]),str])";
027
028 /**
029 * Constructor.
030 *
031 * @author R. van Remortel
032 * @author Anton Gerdessen (reviewer)
033 * @date 07-3-2007
034 */
035 public GraphVisualizationController() {
036 super();
037 }
038
039 /**
040 * Creates a VisualizationWindow.
041 *
042 * @author A. Belgraver
043 * @author Anton Gerdessen (reviewer)
044 * @date 07-3-2007
045 */
046 public VisualizationPluginWindow createWindow() {
047 return new GraphVisualizationWindow();
048 }
049
050 /**
051 * Creates a VisualizationWindow.
052 *
053 * @return Name of this plugin
054 * @author A. Belgraver
055 * @author Anton Gerdessen (reviewer)
056 * @date 07-3-2007
057 */
058 public String getPluginName() {
059 return m_pluginName;
060 }
061
062 /**
063 * Returns array holding the types supported by this plugin.
064 *
065 * @return Array of supported ATerms
066 * @author A. Belgraver
067 * @author Anton Gerdessen (reviewer)
068 * @date 07-3-2007
069 */
070 public ATerm[] getSupportedTypes() {
071 ATerm[] atermList = { makeATerm(m_relationGraph), makeATerm(m_relationGraphTuple), makeATerm(m_attributedGraphTuple) };
072 return atermList;
073 }
074
075 /**
076 * Creates an Aterm based on a String.
077 *
078 * @return ATerms created from String
079 * @author A. Belgraver
080 * @author Anton Gerdessen (reviewer)
081 * @date 07-3-2007
082 */
083 private ATerm makeATerm(String type) {
084 return m_factory.RTypeFromString(type);
085 }
086
087 }