File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
src/main/java/com/flowingcode/addons/ycalendar Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -50,9 +50,7 @@ public MonthCalendar(int year, Month month) {
50
50
51
51
/** Creates a new instance of {@code MonthCalendar} for the given year-and-month. */
52
52
public MonthCalendar (YearMonth yearMonth ) {
53
- this .yearMonth = Objects .requireNonNull (yearMonth );
54
- String script = "this.month=new Date($0,$1-1,1);" ;
55
- getElement ().executeJs (script , yearMonth .getYear (), yearMonth .getMonthValue ());
53
+ setYearMonth (yearMonth );
56
54
}
57
55
58
56
public void setReadOnly (boolean readOnly ) {
@@ -69,6 +67,15 @@ public Month getMonth() {
69
67
return yearMonth .getMonth ();
70
68
}
71
69
70
+ /** Sets the year-and-month that is displayed in this calendar. */
71
+ public void setYearMonth (YearMonth yearMonth ) {
72
+ this .yearMonth = Objects .requireNonNull (yearMonth );
73
+ this .yearMonth = Objects .requireNonNull (yearMonth );
74
+ String script = "this.month=new Date($0,$1-1,1);" ;
75
+ getElement ().executeJs (script , yearMonth .getYear (), yearMonth .getMonthValue ());
76
+ refreshAll ();
77
+ }
78
+
72
79
/**
73
80
* Sets the function that is used for generating CSS class names for rows in this calendar.
74
81
* Returning {@code null} from the generator results in no custom class name being set. Multiple
You can’t perform that action at this time.
0 commit comments