/**
   * The main program for the MiddlemanFrame class
   *
   * @todo describe the command line arguments
   * @todo-javadoc Write javadocs for method parameter
   * @todo-javadoc Write javadocs for method parameter
   * @todo-javadoc Write javadocs for method parameter
   * @param middlegen Describe what the parameter does
   * @param title Describe what the parameter does
   */
  public JMiddlegenFrame(Middlegen middlegen, String title) {
    super(title);
    _middlegen = middlegen;
    setKuststoffLF();

    // make panel with label header and tabs in center.
    JLabel header = new JLabel("", JLabel.CENTER);
    JSettingsTabPane settingsTabs = new JSettingsTabPane(middlegen.getPlugins());
    JPanel headerTabs = new JPanel(new BorderLayout());

    headerTabs.add(header, BorderLayout.NORTH);
    // headerTabs.add(settingsTabs, BorderLayout.CENTER);
    JToolBar pluginToolBar = new JToolBar();
    pluginToolBar.add(settingsTabs);
    headerTabs.add(pluginToolBar, BorderLayout.CENTER);

    _databasePanel = new JDatabasePanel(settingsTabs, header);

    JScrollPane scroll = new JScrollPane(_databasePanel);
    _split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scroll, headerTabs);
    _split.setDividerLocation(0.5);
    getContentPane().add(_split, BorderLayout.CENTER);

    JToolBar toolBar = new JToolBar();
    toolBar.add(_generateAction);
    toolBar.addSeparator();
    toolBar.add(new JLabel("CTRL-Click relations to modify their cardinality"));
    toolBar.addSeparator();
    toolBar.add(new JLabel("SHIFT-Click relations to modify their directionality"));
    getContentPane().add(toolBar, BorderLayout.NORTH);

    ImageIcon icon = new ImageIcon(getClass().getResource("m.gif"));
    setIconImage(icon.getImage());

    // dispose Frame on closing, so VM will exit when Ant Task has finished
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    // I have a dodgy feeling that a Mac would try to exit the VM when the
    // window closes. Try to uncomment this line on a Mac.
    // System.setSecurityManager(new NoExitSecurityManager());

    addWindowListener(
        new WindowAdapter() {

          public void windowClosing(WindowEvent evt) {
            // Tell the halted Ant task to resume.
            synchronized (MiddlegenTask.getLock()) {
              // Update positions of tables
              _databasePanel.setPrefs();
              // Let the ant task to continue
              MiddlegenTask.getLock().notify();
            }
          }
        });
  }
 public void actionPerformed(ActionEvent evt) {
   try {
     setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
     try {
       _middlegen.writeSource();
     } catch (MiddlegenException e) {
       error(e);
     }
   } finally {
     setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   }
 }