Skip to content

Commit

Permalink
Fix date field.
Browse files Browse the repository at this point in the history
  • Loading branch information
peransin-obeo committed Mar 30, 2023
1 parent 9a0817e commit 2d5d936
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.activitymgr.ui.web.view.impl.internal;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

import org.activitymgr.ui.web.logic.IContributionsTabLogic;
Expand Down Expand Up @@ -148,9 +149,8 @@ public void registerLogic(final IContributionsTabLogic logic) {

private void registerBoundButton(Button button, String caption, Runnable task,
int keyCode, int... modifierKeys) {
if (button != null) {
button.addClickListener(evt -> task.run());
}

button.addClickListener(evt -> task.run());
addShortcutListener(new ShortcutListener(caption, keyCode, modifierKeys) {
@Override
public void handleAction(Object sender, Object target) {
Expand Down Expand Up @@ -195,6 +195,14 @@ private void registerListeners() {
() -> getLogic().onNextWeek(),
KeyCode.ARROW_LEFT,
ModifierKey.CTRL);

dateField.addValueChangeListener(evt -> {
Calendar cal = new GregorianCalendar();
cal.setTime(dateField.getValue() != null
? dateField.getValue()
: new Date());
getLogic().onDateChange(cal);
});
}

@Override
Expand Down

0 comments on commit 2d5d936

Please sign in to comment.