diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-01-10 23:42:16 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-01-10 23:42:16 +1300 |
commit | 5100c457ad2f1faf1cffa8503c6baaf3a26c5d89 (patch) | |
tree | a848e347421c88ce3288391e250c76737fd50e05 /src/org/traccar/web/client/view/ArchiveView.java | |
parent | 137c89bc9a870c4018f4c000494c89af9ceea67a (diff) | |
download | trackermap-web-5100c457ad2f1faf1cffa8503c6baaf3a26c5d89.tar.gz trackermap-web-5100c457ad2f1faf1cffa8503c6baaf3a26c5d89.tar.bz2 trackermap-web-5100c457ad2f1faf1cffa8503c6baaf3a26c5d89.zip |
Archive panel and some map features
Diffstat (limited to 'src/org/traccar/web/client/view/ArchiveView.java')
-rw-r--r-- | src/org/traccar/web/client/view/ArchiveView.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/org/traccar/web/client/view/ArchiveView.java b/src/org/traccar/web/client/view/ArchiveView.java index f61ffccc..5d74f37c 100644 --- a/src/org/traccar/web/client/view/ArchiveView.java +++ b/src/org/traccar/web/client/view/ArchiveView.java @@ -28,8 +28,9 @@ import com.sencha.gxt.widget.core.client.form.TimeField; import com.sencha.gxt.widget.core.client.grid.ColumnConfig; import com.sencha.gxt.widget.core.client.grid.ColumnModel; import com.sencha.gxt.widget.core.client.grid.Grid; +import com.sencha.gxt.widget.core.client.selection.SelectionChangedEvent; -public class ArchiveView { +public class ArchiveView implements SelectionChangedEvent.SelectionChangedHandler<Position> { private static ArchiveViewUiBinder uiBinder = GWT.create(ArchiveViewUiBinder.class); @@ -107,6 +108,7 @@ public class ArchiveView { uiBinder.createAndBindUi(this); + grid.getSelectionModel().addSelectionChangedHandler(this); grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); // Initialize with current time @@ -117,6 +119,15 @@ public class ArchiveView { toTime.setValue(now); } + @Override + public void onSelectionChanged(SelectionChangedEvent<Position> event) { + if (event.getSelection().isEmpty()) { + archiveHandler.onSelected(null); + } else { + archiveHandler.onSelected(event.getSelection().get(0)); + } + } + @SuppressWarnings("deprecation") private static Date getCombineDate(DateField dateField, TimeField timeField) { Date result = null; @@ -147,7 +158,13 @@ public class ArchiveView { @Override public void onAnything() { - deviceCombo.setValue(deviceStore.findModel(deviceCombo.getValue())); + Device oldDevice = deviceCombo.getValue(); + if (oldDevice != null) { + Device newDevice = deviceStore.findModel(oldDevice); + if (newDevice != null) { + deviceCombo.setValue(newDevice); + } + } } }; |