The Meta-Environment API

nl.cwi.sen1.gui
Class StudioImpl

java.lang.Object
  extended by nl.cwi.sen1.gui.StudioImpl
All Implemented Interfaces:
GuiTif, Studio
Direct Known Subclasses:
StudioImplWithPredefinedLayout

public class StudioImpl
extends java.lang.Object
implements Studio, GuiTif

Toplevel window of The Meta-Environment. This class wraps two functionalities. First it builds up a toplevel window with tabs and menu's. Second it dynamically loads jars provided by the ToolBus. The loaded jars will add tabs to the GUI, and register menus using the Studio interface.


Field Summary
private  net.infonode.docking.View activeView
           
private  GuiBridge bridge
           
private  java.util.Map<StudioComponent,java.util.List<javax.swing.JMenuItem>> componentMenus
           
protected  java.util.Map<net.infonode.docking.View,StudioComponent> componentsByView
           
private  nl.cwi.sen1.configapi.Factory configFactory
           
private  net.infonode.docking.theme.DockingWindowsTheme currentTheme
           
private  aterm.pure.PureFactory factory
           
private static javax.swing.JFrame frame
           
private  java.util.Map<StudioComponent,java.lang.Integer> idsByComponent
           
private  java.util.List<java.lang.String> jobQueue
           
private  boolean menuBarUpdatePending
           
private  nl.cwi.sen1.configapi.types.ActionDescriptionList menuList
           
private static int nextUniqueComponentID
           
private  java.util.List<StudioPlugin> plugins
           
(package private)  javax.swing.JProgressBar progressBar
           
private  net.infonode.docking.properties.RootWindowProperties properties
           
protected  net.infonode.docking.RootWindow rootWindow
           
private  StudioStatusBar statusBar
           
private  javax.swing.JLabel systemLabel
           
private  net.infonode.docking.util.ViewMap viewsById
           
 
Constructor Summary
StudioImpl(java.lang.String[] args)
           
 
Method Summary
 void addComponent(StudioComponent component)
          Register a StudioComponent.
 void addComponentMenu(StudioComponent component, nl.cwi.sen1.configapi.types.Event menuPath, javax.swing.Action action)
          Register a menu that is linked with a particular component.
 void addComponentMenu(StudioComponent component, javax.swing.JMenu menu)
          Register a menu that is linked with a particular component.
 void addJob(java.lang.String message)
           
 void addMenuEvents(aterm.ATerm menus)
           
protected  void addStudioComponentNameChangedListener(StudioComponent component)
           
protected  void addStudioComponentTooltipChangedListener(StudioComponent component)
           
 void connect(java.lang.String toolName, toolbus.AbstractTool tool)
          Connect to the ToolBus.
private  javax.swing.JMenu createEmptyFileMenu()
           
private  void createFrame()
           
private  javax.swing.JMenuBar createMenuBar()
           
protected  net.infonode.docking.RootWindow createRootWindow()
           
private  StudioStatusBar createStatusBar()
           
private  javax.swing.JMenu createThemesMenu()
           
protected  net.infonode.docking.View createView(StudioComponent component, int id)
           
private  javax.swing.JMenu createViewsMenu()
           
private  net.infonode.docking.View deleteView(int id)
           
 aterm.ATermFactory getATermFactory()
          Get 'The' ATermFactory.
private  StudioComponent getComponent(net.infonode.docking.View view)
           
private  int getComponentId(StudioComponent component)
           
private  java.util.List<javax.swing.JMenuItem> getComponentMenus(StudioComponent component)
           
static java.awt.Frame getFrame()
           
private  java.util.List<javax.swing.JMenuItem> getMenus(StudioComponent component)
           
private  void initialize()
           
 void jobDone(java.lang.String message)
           
 void loadJar(java.lang.String pluginJar)
           
 void loadJarClasspath(java.lang.String pluginJar, java.lang.String classPath)
           
 void loadJarUrls(java.lang.String pluginJar, aterm.ATerm classPath)
           
