code: public void setEndType(final String value) {
  
          final EndType endType = EndType.valueOf(value);
          if (!endType.equals(m_model.getEndType())) {
              removeExceptionsOnChange(new Command() {
  
                  public void execute() {
  
                      switch (endType) {
                          case SINGLE:
                              m_model.setOccurrences(0);
                              m_model.setSeriesEndDate(null);
                              break;
                          case TIMES:
                              m_model.setOccurrences(10);
                              m_model.setSeriesEndDate(null);
                              break;
                          case DATE:
                              m_model.setOccurrences(0);
                              m_model.setSeriesEndDate(m_model.getStart() == null ? new Date() : m_model.getStart());
                              break;
                          default:
                              break;
                      }
                      m_model.setEndType(endType);
                      valueChanged();
                  }
              });
          }
  
      }
docs: Set the duration option.
  @param value the duration option to set ({@link EndType} as string).