Ejemplo n.º 1
0
 @Override
 public void update(Object theObserved, Object changeCode) {
   if (theObserved.equals(plotConsumer)) {
     if (changeCode instanceof DataBean) {
       plotWindow.processPlotUpdate((DataBean) changeCode);
       notifyDataObservers((DataBean) changeCode);
     } else if (changeCode instanceof GuiBean) {
       plotWindow.processGUIUpdate((GuiBean) changeCode);
     }
   } else {
     if (changeCode instanceof String && changeCode.equals(plotName)) {
       plotConsumer.addJob(new PlotJob(PlotJobType.Data));
     }
     if (changeCode instanceof GuiUpdate) {
       GuiUpdate gu = (GuiUpdate) changeCode;
       if (gu.getGuiName().contains(plotName)) {
         GuiBean bean = gu.getGuiData();
         UUID id = (UUID) bean.get(GuiParameters.PLOTID);
         if (id == null || plotId.compareTo(id) != 0) { // filter out own beans
           if (guiBean == null) guiBean = bean.copy(); // cache a local copy
           else guiBean.merge(bean); // or merge it
           PlotJob job = new PlotJob(PlotJobType.GUI);
           job.setGuiBean(bean);
           plotConsumer.addJob(job);
         }
       }
     }
   }
 }
Ejemplo n.º 2
0
  private void processUpdate(DataBean bean) {
    if (bean == null) return;
    if (bean.getGuiParameters() == null) return;
    UUID id = (UUID) bean.getGuiParameters().get(GuiParameters.PLOTID);
    if (id == null || plotID.compareTo(id) != 0) { // filter out own beans
      if (guiBean == null) guiBean = bean.getGuiParameters().copy(); // cache a local copy
      else guiBean.merge(bean.getGuiParameters()); // or merge it

      if (bean.getGuiParameters().containsKey(GuiParameters.FILEOPERATION)) return;

      if (bean.getGuiParameters().containsKey(GuiParameters.PLOTMODE)) {
        GuiPlotMode plotMode = (GuiPlotMode) bean.getGuiParameters().get(GuiParameters.PLOTMODE);
        if (plotMode.equals(GuiPlotMode.IMGEXPL)) {
          if (bean.getGuiParameters().containsKey(GuiParameters.FILENAME)) {
            if (filesToLoad == null) filesToLoad = new ArrayList<String>();
            filesToLoad.add((String) bean.getGuiParameters().get(GuiParameters.FILENAME));
            processNewFile(bean);
          } else if (bean.getGuiParameters().containsKey(GuiParameters.IMAGEGRIDSIZE)) {
            if (filesToLoad == null) filesToLoad = new ArrayList<String>();
            else filesToLoad.clear();
            btnPlay
                .getDisplay()
                .asyncExec(
                    new Runnable() {
                      @Override
                      public void run() {
                        resetPlaying(true);
                      }
                    });
            processNewGrid(bean);
          }
        }
      } else if (bean.getGuiParameters().containsKey(GuiParameters.IMAGEGRIDLIVEVIEW)) {
        String directory = (String) bean.getGuiParameters().get(GuiParameters.IMAGEGRIDLIVEVIEW);
        spawnLoadJob(directory);
        currentDir = directory;
        isLive = true;
        liveActive = true;
      }
    }
  }