James Moger
2012-10-30 2a63f699e7e5998e2a037e8f62304bd2be288ea5
src/com/gitblit/wicket/pages/EditRepositoryPage.java
@@ -115,6 +115,11 @@
      setStatelessHint(false);
      setOutputMarkupId(true);
   }
   @Override
   protected boolean requiresPageMap() {
      return true;
   }
   protected void setupPage(RepositoryModel model) {
      this.repositoryModel = model;
@@ -389,9 +394,10 @@
      }
      form.add(new DropDownChoice<String>("HEAD", availableRefs).setEnabled(availableRefs.size() > 0));
      List<String> gcPeriods = Arrays.asList("1 day", "2 days", "3 days", "4 days", "5 days", "7 days", "10 days", "14 days");
      form.add(new DropDownChoice<String>("gcPeriod", gcPeriods));
      form.add(new TextField<String>("gcThreshold"));
      boolean gcEnabled = GitBlit.getBoolean(Keys.git.enableGarbageCollection, false);
      List<Integer> gcPeriods = Arrays.asList(1, 2, 3, 4, 5, 7, 10, 14 );
      form.add(new DropDownChoice<Integer>("gcPeriod", gcPeriods, new GCPeriodRenderer()).setEnabled(gcEnabled));
      form.add(new TextField<String>("gcThreshold").setEnabled(gcEnabled));
      // federation strategies - remove ORIGIN choice if this repository has
      // no origin.
@@ -619,4 +625,27 @@
         return Integer.toString(index);
      }
   }
   private class GCPeriodRenderer implements IChoiceRenderer<Integer> {
      private static final long serialVersionUID = 1L;
      public GCPeriodRenderer() {
      }
      @Override
      public String getDisplayValue(Integer value) {
         if (value == 1) {
            return getString("gb.duration.oneDay");
         } else {
            return MessageFormat.format(getString("gb.duration.days"), value);
         }
      }
      @Override
      public String getIdValue(Integer value, int index) {
         return Integer.toString(index);
      }
   }
}