コード例 #1
0
  /**
   * Creates a concrete loader.
   *
   * @see DataBrowserModel#createDataLoader(boolean, Collection)
   */
  protected List<DataBrowserLoader> createDataLoader(boolean refresh, Collection ids) {
    if (!withThumbnails) return null;
    List<ImageDisplay> l = getNodes();
    Iterator<ImageDisplay> i = l.iterator();
    ImageSet node;
    List<DataObject> images = new ArrayList<DataObject>();
    ImageNode selected;
    WellSampleData data;
    Thumbnail thumb;
    while (i.hasNext()) {
      node = (ImageSet) i.next();
      if (node instanceof WellImageSet) {
        selected = ((WellImageSet) node).getSelectedWellSample();
        data = (WellSampleData) selected.getHierarchyObject();
        if (data.getId() < 0) {
          thumb = selected.getThumbnail();
          thumb.setValid(false);
          thumb.setFullScaleThumb(
              Factory.createDefaultImageThumbnail(wellDimension.width, wellDimension.height));
        } else images.add(data.getImage());
      }
    }

    if (images.size() == 0) return null;
    return createThumbnailsLoader(sorter.sort(images));
  }
コード例 #2
0
  /**
   * Creates a concrete loader.
   *
   * @param row The row identifying the well.
   * @param column The column identifying the well.
   * @return See above.
   */
  DataBrowserLoader createFieldsLoader(int row, int column) {
    List<ImageDisplay> l = getNodes();
    Iterator<ImageDisplay> i = l.iterator();
    ImageSet node;
    List<DataObject> images = new ArrayList<DataObject>();
    WellSampleData data;
    Thumbnail thumb;
    WellImageSet wis;
    List<WellSampleNode> nodes;
    Iterator<WellSampleNode> j;
    WellSampleNode n;
    if (selectedNodes != null) selectedNodes.clear();
    while (i.hasNext()) {
      node = (ImageSet) i.next();
      if (node instanceof WellImageSet) {
        wis = (WellImageSet) node;
        if (wis.getRow() == row && wis.getColumn() == column) {
          setSelectedWell(wis);
          nodes = wis.getWellSamples();
          j = nodes.iterator();
          while (j.hasNext()) {
            n = j.next();
            data = (WellSampleData) n.getHierarchyObject();

            if (data.getId() < 0) {
              thumb = n.getThumbnail();
              thumb.setValid(false);
              thumb.setFullScaleThumb(
                  Factory.createDefaultImageThumbnail(wellDimension.width, wellDimension.height));
            } else images.add(data.getImage());
          }
        }
      }
    }

    if (images.size() == 0) return null;
    return new ThumbnailFieldsLoader(component, ctx, images, row, column);
  }