@Override
 public void flowChanged(ArrayList<Integer> flows) {
   int f = flows.get(0);
   if (maincont == null) {
     return;
   }
   if (f == maincont.getFlow()) {
     return;
   }
   p("flow changed");
   maincont.setFlow(f);
   // this.rasterViewCreate(true, null);
   // recomputeChart();
 }
  public ProcessTopComponent() {
    initComponents();
    setName(NbBundle.getMessage(ProcessTopComponent.class, "CTL_ProcessTopComponent"));
    setToolTipText(NbBundle.getMessage(ProcessTopComponent.class, "HINT_ProcessTopComponent"));

    flowPanel = new FlowNrPanel(this);

    if (maincont == null) {
      flowPanel.setFlow(0);
    } else {
      flowPanel.setFlow(maincont.getFlow());
      typePanel.setType(maincont.getFiletype());
    }
    typePanel = new FiletypePanel(this);

    this.toolbar.add(this.flowPanel, null, 0);
    toolbar.add(this.typePanel, null, 0);
  }
  public void rasterViewCreate(boolean load, String title) {
    p("=========rasterViewCreate called: load=" + load);
    // if (load) {
    //  Exception e = new Exception("Tracing call");
    //   p(ErrorHandler.getString(e));
    //  }
    if (!getExpContext()) {
      return;
    }
    if (load) {
      if (selection != null)
        GuiUtils.showNonModalMsg(
            "Loading "
                + selection
                + " for "
                + maincont.getFiletype()
                + ", flow "
                + maincont.getFlow(),
            "Process");
    }

    String base = "?";
    if (maincont.getFiletype() == RawType.ACQ) {
      base = "" + maincont.getExp().getWellContext().getBase(maincont.getFlow());
    }
    this.flowPanel.setToolTipText(
        "<html>Base for flow "
            + maincont.getFlow()
            + ":"
            + base
            + "<br>Flow order: "
            + maincont.getExp().getFlowOrder()
            + "</html>");

    raster = new RasterView(maincont, load);

    this.panImage.removeAll();
    panImage.add(raster);
    // repaint();
    //  p("adding raster view");
    if (load) {
      this.getUserPreferences();
    }
    raster.update(load, maincont);

    // paintImmediately(0,0,1000,1000);
    panImage.repaint();
    raster.repaint();

    if (load) {
      title = "Raw data";
    }
    title += " flow " + maincont.getFlow() + "=" + base;
    chartViewCreate(title);

    invalidate();
    revalidate();
    // this.paintAll(getGraphics());
    repaint();
    if (load) {
      if (this.automatic_nn) {
        p("also doing nn - disable nn");
        this.btnNN.setEnabled(false);
        btnNN.setText("");
        btnNN.setToolTipText(
            "Automatically computing NN - check Explorer Options if you wish to change it!");
        RasterData data = computeNN(null);
        maincont.setData(data);
        rasterViewCreate(
            false,
            "After masked neighbor subtraction, span="
                + maincont.getSpan()
                + ", BG mask="
                + maincont.getBgMask());
      } else {
        this.btnNN.setEnabled(true);
        btnNN.setText("Compute NN");
        btnNN.setToolTipText(
            "Click to compute NN bg subtraction - check Explorer Options if you wish <b>automate</b> this!");
      }
    }
  }