Esempio n. 1
0
 protected PanelElementAbstract createPanelElement(BasicDBObject DBO, int idx) {
   T t;
   try {
     t = clazz.newInstance();
     t.setIdx(idx);
     t.setDisplayer(panelDisplayer);
     t.setData(DBO);
     t.initPanel();
     PanelElementAbstract b;
     if (t instanceof ParameterPanel) {
       b = new PanelElementMono((ParameterPanel) t, this, maxNb > 1 && idx >= minNb, idx);
     } else {
       b =
           new PanelElementPlugin(
               (ParameterPanelPlugin) t, this, maxNb > 1 && idx >= minNb, enableTest);
       if (template != null && idx < template.panelElements.size())
         ((PanelElementPlugin) b)
             .setTemplate((PanelElementPlugin) template.panelElements.get(idx));
     }
     // System.out.println("panelElement null:"+(b==null)+ " idx:"+idx+ " "+DBO);
     return b;
   } catch (Exception e) {
     exceptionPrinter.print(e, "", Core.GUIMode);
   }
   return null;
 }
Esempio n. 2
0
 public BasicDBList saveAll() {
   BasicDBList list = new BasicDBList();
   for (PanelElementAbstract p : panelElements) {
     if (p instanceof PanelElementPlugin) {
       if (((PanelElementPlugin) p).getParameterPanel().getMethod() == null)
         ((PanelElementPlugin) p).setCurrentMethod();
     } else {
       ((ParameterPanel) p.getParameterPanel()).checkValidity();
     }
     list.add(p.getParameterPanel().save());
   }
   return list;
 }
Esempio n. 3
0
 public void test(PanelElementPlugin e) {
   if (clazz.equals(PreFilterPanel.class)) {
     int subStep = this.panelElements.indexOf(e);
     core.getProcessingSequenceEditor().test(0, subStep);
   } else if (clazz.equals(PostFilterPanel.class)) {
     int subStep = this.panelElements.indexOf(e);
     core.getProcessingSequenceEditor().test(2, subStep);
   } else if (clazz.equals(NucleiSegmenterPanel.class)
       || clazz.equals(ChannelSegmenterPanel.class)) {
     core.getProcessingSequenceEditor().test(1, 0);
   } else if (clazz.equals(MeasurementPanel.class)) {
     int subStep = this.panelElements.indexOf(e);
     core.getCellManager().testMeasure(subStep);
   } else if (clazz.equals(SamplerPanel.class)) {
     core.getCellManager().testSampler(((SamplerPanel) e.getParameterPanel()).getSampler());
   }
 }
Esempio n. 4
0
 protected void addElement(BasicDBObject DBO, int idx) {
   try {
     PanelElementAbstract b = createPanelElement(DBO, idx);
     if (ml != null) b.register(ml);
     panelElements.add(b);
     if (template != null) {
       if (template.panelElements.size() > idx) {
         if (b instanceof PanelElementPlugin)
           ((PanelElementPlugin) b)
               .setTemplate((PanelElementPlugin) template.panelElements.get(idx));
       }
     }
     listPanel.add(b.getPanel());
     listLayout.setRows(Math.max(panelElements.size() + 1, minNbRows));
     listPanel.revalidate();
     // scrollPane.getViewport().revalidate();
     panelDisplayer.refreshDisplay();
     setAddButtonColor();
   } catch (Exception e) {
     exceptionPrinter.print(e, "", Core.GUIMode);
   }
 }