コード例 #1
0
ファイル: MapFrame.java プロジェクト: sbrunner/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)
   */
  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
ファイル: ValidatorLayer.java プロジェクト: kuny/josm
 /** 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();
  }