Exemple #1
0
  /**
   * Called as some kind of destructor when the last layer has been removed. Delegates the call to
   * all Destroyables within this component (e.g. MapModes)
   */
  public void destroy() {
    MapView.removeLayerChangeListener(this);
    dialogsPanel.destroy();
    for (int i = 0; i < toolBarActions.getComponentCount(); ++i) {
      if (toolBarActions.getComponent(i) instanceof Destroyable) {
        ((Destroyable) toolBarActions.getComponent(i)).destroy();
      }
    }
    for (int i = 0; i < toolBarToggle.getComponentCount(); ++i) {
      if (toolBarToggle.getComponent(i) instanceof Destroyable) {
        ((Destroyable) toolBarToggle.getComponent(i)).destroy();
      }
    }

    // MapFrame gets destroyed when the last layer is removed, but the status line background
    // thread that collects the information doesn't get destroyed automatically.
    if (statusLine.thread != null) {
      try {
        statusLine.thread.interrupt();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    mapView.destroy();
  }
Exemple #2
0
  /**
   * Called as some kind of destructor when the last layer has been removed. Delegates the call to
   * all Destroyables within this component (e.g. MapModes)
   */
  @Override
  public void destroy() {
    MapView.removeLayerChangeListener(this);
    dialogsPanel.destroy();
    Main.pref.removePreferenceChangeListener(sidetoolbarPreferencesChangedListener);
    for (int i = 0; i < toolBarActions.getComponentCount(); ++i) {
      if (toolBarActions.getComponent(i) instanceof Destroyable) {
        ((Destroyable) toolBarActions.getComponent(i)).destroy();
      }
    }
    for (int i = 0; i < toolBarToggle.getComponentCount(); ++i) {
      if (toolBarToggle.getComponent(i) instanceof Destroyable) {
        ((Destroyable) toolBarToggle.getComponent(i)).destroy();
      }
    }

    statusLine.destroy();
    mapView.destroy();
  }