diff options
Diffstat (limited to 'src/org/traccar/web')
-rw-r--r-- | src/org/traccar/web/client/Application.java | 32 | ||||
-rw-r--r-- | src/org/traccar/web/client/controller/DeviceController.java | 8 |
2 files changed, 14 insertions, 26 deletions
diff --git a/src/org/traccar/web/client/Application.java b/src/org/traccar/web/client/Application.java index 046dd73..6b16ca6 100644 --- a/src/org/traccar/web/client/Application.java +++ b/src/org/traccar/web/client/Application.java @@ -1,7 +1,5 @@ package org.traccar.web.client; -import java.util.List; - import org.traccar.web.client.controller.ArchiveController; import org.traccar.web.client.controller.DeviceController; import org.traccar.web.client.controller.MapController; @@ -14,7 +12,9 @@ import org.traccar.web.shared.model.Position; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.ui.RootPanel; +import com.sencha.gxt.data.shared.event.StoreAddEvent; import com.sencha.gxt.data.shared.event.StoreHandlers; +import com.sencha.gxt.data.shared.event.StoreRemoveEvent; public class Application { @@ -51,35 +51,31 @@ public class Application { private DeviceController.DeviceHandler deviceHandler = new DeviceController.DeviceHandler() { @Override - public void onLoad(List<Device> devices) { - } - - @Override public void onSelected(Device device) { mapController.selectDevice(device); } - @Override - public void onAdd(Device device) { - mapController.update(); - } + }; - @Override - public void onUpdate(Device device) { - } + private ArchiveController.ArchiveHandler archiveHanlder = new ArchiveController.ArchiveHandler() { @Override - public void onRemove(Device device) { - mapController.update(); + public void onSelected(Position position) { + mapController.selectArchivePosition(position); } }; - private ArchiveController.ArchiveHandler archiveHanlder = new ArchiveController.ArchiveHandler() { + private StoreHandlers<Device> deviceStoreHandler = new BaseStoreHandlers<Device>() { @Override - public void onSelected(Position position) { - mapController.selectArchivePosition(position); + public void onAdd(StoreAddEvent<Device> event) { + mapController.update(); + } + + @Override + public void onRemove(StoreRemoveEvent<Device> event) { + mapController.update(); } }; diff --git a/src/org/traccar/web/client/controller/DeviceController.java b/src/org/traccar/web/client/controller/DeviceController.java index 865aaea..0bb6a8a 100644 --- a/src/org/traccar/web/client/controller/DeviceController.java +++ b/src/org/traccar/web/client/controller/DeviceController.java @@ -20,11 +20,7 @@ import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler; public class DeviceController implements ContentController, DeviceView.DeviceHandler { public interface DeviceHandler { - public void onLoad(List<Device> devices); public void onSelected(Device device); - public void onAdd(Device device); - public void onUpdate(Device device); - public void onRemove(Device device); } private DeviceHandler deviceHandler; @@ -55,7 +51,6 @@ public class DeviceController implements ContentController, DeviceView.DeviceHan @Override public void onSuccess(List<Device> result) { deviceStore.addAll(result); - deviceHandler.onLoad(result); } }); } @@ -74,7 +69,6 @@ public class DeviceController implements ContentController, DeviceView.DeviceHan @Override public void onSuccess(Device result) { deviceStore.add(result); - deviceHandler.onAdd(result); } }); } @@ -90,7 +84,6 @@ public class DeviceController implements ContentController, DeviceView.DeviceHan @Override public void onSuccess(Device result) { deviceStore.update(result); - deviceHandler.onUpdate(result); } }); } @@ -108,7 +101,6 @@ public class DeviceController implements ContentController, DeviceView.DeviceHan @Override public void onSuccess(Device result) { deviceStore.remove(device); - deviceHandler.onRemove(device); } }); } |