static void main(java.lang.String[] args)
           
 void makeVisible(StudioComponent component)
          Make a specific Component visible.
private static int nextComponentID()
           
 void recAckEvent(aterm.ATerm t0)
           
 void recTerminate(aterm.ATerm t)
           
protected  int registerComponent(StudioComponent component)
           
private  void registerPlugin(StudioPlugin plugin)
           
 void removeComponent(StudioComponent component)
          Unregister a StudioComponent.
 void requestFocus(StudioComponent component)
          Make the Studio move the focus to a specific Component.
 void setStatus(java.lang.String message)
           
private  void setTheme(net.infonode.docking.theme.DockingWindowsTheme theme)
           
 void setTitle(java.lang.String title)
           
protected  void showView(net.infonode.docking.View view)
           
private  void startBridgeThread(java.lang.String[] args)
           
private  void startFrameThread()
           
private  void startPlugin(PluginLoader loader)
           
private  void updateMenuBar()
           
private  void updateStatusBar()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextUniqueComponentID

private static int nextUniqueComponentID

factory

private aterm.pure.PureFactory factory

configFactory

private nl.cwi.sen1.configapi.Factory configFactory

bridge

private GuiBridge bridge

viewsById

private net.infonode.docking.util.ViewMap viewsById

idsByComponent

private java.util.Map<StudioComponent,java.lang.Integer> idsByComponent

componentsByView

protected java.util.Map<net.infonode.docking.View,StudioComponent> componentsByView

componentMenus

private java.util.Map<StudioComponent,java.util.List<javax.swing.JMenuItem>> componentMenus

rootWindow

protected net.infonode.docking.RootWindow rootWindow

properties

private net.infonode.docking.properties.RootWindowProperties properties

frame

private static javax.swing.JFrame frame

systemLabel

private javax.swing.JLabel systemLabel

progressBar

javax.swing.JProgressBar progressBar

menuList

private nl.cwi.sen1.configapi.types.ActionDescriptionList menuList

currentTheme

private net.infonode.docking.theme.DockingWindowsTheme currentTheme

activeView

private net.infonode.docking.View activeView

statusBar

private StudioStatusBar statusBar

menuBarUpdatePending

private boolean menuBarUpdatePending

plugins

private java.util.List<StudioPlugin> plugins

jobQueue

private java.util.List<java.lang.String> jobQueue
Constructor Detail

StudioImpl

public StudioImpl(java.lang.String[] args)
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

getFrame

public static java.awt.Frame getFrame()

startBridgeThread

private void startBridgeThread(java.lang.String[] args)

startFrameThread

private void startFrameThread()

initialize

private void initialize()

nextComponentID

private static int nextComponentID()

createRootWindow

protected net.infonode.docking.RootWindow createRootWindow()

updateStatusBar

private void updateStatusBar()

updateMenuBar

private void updateMenuBar()

getATermFactory

public aterm.ATermFactory getATermFactory()
Description copied from interface: Studio
Get 'The' ATermFactory. For memory efficiency it is beneficial to share a single ATermFactory between all StudioPlugins. If ATerms are communicated between them, this is also a requirement.

Specified by:
getATermFactory in interface Studio
Returns:
A reference to The ATerm Factory.

createView

protected net.infonode.docking.View createView(StudioComponent component,
                                               int id)

registerComponent

protected int registerComponent(StudioComponent component)

addComponent

public void addComponent(StudioComponent component)
Description copied from interface: Studio
Register a StudioComponent. One StudioComponent corresponds to a single 'tab' somewhere in the GUI framework of the MetaStudio. The component will become immediately visible.

Specified by:
addComponent in interface Studio
Parameters:
component - Component to add.

removeComponent

public void removeComponent(StudioComponent component)
Description copied from interface: Studio
Unregister a StudioComponent. This is the inverse of addComponent. The component will become invisible immediately.

Specified by:
removeComponent in interface Studio
Parameters:
component - Component to remove.

getComponentId

private int getComponentId(StudioComponent component)

deleteView

private net.infonode.docking.View deleteView(int id)

createFrame

