001 package nl.cwi.sen1.gui;
002
003 import javax.swing.Action;
004 import javax.swing.JMenu;
005
006 import nl.cwi.sen1.configapi.types.Event;
007 import nl.cwi.sen1.gui.component.StudioComponent;
008 import toolbus.AbstractTool;
009 import aterm.ATermFactory;
010
011 /**
012 * The interface to the toplevel studio window.
013 * The Studio interface provides StudioPlugins with functionality
014 * for modifying properties of the toplevel window of a MetaStudio,
015 * as well as some convenience methods (functionality that is needed
016 * by virtually all StudioPlugins).
017 */
018 public interface Studio {
019 /**
020 * Get 'The' ATermFactory. For memory efficiency it is beneficial
021 * to share a single ATermFactory between all StudioPlugins. If ATerms
022 * are communicated between them, this is also a requirement.
023 *
024 * @return A reference to The ATerm Factory.
025 */
026 public ATermFactory getATermFactory();
027
028 /**
029 * Connect to the ToolBus. Many StudioPlugins will have their private
030 * connection to the ToolBus. This is the method to start it up. Note
031 * that a single plugin may use this method several times.
032 *
033 * @param toolName Name of the tool as it occurs in the ToolBus script.
034 * @param tool Java implementation of a ToolBus tool.
035 */
036 public void connect(String toolName, AbstractTool tool);
037
038 /**
039 * Register a StudioComponent. One StudioComponent corresponds to a
040 * single 'tab' somewhere in the GUI framework of the MetaStudio. The
041 * component will become immediately visible.
042 *
043 * @param component Component to add.
044 */
045 public void addComponent(StudioComponent component);
046
047 /**
048 * Unregister a StudioComponent. This is the inverse of addComponent.
049 * The component will become invisible immediately.
050 *
051 * @param component Component to remove.
052 */
053 public void removeComponent(StudioComponent component);
054
055 /**
056 * Register a menu that is linked with a particular component. The
057 * studio manages menus, such that the menus for a particular component
058 * are visible if and only if that component has the focus.
059 *
060 * @param component Component to link a menu with.
061 * @param menu JMenu to link to a component.
062 */
063 public void addComponentMenu(StudioComponent component, JMenu menu);
064
065 /**
066 * Register a menu that is linked with a particular component. The
067 * studio manages menus, such that the menus for a particular component
068 * are visible if and only if that component has the focus.
069 */
070 public void addComponentMenu(StudioComponent component, Event menu,
071 Action action);
072
073 /**
074 * Make the Studio move the focus to a specific Component.
075 * @param component Component to move the focus to.
076 */
077 public void requestFocus(StudioComponent component);
078
079 /**
080 * Make a specific Component visible.
081 * @param component Component to make visible.
082 */
083 public void makeVisible(StudioComponent component);
084 }