public void configure(boolean local) {

    Bean<Configuration> conf = getConfiguration();
    if (conf != null) {
      localConfigurationUI.setBean(conf);
      localConfigurationUI.setEnabled(true);
    } else {
      localConfigurationUI.setEnabled(false);
    }

    configurationPane.setSelectedIndex(local ? 2 : 0);

    UIUtilities.centerWindow(preferencesDialog, this);
    preferencesDialog.setVisible(true);
  }
  public UserInterfaceImpl() {
    super();
    LookAndFeelManager.instance()
        .setFont(ConfigurationManager.getGlobalConfiguration().getGuiFont());
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    enableComponents = new EnableComponents();

    preferencesDialog = new ConfigurationDialog(this);
    preferencesDialog.setTitle("Preferences");
    preferencesDialog.getContentPane().setLayout(new BorderLayout());
    preferencesDialog.setModal(true);
    preferencesDialog.setSize(new Dimension(675, 475));
    LookAndFeelManager.instance().register(preferencesDialog);

    configurationPane = new JTabbedPane();
    preferencesDialog.getContentPane().add(configurationPane, BorderLayout.CENTER);
    globalConfigurationUI =
        new ConfigurationUI<GlobalConfiguration>(
            preferencesDialog,
            ConfigurationManager.getGlobalConfigurationBean(),
            ConfigurationManager.GLOBAL_DEFAULT,
            null,
            "Restore defaults|Changes the current global preferences so that they are equal to the default preferences",
            "<html>In this tab you can change global preferences. On exit, they are stored in the"
                + " file <tt>"
                + Constants.GLOBAL_CONF_FILE.getAbsolutePath()
                + "</tt>.");
    globalConfigurationUI.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15));
    preferencesDialog.addConfigurationUI(globalConfigurationUI);

    ConfigurationUI<Configuration> defaultCUI =
        new ConfigurationUI<Configuration>(
            preferencesDialog,
            ConfigurationManager.getDefaultConfigurationBean(),
            ConfigurationManager.LOCAL_DEFAULT,
            null,
            "Restore defaults|Changes the initial preferences (to be used for newly created diagrams) such that they are equal to the default settings",
            "<html>This tab is for adjusting the (initial) preferences that are used for"
                + " newly created diagrams. They are stored along with the global preferences.");
    defaultCUI.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15));
    preferencesDialog.addConfigurationUI(defaultCUI);

    localConfigurationUI =
        new ConfigurationUI<Configuration>(
            preferencesDialog,
            ConfigurationManager.createNewDefaultConfiguration(),
            ConfigurationManager.getDefaultConfigurationBean(),
            "Save as initial|Saves the current diagram's preferences as the initial preferences (to be used for all newly created diagrams)",
            "Restore initial|Changes the current diagram's preferences such that they are equal to the initial preferences",
            "<html>This tab is for changing the preferences for the diagram"
                + " currently being displayed.<br>They will be stored "
                + " when the diagram is saved as an <tt>.sdx</tt>-file.");
    localConfigurationUI.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15));

    for (JPanel panel : localConfigurationUI.getCategoryPanels()) {
      LookAndFeelManager.instance().registerOrphan(panel);
    }

    preferencesDialog.addConfigurationUI(localConfigurationUI);

    configurationPane.add("Global preferences", globalConfigurationUI);
    configurationPane.add("Initial diagram preferences", defaultCUI);
    configurationPane.addTab("Current diagram preferences", localConfigurationUI);

    for (JPanel panel : globalConfigurationUI.getCategoryPanels()) {
      LookAndFeelManager.instance().registerOrphan(panel);
    }
    for (JPanel panel : defaultCUI.getCategoryPanels()) {
      LookAndFeelManager.instance().registerOrphan(panel);
    }

    listeners = new LinkedList<UserInterfaceListener>();
    redrawThread = new RedrawThread(this);
    redrawThread.start();
    menuBar = new MenuBar();
    toolbar = new JToolBar();
    toolbar.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    toolbar.setFloatable(false);
  }