/**
  * Adds the experimenters who use the annotation if any.
  *
  * @param tt The {@link ToolTipGenerator} to add the information on to
  * @param annotation The annotation to handle.
  */
 private void checkAnnotators(ToolTipGenerator tt, AnnotationData annotation) {
   List<ExperimenterData> annotators = model.getAnnotators(annotation);
   if (annotators.size() == 0) return;
   Iterator<ExperimenterData> i = annotators.iterator();
   ExperimenterData annotator;
   tt.addLine("Linked by:", true);
   while (i.hasNext()) {
     annotator = i.next();
     tt.addLine(EditorUtil.formatExperimenter(annotator));
   }
   if (annotators.size() > 1) {
     String text = label.getText();
     text += " [" + annotators.size() + "]";
     label.setText(text);
   }
 }
  /**
   * Formats the passed annotation.
   *
   * @param annotation The value to format.
   * @param name The full name.
   * @return See above.
   */
  private String formatToolTip(AnnotationData annotation, String name) {
    ToolTipGenerator tt = new ToolTipGenerator();
    if (model.isMultiSelection()) {
      Map<DataObject, Boolean> m = null;
      Entry<DataObject, Boolean> e;
      Iterator<Entry<DataObject, Boolean>> j;
      String text = "";
      if (annotation instanceof TagAnnotationData) {
        m = model.getTaggedObjects(annotation);
        text += "Can remove Tag from ";
      } else if (annotation instanceof FileAnnotationData) {
        m = model.getObjectsWith(annotation);
        text += "Can remove Attachment from ";
      } else if (annotation instanceof XMLAnnotationData) {
        m = model.getObjectsWith(annotation);
        text += "Can remove XML files from ";
      } else if (annotation instanceof TermAnnotationData) {
        m = model.getObjectsWith(annotation);
        text += "Can remove Term from ";
      }
      if (m == null) return "";
      j = m.entrySet().iterator();
      Collection<Boolean> l = m.values();
      int n = 0;
      Iterator<Boolean> k = l.iterator();
      while (k.hasNext()) {
        if (k.next().booleanValue()) n++;
      }
      tt.addLineNoBr(text + "" + n + " ");
      int index = 0;
      String s;
      while (j.hasNext()) {
        e = j.next();
        if (index == 0) {
          tt.addLine(model.getObjectTypeAsString(e.getKey()) + "s", true);
          index++;
        }
        tt.addLine(
            "ID " + e.getKey().getId(),
            UIUtilities.formatPartialName(model.getObjectName(e.getKey())),
            true);
        // Indicates who annotates the object if not the user
        // currently logged in.
        s = formatAnnotators(e.getKey(), annotation);
        if (s != null) tt.addLine(s);
      }
      return tt.toString();
    }

    if (name != null) {
      tt.addLine("Name", name, true);
    }

    ExperimenterData exp = null;

    if (annotation.getId() > 0) {
      exp = model.getOwner(annotation);
      tt.addLine("ID", "" + annotation.getId(), true);
    }

    String ns = annotation.getNameSpace();
    if (!CommonsLangUtils.isEmpty(ns) && !EditorUtil.isInternalNS(ns)) {
      tt.addLine("Namespace", ns, true);
    }

    String desc = annotation.getDescription();
    if (!CommonsLangUtils.isEmpty(desc)) {
      tt.addLine("Description", desc, true);
    }

    if (exp != null) {
      tt.addLine("Owner", EditorUtil.formatExperimenter(exp), true);
    }

    Timestamp created = annotation.getCreated();
    if (created != null) {
      tt.addLine("Date", UIUtilities.formatDefaultDate(created), true);
    }

    if (data instanceof FileAnnotationData) {
      FileAnnotationData fa = (FileAnnotationData) data;
      long size = ((FileAnnotationData) annotation).getFileSize();
      tt.addLine("File ID", "" + fa.getFileID(), true);
      tt.addLine("Size", UIUtilities.formatFileSize(size) + "kb", true);
      checkAnnotators(tt, annotation);
    } else if (data instanceof TagAnnotationData
        || data instanceof XMLAnnotationData
        || data instanceof TermAnnotationData
        || data instanceof LongAnnotationData
        || data instanceof DoubleAnnotationData
        || data instanceof BooleanAnnotationData) {
      checkAnnotators(tt, annotation);
    }
    return tt.toString();
  }