private void createFrame()

createStatusBar

private StudioStatusBar createStatusBar()

createMenuBar

private javax.swing.JMenuBar createMenuBar()

createViewsMenu

private javax.swing.JMenu createViewsMenu()

getComponentMenus

private java.util.List<javax.swing.JMenuItem> getComponentMenus(StudioComponent component)

createEmptyFileMenu

private javax.swing.JMenu createEmptyFileMenu()

showView

protected void showView(net.infonode.docking.View view)

createThemesMenu

private javax.swing.JMenu createThemesMenu()

setTheme

private void setTheme(net.infonode.docking.theme.DockingWindowsTheme theme)

setTitle

public void setTitle(java.lang.String title)
Specified by:
setTitle in interface GuiTif

recAckEvent

public void recAckEvent(aterm.ATerm t0)
Specified by:
recAckEvent in interface GuiTif

recTerminate

public void recTerminate(aterm.ATerm t)
Specified by:
recTerminate in interface GuiTif

connect

public void connect(java.lang.String toolName,
                    toolbus.AbstractTool tool)
Description copied from interface: Studio
Connect to the ToolBus. Many StudioPlugins will have their private connection to the ToolBus. This is the method to start it up. Note that a single plugin may use this method several times.

Specified by:
connect in interface Studio
Parameters:
toolName - Name of the tool as it occurs in the ToolBus script.
tool - Java implementation of a ToolBus tool.

getComponent

private StudioComponent getComponent(net.infonode.docking.View view)

startPlugin

private void startPlugin(PluginLoader loader)

registerPlugin

private void registerPlugin(StudioPlugin plugin)

loadJar

public void loadJar(java.lang.String pluginJar)
Specified by:
loadJar in interface GuiTif

loadJarUrls

public void loadJarUrls(java.lang.String pluginJar,
                        aterm.ATerm classPath)
Specified by:
loadJarUrls in interface GuiTif

loadJarClasspath

public void loadJarClasspath(java.lang.String pluginJar,
                             java.lang.String classPath)
Specified by:
loadJarClasspath in interface GuiTif

addMenuEvents

public void addMenuEvents(aterm.ATerm menus)
Specified by:
addMenuEvents in interface GuiTif

addComponentMenu

public void addComponentMenu(StudioComponent component,
                             javax.swing.JMenu menu)
Description copied from interface: Studio
Register a menu that is linked with a particular component. The studio manages menus, such that the menus for a particular component are visible if and only if that component has the focus.

Specified by:
addComponentMenu in interface Studio
Parameters:
component - Component to link a menu with.
menu - JMenu to link to a component.

addComponentMenu

public void addComponentMenu(StudioComponent component,
                             nl.cwi.sen1.configapi.types.Event menuPath,
                             javax.swing.Action action)
Description copied from interface: Studio
Register a menu that is linked with a particular component. The studio manages menus, such that the menus for a particular component are visible if and only if that component has the focus.

Specified by:
addComponentMenu in interface Studio

getMenus

private java.util.List<javax.swing.JMenuItem> getMenus(StudioComponent component)

requestFocus

public void requestFocus(StudioComponent component)
Description copied from interface: Studio
Make the Studio move the focus to a specific Component.

Specified by:
requestFocus in interface Studio
Parameters:
component - Component to move the focus to.

makeVisible

public void makeVisible(StudioComponent component)
Description copied from interface: Studio
Make a specific Component visible.

Specified by:
makeVisible in interface Studio
Parameters:
component - Component to make visible.

setStatus

public void setStatus(java.lang.String message)
Specified by:
setStatus in interface GuiTif

jobDone

public void jobDone(java.lang.String message)
Specified by:
jobDone in interface GuiTif

addJob

public void addJob(java.lang.String message)
Specified by:
addJob in interface GuiTif

addStudioComponentNameChangedListener

protected void addStudioComponentNameChangedListener(StudioComponent component)

addStudioComponentTooltipChangedListener

protected void addStudioComponentTooltipChangedListener(StudioComponent component)

The Meta-Environment API