/**
   * Builds a download task from for a collection of changesets.
   *
   * <p>Ignores null values and changesets with {@link Changeset#isNew()} == true.
   *
   * @param parent the parent component relative to which the {@link PleaseWaitDialog} is displayed.
   *     Must not be null.
   * @param changesets the collection of changesets. Assumes an empty collection if null.
   * @return the download task
   * @throws IllegalArgumentException thrown if parent is null
   */
  public static ChangesetHeaderDownloadTask buildTaskForChangesets(
      Component parent, Collection<Changeset> changesets) {
    CheckParameterUtil.ensureParameterNotNull(parent, "parent");
    if (changesets == null) {
      changesets = Collections.emptyList();
    }

    HashSet<Integer> ids = new HashSet<Integer>();
    for (Changeset cs : changesets) {
      if (cs == null || cs.isNew()) {
        continue;
      }
      ids.add(cs.getId());
    }
    if (parent == null) return new ChangesetHeaderDownloadTask(ids);
    else return new ChangesetHeaderDownloadTask(parent, ids);
  }
 protected String buildChangesetSummary() {
   StringBuffer msg = new StringBuffer();
   if (selectedChangeset == null || selectedChangeset.isNew()) {
     msg.append(tr("Objects are uploaded to a <strong>new changeset</strong>."));
   } else {
     String uploadComment =
         selectedChangeset.get("comment") == null ? "" : selectedChangeset.get("comment");
     msg.append(
         tr(
             "Objects are uploaded to the <strong>open changeset</strong> {0} with upload comment ''{1}''.",
             selectedChangeset.getId(), uploadComment));
   }
   msg.append(" ");
   if (closeChangesetAfterNextUpload) {
     msg.append(tr("The changeset is going to be <strong>closed</strong> after this upload"));
   } else {
     msg.append(tr("The changeset is <strong>left open</strong> after this upload"));
   }
   msg.append(" (<a href=\"urn:changeset-configuration\">" + tr("configure changeset") + "</a>)");
   return msg.toString();
 }
Exemple #3
0
 /**
  * Formats a name for a changeset
  *
  * @param changeset the changeset
  * @return the name
  */
 @Override
 public String format(Changeset changeset) {
   return tr("Changeset {0}", changeset.getId());
 }