Пример #1
0
  public void showDate(Date dateToShow) {
    this.date = dateToShow;
    updateBeginAndEnd();

    lists.clear();
    selectionManager.clear();

    FlexTable table = new FlexTable();
    table.setWidth("100%");
    table.setCellPadding(2);
    table.getColumnFormatter().setWidth(0, "25px");
    table.getColumnFormatter().setWidth(1, "40px");
    table.getColumnFormatter().setWidth(2, "30px");
    table.getColumnFormatter().setWidth(3, "40px");

    // table.setBorderWidth(1);
    int row = 0;
    Date d = begin;
    int month = 0;
    int week = 0;
    while (d.compareTo(end) <= 0) {
      int w = d.getWeek();
      if (w != week) {
        week = w;
        Widget weekWidget = Gwt.createDiv("DayListWidget-week", String.valueOf(week));
        table.setWidget(row, 0, weekWidget);
      }
      int m = d.getMonth();
      if (m != month) {
        month = m;
        Widget monthWidget = Gwt.createDiv("DayListWidget-month", Gwt.getMonthShort(month));
        table.setWidget(row, 1, monthWidget);
      }
      table.setWidget(row, 2, Gwt.createDiv("DayListWidget-date", Gwt.formatDay(d.toJavaDate())));
      table.setWidget(
          row, 3, Gwt.createDiv("DayListWidget-date", Gwt.formatWeekdayShort(d.toJavaDate())));
      table.setWidget(row, 4, createDayContent(d));

      formatRow(table, row);
      d = d.nextDay();
      row++;
    }

    Widget downloadLink =
        ScrumGwt.createPdfLink(
            "Download as PDF", "calendar", "from", begin.toString(), "to", end.toString());
    wrapper.setWidget(Gwt.createFlowPanel(table, Gwt.createSpacer(1, 10), downloadLink));
  }
Пример #2
0
  @Override
  protected Widget onInitialization() {
    calendar = Scope.get().getComponent(Calendar.class);

    selectionManager = new BlockListSelectionManager();
    lists = new HashMap<Date, BlockListWidget<SimpleEvent>>();

    wrapper = new SimplePanel();
    showDate(Date.today());
    return wrapper;
  }
Пример #3
0
 private void updateBeginAndEnd() {
   begin = date;
   end = begin.addDays(visibleDays);
 }
Пример #4
0
 public DayListWidget() {
   date = Date.today();
   updateBeginAndEnd();
 }