aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web/client/controller/MapController.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/web/client/controller/MapController.java')
-rw-r--r--src/org/traccar/web/client/controller/MapController.java26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/org/traccar/web/client/controller/MapController.java b/src/org/traccar/web/client/controller/MapController.java
index 5ab5bbcf..738b2811 100644
--- a/src/org/traccar/web/client/controller/MapController.java
+++ b/src/org/traccar/web/client/controller/MapController.java
@@ -1,5 +1,8 @@
package org.traccar.web.client.controller;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.LinkedList;
import java.util.List;
import org.traccar.web.client.Application;
@@ -13,7 +16,7 @@ import com.sencha.gxt.widget.core.client.ContentPanel;
public class MapController implements ContentController {
- private static final int UPDATE_INTERVAL = 10000;
+ private static final int UPDATE_INTERVAL = 15000;
private MapView mapView;
@@ -44,7 +47,7 @@ public class MapController implements ContentController {
Application.getDataService().getLatestPositions(new AsyncCallback<List<Position>>() {
@Override
public void onSuccess(List<Position> result) {
- mapView.showPositions(result);
+ mapView.showLatestPositions(result);
updateTimer.schedule(UPDATE_INTERVAL);
}
@Override
@@ -54,8 +57,23 @@ public class MapController implements ContentController {
});
}
- public void select(Device device) {
- mapView.select(device, true);
+ public void selectDevice(Device device) {
+ mapView.selectDevice(device);
+ }
+
+ public void showArchivePositions(List<Position> positions) {
+ List<Position> sortedPositions = new LinkedList<Position>(positions);
+ Collections.sort(sortedPositions, new Comparator<Position>() {
+ @Override
+ public int compare(Position o1, Position o2) {
+ return o1.getTime().compareTo(o2.getTime());
+ }
+ });
+ mapView.showArchivePositions(sortedPositions);
+ }
+
+ public void selectArchivePosition(Position position) {
+ mapView.selectArchivePosition(position);
}
}