1 package org.kuali.student.lum.program.client.widgets;
2
3 import org.kuali.student.r1.common.assembly.data.QueryPath;
4 import org.kuali.student.common.ui.client.configurable.mvc.binding.ModelWidgetBinding;
5 import org.kuali.student.common.ui.client.mvc.DataModel;
6 import org.kuali.student.common.ui.client.widgets.KSDatePicker;
7 import org.kuali.student.lum.program.client.ProgramUtils;
8
9 import java.util.Date;
10
11
12
13
14 class DateBinding implements ModelWidgetBinding<KSDatePicker> {
15
16 @Override
17 public void setModelValue(KSDatePicker widget, DataModel model, String path) {
18 QueryPath qPath = QueryPath.parse(path);
19 Date dateValue = widget.getValue();
20 if (dateValue != null) {
21 model.set(qPath, ProgramUtils.df.format(dateValue));
22 }
23 }
24
25 @Override
26 public void setWidgetValue(KSDatePicker widget, DataModel model, String path) {
27 String value = model.get(path);
28 if (value != null) {
29 widget.setValue(ProgramUtils.df.parse(value));
30 }
31 }
32 }