From 3defcd30d7ef7c10c82561b955c9e4e4fba789bf Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 11 Jan 2013 19:35:20 +1300 Subject: Remove unnecessary device handlers --- src/org/traccar/web/client/Application.java | 32 ++++++++++------------ .../web/client/controller/DeviceController.java | 8 ------ 2 files changed, 14 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/org/traccar/web/client/Application.java b/src/org/traccar/web/client/Application.java index 046dd734..6b16ca6f 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 { @@ -50,36 +50,32 @@ public class Application { private DeviceController.DeviceHandler deviceHandler = new DeviceController.DeviceHandler() { - @Override - public void onLoad(List 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 deviceStoreHandler = new BaseStoreHandlers() { @Override - public void onSelected(Position position) { - mapController.selectArchivePosition(position); + public void onAdd(StoreAddEvent event) { + mapController.update(); + } + + @Override + public void onRemove(StoreRemoveEvent event) { + mapController.update(); } }; diff --git a/src/org/traccar/web/client/controller/DeviceController.java b/src/org/traccar/web/client/controller/DeviceController.java index 865aaeae..0bb6a8a6 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 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 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); } }); } -- cgit v1.2.3