Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final DateTimeFormat format = DateTimeFormat.getFormat("yyyy-M-dd");
- final DateTimeFormat monthFormat = DateTimeFormat.getFormat("MMMM");
- final FlexTable flexTable = new FlexTable();
- final DatePicker[] datePickers = new DatePicker[12];
- class MyDatePicker extends DatePicker {
- MyDatePicker() {
- super(new DefaultMonthSelector(), new DefaultCalendarView(),
- new CalendarModel() {
- @Override
- public String formatCurrentMonth() {
- return monthFormat.format(getCurrentMonth());
- }
- });
- }
- }
- for (int row = 0; row < 4; row ++) {
- for (int col = 0; col < 3; col ++) {
- final DatePicker datePicker = new MyDatePicker();
- final int monthZeroBased = (row * 3) + col;
- datePicker.setCurrentMonth(format.parse("2012-" + (monthZeroBased + 1) + "-01"));
- datePicker.addStyleName("my-cal");
- flexTable.setWidget(row, col, datePicker);
- datePickers[monthZeroBased] = datePicker;
- }
- }
- final Date start = format.parse("2012-01-17");
- final Date end = format.parse("2012-03-28");
- for (final Date date = start; date.compareTo(end) <= 0; CalendarUtil
- .addDaysToDate(date, 1)) {
- @SuppressWarnings("deprecation") /* Yes, it's deprecated */
- final int month = date.getMonth();
- datePickers[month].addStyleToDates("my-green", date);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement