Esempio n. 1
0
  private static Glyph readChild(Element parentElem)
      throws IllegalAccessException, InstantiationException {
    int type = Integer.parseInt(parentElem.getAttribute("type"));
    Glyph parentGlyph;
    Class className = ClassContainer.getClass(type);
    if (className.equals(ImageGlyph.class)) {
      parentGlyph = new ImageGlyph(type);
    } else if (className.equals(Ex_ImageGlyph_withText.class)) {
      parentGlyph = new Ex_ImageGlyph_withText(type);
    } else {
      parentGlyph = (Glyph) className.newInstance();
    }
    parentGlyph.setType(type);
    parentGlyph.setName(parentElem.getAttribute("name"));

    NodeList elemList = parentElem.getChildNodes();
    ArrayList<Point> pointList = new ArrayList<Point>();
    for (int i = 0; i < elemList.getLength(); i++) {
      Element pointElem = (Element) elemList.item(i);
      if (pointElem.getNodeName().equals("point")) {
        double x = Double.parseDouble(pointElem.getAttribute("x"));
        double y = Double.parseDouble(pointElem.getAttribute("y"));
        Point point = new Point();
        point.setLocation(x, y);
        pointList.add(point);
      }
    }
    Point[] aPoints = new Point[pointList.size()];
    pointList.toArray(aPoints);
    parentGlyph.setCoo(aPoints);

    parentGlyph.setAngle(Double.parseDouble(parentElem.getAttribute("angle")));
    parentGlyph.setText(parentElem.getAttribute("text"));
    parentGlyph.setEditable(Boolean.parseBoolean(parentElem.getAttribute("editable")));
    Color color = new Color(Integer.parseInt(parentElem.getAttribute("color")));
    parentGlyph.setColor(color);

    for (int i = 0; i < elemList.getLength(); i++) {
      Element pointElem = (Element) elemList.item(i);
      if (pointElem.getNodeName().equals("Glyph")) {
        Element childElem = (Element) elemList.item(i);
        Glyph childGlyph = readChild(childElem);
        parentGlyph.addChild(childGlyph);
      }
    }
    parentGlyph.recalc();
    return parentGlyph;
  }
Esempio n. 2
0
 public ComplexEditListener(InputPanel inputPanel, String name, Class<E> clazz) {
   this.inputPanel = inputPanel;
   this.name = name;
   if (clazz.equals(String.class)) {
     initStringClass(clazz);
   } else {
     initObjectClass(clazz);
   }
 }
 public Class getColumnClass(int c) {
   try {
     Class cl = lookup.get(0, c).getClass();
     for (int i = 0; i < getRowCount(); i++) {
       if (!cl.equals(lookup.get(i, c).getClass())) return Object.class;
     }
     return cl;
   } catch (NullPointerException e) {
     return Object.class;
   }
 }
Esempio n. 4
0
 /**
  * Find the class for the projection
  *
  * @param proj projection
  * @return corresponding ProjectionClass (or null if not found)
  */
 private ProjectionClass findProjectionClass(Projection proj) {
   Class want = proj.getClass();
   ComboBoxModel projClassList = projClassCB.getModel();
   for (int i = 0; i < projClassList.getSize(); i++) {
     ProjectionClass pc = (ProjectionClass) projClassList.getElementAt(i);
     if (want.equals(pc.projClass)) {
       return pc;
     }
   }
   return null;
 }
 public void contentsChanged(final ListDataEvent e) {
   final ExpressionMetaData o =
       (ExpressionMetaData) editModel.getChartExpressionsModel().getSelectedItem();
   if (o != null && expressionType.equals(o.getExpressionType())) {
     putValue("selected", Boolean.TRUE); // NON-NLS
     putValue(Action.SMALL_ICON, selectedIcon);
   } else {
     putValue("selected", Boolean.FALSE); // NON-NLS
     putValue(Action.SMALL_ICON, standardIcon);
   }
 }
Esempio n. 6
0
  /**
   * @param aContainer
   * @param aComponentClass
   * @return
   */
  private static Component findComponent(
      final Container aContainer, final Class<? extends Component> aComponentClass) {
    Component result = null;

    final int cnt = aContainer.getComponentCount();
    for (int i = 0; (result == null) && (i < cnt); i++) {
      final Component comp = aContainer.getComponent(i);
      if (aComponentClass.equals(comp.getClass())) {
        result = comp;
      } else if (comp instanceof Container) {
        result = findComponent((Container) comp, aComponentClass);
      }
    }
    return result;
  }
Esempio n. 7
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());
   }
 }