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