コード例 #1
0
 @SuppressWarnings("unchecked")
 private void retainStateFromServer() {
   try {
     GuiBean guiBean = plotServer.getGuiState(plotViewName);
     if (guiBean != null && guiBean.containsKey(GuiParameters.IMAGEGRIDSTORE)) {
       ArrayList<GridImageEntry> entries =
           (ArrayList<GridImageEntry>) guiBean.get(GuiParameters.IMAGEGRIDSTORE);
       Iterator<GridImageEntry> iter = entries.iterator();
       String colourScheme = getPreferenceColourMapChoice();
       while (iter.hasNext()) {
         GridImageEntry entry = iter.next();
         SWTGridEntry gridEntry =
             new SWTGridEntry(
                 entry.getFilename(),
                 null,
                 canvas,
                 colourScheme,
                 getPreferenceAutoContrastLo(),
                 getPreferenceAutoContrastHi());
         imageGrid.addEntry(gridEntry, entry.getGridColumnPos(), entry.getGridRowPos());
       }
     }
   } catch (Exception e) {
     logger.warn("Problem with getting GUI data from plot server");
   }
 }
コード例 #2
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);
         }
       }
     }
   }
 }