Exemple #1
0
 public SAMPController getSAMPConnection() {
   return app.getSAMPController();
 }
Exemple #2
0
  public void init(IrisApplication app, IWorkspace workspace) {

    visualizer = this;

    sedManager = (SedlibSedManager) workspace.getSedManager();

    SpvInitialization spvinit = new SpvInitialization(new String[] {}, null);

    SpvProperties.SetProperty(Include.APP_NAME, Include.IRIS_APP_NAME);
    SpvProperties.SetProperty(Include.APP_VERSION, Include.IRIS_VERSION);
    spvinit.initialize(null, false);

    FunctionFactorySherpaHelper.initialize();

    this.app = app;
    ws = workspace;

    idm = new IrisDisplayManager(sedManager, ws, this);
    idm.setDesktopMode(true);
    idm.setConnection(app.getSAMPController());

    File rootDir =
        new File(
            app.getConfigurationDir()
                + File.separator
                + "analysis"
                + File.separator
                + "custom_models");

    try {

      customManager = new CustomModelsManager(rootDir);

      TreeRefresher treeRefresher = new TreeRefresher();
      treeRefresher.execute(null);
      FunctionFactorySherpaHelper.SetTreeRefresher(treeRefresher);

    } catch (Exception ex) {
      Logger.getLogger(IrisVisualizer.class.getName()).log(Level.SEVERE, null, ex);
      int ans =
          NarrowOptionPane.showConfirmDialog(
              ws.getRootFrame(),
              "Error initializing Custom Fit Component Manager: "
                  + ex.getMessage()
                  + "\nDo you want to reset custom models?",
              "Iris Visualizer",
              NarrowOptionPane.ERROR_MESSAGE);
      if (ans == NarrowOptionPane.OK_OPTION) {
        try {
          if (rootDir.isDirectory()) {
            deleteDirectory(rootDir);
          } else {
            rootDir.delete();
          }
          rootDir.mkdir();
          customManager = new CustomModelsManager(rootDir);

        } catch (IOException ex1) {
          Logger.getLogger(IrisVisualizer.class.getName()).log(Level.SEVERE, null, ex1);
        }
      }
    }

    SedEvent.getInstance()
        .add(
            new SedListener() {

              public void process(final ExtSed source, SedCommand payload) {

                if (payload == SedCommand.SELECTED || payload == SedCommand.CHANGED) {

                  if (source.getNumberOfSegments() > 0) {
                    display(source);
                  }

                } else if (payload == SedCommand.REMOVED) {

                  remove(source);
                }
              }
            });

    SegmentEvent.getInstance()
        .add(
            new SegmentListener() {

              public void process(Segment source, final SegmentPayload payload) {

                if (payload.getSedCommand() == SedCommand.REMOVED) {
                  return;
                }

                ExtSed sed = payload.getSed();

                // If the sed structure was modified, invalidate
                // any model associated with it.

                invalidateModel(sed);

                display(payload.getSed());
              }
            });

    MultipleSegmentEvent.getInstance()
        .add(
            new MultipleSegmentListener() {

              public void process(List<Segment> source, final SegmentPayload payload) {
                ExtSed sed = payload.getSed();

                // If the sed structure was modified, invalidate
                // any model associated with it.

                invalidateModel(sed);

                display(payload.getSed());
              }
            });
  }