示例#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();
  }
示例#2
0
 /** If layer is the OSM Data layer, remove all errors */
 @Override
 public void layerRemoved(Layer oldLayer) {
   if (oldLayer instanceof OsmDataLayer
       && Main.isDisplayingMapView()
       && !Main.main.hasEditLayer()) {
     Main.main.removeLayer(this);
   } else if (oldLayer == this) {
     MapView.removeLayerChangeListener(this);
     OsmValidator.errorLayer = null;
   }
 }
示例#3
0
文件: MapFrame.java 项目: rheinz/josm
  /**
   * 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();
  }