/**
   * Views the selected field.
   *
   * @param index The index of the field to view.
   */
  void viewField(int index) {
    if (index < 0 || index >= fieldsNumber) return;
    selectedField = index;
    Set<ImageDisplay> samples = new HashSet<ImageDisplay>();
    List<ImageDisplay> l = getNodes();
    Iterator<ImageDisplay> i = l.iterator();
    WellImageSet well;
    int row = -1;
    int col = -1;
    Collection<ImageDisplay> c = browser.getSelectedDisplays();
    Map<Integer, Integer> location = new HashMap<Integer, Integer>();
    WellSampleNode selected;
    if (c != null && c.size() > 0) {
      Iterator<ImageDisplay> j = c.iterator();
      Object object;
      while (j.hasNext()) {
        object = j.next();
        if (object instanceof WellSampleNode) {
          selected = (WellSampleNode) object;
          location.put(selected.getRow(), selected.getColumn());
        }
      }
    }
    List<ImageDisplay> nodes = new ArrayList<ImageDisplay>();
    while (i.hasNext()) {
      well = (WellImageSet) i.next();
      well.setSelectedWellSample(index);
      selected = (WellSampleNode) well.getSelectedWellSample();
      row = selected.getRow();
      if (location.containsKey(row)) {
        col = location.get(row);
        if (selected.getColumn() == col) nodes.add(selected);
      }
      samples.add(selected);
    }
    samples.addAll(cells);
    browser.refresh(samples, nodes);
    layoutBrowser(LayoutFactory.PLATE_LAYOUT);
    // quietly save the field.

    PlateData plate = (PlateData) parent;
    long userID = DataBrowserAgent.getUserDetails().getId();
    if (plate.getOwner().getId() == userID) {
      plate.setDefaultSample(selectedField);
      List<DataObject> list = new ArrayList<DataObject>();
      list.add(plate);
      DataBrowserLoader loader = new PlateSaver(component, ctx, list);
      loader.load();
    }
  }
  /**
   * 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);
  }