Beispiel #1
0
  private synchronized void display(ExtSed sed) {

    manageAssociatedManagerWindows(sed);

    try {

      SpectrumContainer container =
          (SpectrumContainer) sed.getAttachment(IrisDisplayManager.FIT_MODEL);

      // There is no Sed attachment, so build a model manager and attach it.

      if (container == null) {
        if (buildAttachment(sed)) {
          return;
        }
      }

      // VAOPD-879: spectrum name must be identical with Sed name.
      if (container != null) {
        container.getSpectrum().setName(sed.getId());
      }

      // Now display the Sed.

      idm.display(sed, sed.getId());

      // and add its frame to the workspace.

      JInternalFrame frame = idm.getInternalFrame();

      // VAOPD-863
      frame.setTitle(sed.getId());

      if (container != null) {
        JFrame modelManagerFrame = container.getModelManager().getFrame();
        if (modelManagerFrame != null) {
          modelManagerFrame.setTitle(sed.getId());
        }
      }

      if (frame != currentFrame) {
        lastLocation = null;
        disposeCurrentFrame();
        currentFrame = frame;
        currentFrame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
        if (lastLocation != null) {
          currentFrame.setLocation(lastLocation);
        }
        frame.setTitle("Iris Visualizer");
        ws.addFrame(frame);
      }

    } catch (Exception ex) {
      LogEvent.getInstance().fire(this, new LogEntry("Error: " + ex.getMessage(), sed));
      Logger.getLogger("IrisVisualizer").log(Level.SEVERE, null, ex);
    }
  }
 private void setClosingBehaviour(final LayerManagerProxy internalFrame) {
   final JInternalFrame i = (JInternalFrame) internalFrame;
   i.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
   i.addInternalFrameListener(
       new InternalFrameAdapter() {
         public void internalFrameClosing(InternalFrameEvent e) {
           if (1
               == getInternalFramesAssociatedWith((LayerManager) internalFrame.getLayerManager())
                   .size()) {
             if (confirmClose(
                 "Close Task",
                 internalFrame.getLayerManager().getLayersWithModifiedFeatureCollections())) {
               GUIUtil.dispose(i, desktopPane);
               internalFrame.getLayerManager().dispose();
             }
           } else {
             GUIUtil.dispose(i, desktopPane);
           }
         }
       });
 }