예제 #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);
    }
  }
예제 #2
0
  public void invalidateModel(ExtSed sed) {
    if (sed != null) {
      SpectrumContainer container =
          (SpectrumContainer) sed.getAttachment(IrisDisplayManager.FIT_MODEL);
      if (container != null) {

        ModelManager2 mm = container.getModelManager();
        if (mm != null && mm.isActive()) {
          mm.dispose();
        }

        sed.removeAttachment(IrisDisplayManager.FIT_MODEL);
      }
    }
  }
예제 #3
0
  private void manageAssociatedManagerWindows(ExtSed sed) {

    ExtSed displaying = idm.getDisplaying();

    if (displaying != null) {
      if (!sed.getId().equals(displaying.getId())) {

        // displayed Sed is exiting: make its model manager and metadata windows invisible.

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

        if (container != null) {

          ModelManager2 modelManager = container.getModelManager();
          modelManager.setVisible(false);
          SpectrumVisualEditor editor = idm.getVisualEditor();

          if (editor != null) {
            editor.getJFrame().setVisible(false);
          }
        }

        // new Sed is entering display: make its model manager window visible if active.

        if (sed != null) {

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

          if (container != null) {
            ModelManager2 modelManager = container.getModelManager();
            modelManager.setVisible(modelManager.isActive());
          }
        }
      }
    }
  }