我正在尝试找到最好的组件来显示一年中的日期范围。一个想法是将月份显示为盒子(12个盒子),并用不同的颜色绘制季节。
GWT Datepicker并不能真正满足我的需求,因为它的可扩展性不够(http://code.google.com/p/google-web-toolkit/issues/detail?id=3848)。日历组件太复杂了。GXT datepicker也缺乏可扩展性。
这是我想要实现的一个示例:

有什么想法吗?我使用GXT作为库。
发布于 2012-05-23 03:04:21
在我看来,使用DatePicker并不是一个坏主意。这里有一个小例子,涵盖了一个月。我认为通过在网格中安排12个这样的网格来将其扩展到一整年并不会太难:
Java
final DateTimeFormat format = DateTimeFormat.getFormat("yyyy-MM-dd");
final DatePicker datePicker = new DatePicker();
datePicker.setCurrentMonth(format.parse("2012-01-01"));
datePicker.addStyleName("my-cal");
final Date start = format.parse("2012-01-17");
final Date end = format.parse("2012-01-28");
for (final Date date = start; date.compareTo(end) <= 0; CalendarUtil
.addDaysToDate(date, 1)) {
datePicker.addStyleToDates("my-green", date);
}CSS
.my-green { background-color: green !important; }
.my-cal .datePickerPreviousButton { visibility: hidden; }
.my-cal .datePickerNextButton { visibility: hidden; }使用"clean“主题,它看起来像这样:

附注:完整的日历可能是这样的:

完整代码:
http://pastebin.com/xkrRQQht
https://stackoverflow.com/questions/10707650
复制相似问题