diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-01-09 23:34:39 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-01-09 23:34:39 +1300 |
commit | 137c89bc9a870c4018f4c000494c89af9ceea67a (patch) | |
tree | ecee16a30a9c2742a97f715427b3b77ab66541aa /src/org/traccar/web/client/controller/DeviceController.java | |
parent | 803ddb7af2d2ad33a5beeded3bc53963b16454d0 (diff) | |
download | trackermap-web-137c89bc9a870c4018f4c000494c89af9ceea67a.tar.gz trackermap-web-137c89bc9a870c4018f4c000494c89af9ceea67a.tar.bz2 trackermap-web-137c89bc9a870c4018f4c000494c89af9ceea67a.zip |
Finished archive panel
Diffstat (limited to 'src/org/traccar/web/client/controller/DeviceController.java')
-rw-r--r-- | src/org/traccar/web/client/controller/DeviceController.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/org/traccar/web/client/controller/DeviceController.java b/src/org/traccar/web/client/controller/DeviceController.java index b24c205e..865aaeae 100644 --- a/src/org/traccar/web/client/controller/DeviceController.java +++ b/src/org/traccar/web/client/controller/DeviceController.java @@ -4,10 +4,13 @@ import java.util.List; import org.traccar.web.client.Application; import org.traccar.web.client.model.BaseAsyncCallback; +import org.traccar.web.client.model.DeviceProperties; import org.traccar.web.client.view.DeviceDialog; import org.traccar.web.client.view.DeviceView; import org.traccar.web.shared.model.Device; +import com.google.gwt.core.client.GWT; +import com.sencha.gxt.data.shared.ListStore; import com.sencha.gxt.widget.core.client.ContentPanel; import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton; import com.sencha.gxt.widget.core.client.box.ConfirmMessageBox; @@ -26,11 +29,19 @@ public class DeviceController implements ContentController, DeviceView.DeviceHan private DeviceHandler deviceHandler; + private ListStore<Device> deviceStore; + private DeviceView deviceView; public DeviceController(DeviceHandler deviceHandler) { this.deviceHandler = deviceHandler; - deviceView = new DeviceView(this); + DeviceProperties deviceProperties = GWT.create(DeviceProperties.class); + deviceStore = new ListStore<Device>(deviceProperties.id()); + deviceView = new DeviceView(this, deviceStore); + } + + public ListStore<Device> getDeviceStore() { + return deviceStore; } @Override @@ -43,7 +54,7 @@ public class DeviceController implements ContentController, DeviceView.DeviceHan Application.getDataService().getDevices(new BaseAsyncCallback<List<Device>>() { @Override public void onSuccess(List<Device> result) { - deviceView.load(result); + deviceStore.addAll(result); deviceHandler.onLoad(result); } }); @@ -62,7 +73,7 @@ public class DeviceController implements ContentController, DeviceView.DeviceHan Application.getDataService().addDevice(device, new BaseAsyncCallback<Device>() { @Override public void onSuccess(Device result) { - deviceView.add(result); + deviceStore.add(result); deviceHandler.onAdd(result); } }); @@ -78,7 +89,7 @@ public class DeviceController implements ContentController, DeviceView.DeviceHan Application.getDataService().updateDevice(device, new BaseAsyncCallback<Device>() { @Override public void onSuccess(Device result) { - deviceView.update(result); + deviceStore.update(result); deviceHandler.onUpdate(result); } }); @@ -96,7 +107,7 @@ public class DeviceController implements ContentController, DeviceView.DeviceHan Application.getDataService().removeDevice(device, new BaseAsyncCallback<Device>() { @Override public void onSuccess(Device result) { - deviceView.remove(device); + deviceStore.remove(device); deviceHandler.onRemove(device); } }); |