Пример #1
0
  protected String getBody() {
    StringBuffer ret = new StringBuffer();

    String milestoneId = getParameters().getString("id");
    if (milestoneId != null && milestoneId.length() > 0) {
      Milestone milestone = MilestonesApplication.getMilestone(milestoneId, getProject());

      if (milestone != null) {
        exportMilestone(milestone, ret);

        return ret.toString();
      }
      // here we could throw some error I guess...
    }

    MilestoneFilterPanel filter = new MilestoneFilterPanel("dummy", HeadsUpSession.ANONYMOUS_USER);
    filter.setFilters(MilestonesApplication.QUERY_DUE_ALL, true, true);
    SortableEntityProvider<Milestone> provider =
        MilestonesApplication.getMilestoneProviderForProject(getProject(), filter);

    // fall back to listing all milestones
    Iterator<Milestone> milestones = provider.iterator(0, provider.size());
    while (milestones.hasNext()) {
      exportMilestone(milestones.next(), ret);
    }

    return ret.toString();
  }
Пример #2
0
  public void layout() {
    super.layout();
    add(CSSPackageResource.getHeaderContribution(getClass(), "milestone.css"));

    name = getPageParameters().getString("id");

    Milestone milestone = MilestonesApplication.getMilestone(name, getProject());
    if (milestone == null) {
      notFoundError();
      return;
    }

    addLink(new BookmarkableMenuLink(getPageClass("milestones/view"), getPageParameters(), "view"));

    final Milestone finalMilestone = milestone;
    add(
        new EditMilestoneForm("edit", finalMilestone, false, this) {
          public void submitParent() {
            getHeadsUpApplication()
                .addEvent(
                    new UpdateMilestoneEvent(
                        finalMilestone,
                        finalMilestone.getProject(),
                        EditMilestone.this.getSession().getUser()));
          }
        });
  }