diff options
Diffstat (limited to 'src/org/traccar/web/client/model')
5 files changed, 131 insertions, 0 deletions
diff --git a/src/org/traccar/web/client/model/BaseAsyncCallback.java b/src/org/traccar/web/client/model/BaseAsyncCallback.java new file mode 100644 index 00000000..2cc8741b --- /dev/null +++ b/src/org/traccar/web/client/model/BaseAsyncCallback.java @@ -0,0 +1,17 @@ +package org.traccar.web.client.model; + +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.sencha.gxt.widget.core.client.box.AlertMessageBox; + +public class BaseAsyncCallback<T> implements AsyncCallback<T> { + + @Override + public void onFailure(Throwable caught) { + new AlertMessageBox("Error", "Remote procedure call error").show(); + } + + @Override + public void onSuccess(T result) { + } + +} diff --git a/src/org/traccar/web/client/model/DataService.java b/src/org/traccar/web/client/model/DataService.java new file mode 100644 index 00000000..d8d71520 --- /dev/null +++ b/src/org/traccar/web/client/model/DataService.java @@ -0,0 +1,33 @@ +package org.traccar.web.client.model; + +import java.util.Date; +import java.util.List; + +import org.traccar.web.shared.model.Device; +import org.traccar.web.shared.model.Position; + +import com.google.gwt.user.client.rpc.RemoteService; +import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; + +@RemoteServiceRelativePath("dataService") +public interface DataService extends RemoteService { + + boolean authenticated(); + + boolean authenticate(String login, String password); + + boolean register(String login, String password); + + List<Device> getDevices(); + + Device addDevice(Device device); + + Device updateDevice(Device device); + + Device removeDevice(Device device); + + List<Position> getPositions(Device device, Date from, Date to); + + List<Position> getLatestPositions(); + +} diff --git a/src/org/traccar/web/client/model/DataServiceAsync.java b/src/org/traccar/web/client/model/DataServiceAsync.java new file mode 100644 index 00000000..357beb5d --- /dev/null +++ b/src/org/traccar/web/client/model/DataServiceAsync.java @@ -0,0 +1,31 @@ +package org.traccar.web.client.model; + +import java.util.Date; +import java.util.List; + +import org.traccar.web.shared.model.Device; +import org.traccar.web.shared.model.Position; + +import com.google.gwt.user.client.rpc.AsyncCallback; + +public interface DataServiceAsync { + + void authenticate(String login, String password, AsyncCallback<Boolean> callback); + + void authenticated(AsyncCallback<Boolean> callback); + + void register(String login, String password, AsyncCallback<Boolean> callback); + + void getDevices(AsyncCallback<List<Device>> callback); + + void addDevice(Device device, AsyncCallback<Device> callback); + + void updateDevice(Device device, AsyncCallback<Device> callback); + + void removeDevice(Device device, AsyncCallback<Device> callback); + + void getLatestPositions(AsyncCallback<List<Position>> callback); + + void getPositions(Device device, Date from, Date to, AsyncCallback<List<Position>> callback); + +} diff --git a/src/org/traccar/web/client/model/DeviceProperties.java b/src/org/traccar/web/client/model/DeviceProperties.java new file mode 100644 index 00000000..2c56ff6d --- /dev/null +++ b/src/org/traccar/web/client/model/DeviceProperties.java @@ -0,0 +1,17 @@ +package org.traccar.web.client.model; + +import org.traccar.web.shared.model.Device; + +import com.sencha.gxt.core.client.ValueProvider; +import com.sencha.gxt.data.shared.ModelKeyProvider; +import com.sencha.gxt.data.shared.PropertyAccess; + +public interface DeviceProperties extends PropertyAccess<Device> { + + ModelKeyProvider<Device> id(); + + ValueProvider<Device, String> uniqueId(); + + ValueProvider<Device, String> name(); + +} diff --git a/src/org/traccar/web/client/model/PositionProperties.java b/src/org/traccar/web/client/model/PositionProperties.java new file mode 100644 index 00000000..111614a3 --- /dev/null +++ b/src/org/traccar/web/client/model/PositionProperties.java @@ -0,0 +1,33 @@ +package org.traccar.web.client.model; + +import java.util.Date; + +import org.traccar.web.shared.model.Position; + +import com.sencha.gxt.core.client.ValueProvider; +import com.sencha.gxt.data.shared.ModelKeyProvider; +import com.sencha.gxt.data.shared.PropertyAccess; + +public interface PositionProperties extends PropertyAccess<Position> { + + ModelKeyProvider<Position> id(); + + ValueProvider<Position, Date> time(); + + ValueProvider<Position, Boolean> valid(); + + ValueProvider<Position, Double> latitude(); + + ValueProvider<Position, Double> longitude(); + + ValueProvider<Position, Double> altitude(); + + ValueProvider<Position, Double> speed(); + + ValueProvider<Position, Double> course(); + + ValueProvider<Position, Double> power(); + + ValueProvider<Position, String> address(); + +} |