/**
  * Loads the thumbnails for the passed collection of files.
  *
  * @param files The collection of files to handle.
  */
 private void loadFSThumbnails(List files) {
   List result = new ArrayList();
   try {
     ExperimenterData exp = (ExperimenterData) context.lookup(LookupNames.CURRENT_USER_DETAILS);
     long id = exp.getId();
     Map<DataObject, BufferedImage> m = service.getFSThumbnailSet(ctx, files, maxLength, id);
     Entry<DataObject, BufferedImage> entry;
     Iterator<Entry<DataObject, BufferedImage>> i = m.entrySet().iterator();
     BufferedImage thumb;
     DataObject obj;
     boolean valid = true;
     FileData f;
     while (i.hasNext()) {
       entry = i.next();
       obj = entry.getKey();
       thumb = entry.getValue();
       if (thumb == null) {
         thumb = Factory.createDefaultImageThumbnail(Factory.IMAGE_ICON);
       }
       if (obj.getId() > 0) result.add(new ThumbnailData(obj.getId(), thumb, valid));
       else result.add(new ThumbnailData(obj, thumb, valid));
     }
     currentThumbs = result;
   } catch (Exception e) {
     currentThumbs = result;
     context.getLogger().error(this, "Cannot retrieve thumbnail: " + e.getMessage());
   }
 }
Esempio n. 2
0
 /**
  * Returns the list of users who annotated that image only if the annotation cannot be unlinked.
  *
  * @param object The object the annotation is linked to.
  * @param annotation The annotation to handle.
  */
 private String formatAnnotators(DataObject object, AnnotationData annotation) {
   StringBuffer buffer = new StringBuffer();
   List<ExperimenterData> annotators = model.getAnnotators(object, annotation);
   if (annotators.size() == 0) return null;
   long userID = model.getCurrentUser().getId();
   Iterator<ExperimenterData> i = annotators.iterator();
   ExperimenterData annotator;
   int n = annotators.size() - 1;
   int index = 0;
   buffer.append(" (");
   while (i.hasNext()) {
     annotator = i.next();
     if (annotator.getId() != userID) {
       buffer.append(EditorUtil.formatExperimenter(annotator));
       if (index != n) buffer.append(", ");
       index++;
     }
   }
   if (index == 0) return null;
   buffer.append(")");
   return buffer.toString();
 }
 /**
  * Returns the id of the experimenter.
  *
  * @return See above.
  */
 public long getExperimenter() {
   if (experimenter == null) return -1;
   return experimenter.getId();
 }