private void setTitle(String configurationName) {
   if (configurationName == null || configurationName.trim().length() == 0) {
     view.setTitle(APPLICATION_NAME);
   } else {
     view.setTitle(APPLICATION_NAME + " - " + configurationName);
   }
 }
  public void saveSelectedConfiguration(IConfigurationSaver saver) {

    saver.dispose();

    ProxyPresenter presenter = view.getProxyPresenter();
    String configurationName = saver.getChosenConfigurationName();
    setTitle(configurationName);
    presenter.saveCurrentProxySettings(configurationName);
    presenter.saveCurrentDecoratorSettings(configurationName);

    Logger.getLogger(this.getClass()).info("Updated configuration '" + configurationName + "'");
  }
  public void deleteSelectedConfiguration(IConfigurationChooser chooser) {
    chooser.dispose();

    ProxyPresenter presenter = view.getProxyPresenter();
    String configurationName = chooser.getChosenConfigurationName();

    setTitle(null);
    if (configurationName == null) {

      Logger.getLogger(this.getClass()).info("No configuration selected.");

    } else {

      presenter.deleteConfiguration(configurationName);

      Logger.getLogger(this.getClass()).info("Deleted configuration '" + configurationName + "'");
    }
  }
  public void saveNewConfiguration(IConfigurationSaver saver) {
    saver.dispose();

    ProxyPresenter presenter = view.getProxyPresenter();
    String configurationName = saver.getTypedName();

    setTitle(configurationName);

    if (configurationName == null || configurationName.trim().length() == 0) {

      Logger.getLogger(this.getClass()).info("Not creating a null configuration");

    } else {
      presenter.saveCurrentProxySettings(configurationName);
      presenter.saveCurrentDecoratorSettings(configurationName);

      Logger.getLogger(this.getClass()).info("Created configuration '" + configurationName + "'");
    }
  }
  public void loadSelectedConfiguration(IConfigurationChooser chooser) {
    chooser.dispose();

    ProxyPresenter presenter = view.getProxyPresenter();
    String configurationName = chooser.getChosenConfigurationName();

    setTitle(configurationName);

    if (configurationName == null) {

      Logger.getLogger(this.getClass()).info("No configuration selected.");

    } else {
      presenter.loadProxySettings(configurationName);
      presenter.loadDecoratorSettings(configurationName);

      Logger.getLogger(this.getClass()).info("Loaded configuration '" + configurationName + "'");
    }
  }
 public void shutdown() {
   view.dispose();
 }