1 package net
.bzzt
.ical
.aggregator
.web
;
3 import java
.util
.Calendar
;
6 import org
.apache
.wicket
.ajax
.AjaxRequestTarget
;
7 import org
.apache
.wicket
.markup
.html
.basic
.Label
;
8 import org
.apache
.wicket
.markup
.html
.link
.Link
;
9 import org
.apache
.wicket
.model
.Model
;
11 import sun
.util
.calendar
.CalendarUtils
;
13 public class WeekView
extends AggregatorLayoutPage
22 public WeekView(Date dateToShow
)
24 this.date
= dateToShow
;
26 Calendar calendar
= Calendar
.getInstance();
27 calendar
.setTime(date
);
29 add(new Link
<Void
>("previous")
35 private static final long serialVersionUID
= 1L;
40 Calendar calendar
= Calendar
.getInstance();
41 calendar
.setTime(date
);
42 calendar
.add(Calendar
.WEEK_OF_YEAR
, -1);
43 setResponsePage(new WeekView(calendar
.getTime()));
47 add(new Label("week", new Model
<Integer
>(calendar
.get(Calendar
.WEEK_OF_YEAR
))));
48 add(new Link
<Void
>("next")
54 private static final long serialVersionUID
= 1L;
59 Calendar calendar
= Calendar
.getInstance();
60 calendar
.setTime(date
);
61 calendar
.add(Calendar
.WEEK_OF_YEAR
, 1);
62 setResponsePage(new WeekView(calendar
.getTime()));
67 // sunday=1, saturday=7
68 int selected_day
= calendar
.get(Calendar
.DAY_OF_WEEK
);
70 // after this, monday=0, sunday=6
71 selected_day
= (selected_day
+ 5) % 7;
73 calendar
.add(Calendar
.DAY_OF_MONTH
, -selected_day
);
74 add(new DayPanel("monday", calendar
.getTime()));
76 calendar
.add(Calendar
.DAY_OF_MONTH
, 1);
77 add(new DayPanel("tuesday", calendar
.getTime()));
79 calendar
.add(Calendar
.DAY_OF_MONTH
, 1);
80 add(new DayPanel("wednesday", calendar
.getTime()));
82 calendar
.add(Calendar
.DAY_OF_MONTH
, 1);
83 add(new DayPanel("thursday", calendar
.getTime()));
85 calendar
.add(Calendar
.DAY_OF_MONTH
, 1);
86 add(new DayPanel("friday", calendar
.getTime()));
88 calendar
.add(Calendar
.DAY_OF_MONTH
, 1);
89 add(new DayPanel("saturday", calendar
.getTime()));
91 calendar
.add(Calendar
.DAY_OF_MONTH
, 1);
92 add(new DayPanel("sunday", calendar
.getTime()));
96 * @see net.bzzt.ical.aggregator.web.AggregatorLayoutPage#refresh(org.apache.wicket.ajax.AjaxRequestTarget)
99 public void refresh(AjaxRequestTarget target
)
101 setResponsePage(new WeekView(date
));