diff options
Diffstat (limited to 'src/org/traccar/web/client/model')
13 files changed, 0 insertions, 537 deletions
diff --git a/src/org/traccar/web/client/model/ApplicationSettingsProperties.java b/src/org/traccar/web/client/model/ApplicationSettingsProperties.java deleted file mode 100644 index b30572e5..00000000 --- a/src/org/traccar/web/client/model/ApplicationSettingsProperties.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.web.client.model; - -import org.traccar.web.shared.model.ApplicationSettings; - -import com.sencha.gxt.core.client.ValueProvider; -import com.sencha.gxt.data.shared.ModelKeyProvider; -import com.sencha.gxt.data.shared.PropertyAccess; - -public interface ApplicationSettingsProperties extends PropertyAccess<ApplicationSettings> { - - ModelKeyProvider<ApplicationSettings> id(); - - ValueProvider<ApplicationSettings, Boolean> registrationEnabled(); - -} diff --git a/src/org/traccar/web/client/model/BaseAsyncCallback.java b/src/org/traccar/web/client/model/BaseAsyncCallback.java deleted file mode 100644 index cb0c4792..00000000 --- a/src/org/traccar/web/client/model/BaseAsyncCallback.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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/BaseStoreHandlers.java b/src/org/traccar/web/client/model/BaseStoreHandlers.java deleted file mode 100644 index f34ff3a3..00000000 --- a/src/org/traccar/web/client/model/BaseStoreHandlers.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.web.client.model; - -import com.sencha.gxt.data.shared.event.StoreAddEvent; -import com.sencha.gxt.data.shared.event.StoreClearEvent; -import com.sencha.gxt.data.shared.event.StoreDataChangeEvent; -import com.sencha.gxt.data.shared.event.StoreFilterEvent; -import com.sencha.gxt.data.shared.event.StoreHandlers; -import com.sencha.gxt.data.shared.event.StoreRecordChangeEvent; -import com.sencha.gxt.data.shared.event.StoreRemoveEvent; -import com.sencha.gxt.data.shared.event.StoreSortEvent; -import com.sencha.gxt.data.shared.event.StoreUpdateEvent; - -public class BaseStoreHandlers<T> implements StoreHandlers<T> { - - @Override - public void onAdd(StoreAddEvent<T> event) { - onAnything(); - } - - @Override - public void onRemove(StoreRemoveEvent<T> event) { - onAnything(); - } - - @Override - public void onFilter(StoreFilterEvent<T> event) { - onAnything(); - } - - @Override - public void onClear(StoreClearEvent<T> event) { - onAnything(); - } - - @Override - public void onUpdate(StoreUpdateEvent<T> event) { - onAnything(); - } - - @Override - public void onDataChange(StoreDataChangeEvent<T> event) { - onAnything(); - } - - @Override - public void onRecordChange(StoreRecordChangeEvent<T> event) { - onAnything(); - } - - @Override - public void onSort(StoreSortEvent<T> event) { - onAnything(); - } - - public void onAnything() { - } - -} diff --git a/src/org/traccar/web/client/model/DataService.java b/src/org/traccar/web/client/model/DataService.java deleted file mode 100644 index a693b6e6..00000000 --- a/src/org/traccar/web/client/model/DataService.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.web.client.model; - -import java.util.Date; -import java.util.List; - -import org.traccar.web.shared.model.ApplicationSettings; -import org.traccar.web.shared.model.Device; -import org.traccar.web.shared.model.Position; -import org.traccar.web.shared.model.User; - -import com.google.gwt.user.client.rpc.RemoteService; -import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; - -@RemoteServiceRelativePath("dataService") -public interface DataService extends RemoteService { - - User authenticated() throws IllegalStateException; - - User login(String login, String password); - - boolean logout(); - - User register(String login, String password); - - List<User> getUsers(); - - User addUser(User user); - - User updateUser(User user); - - User removeUser(User user); - - 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(); - - ApplicationSettings updateApplicationSettings(ApplicationSettings applicationSettings); - -} diff --git a/src/org/traccar/web/client/model/DataServiceAsync.java b/src/org/traccar/web/client/model/DataServiceAsync.java deleted file mode 100644 index b1830639..00000000 --- a/src/org/traccar/web/client/model/DataServiceAsync.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.web.client.model; - -import java.util.Date; -import java.util.List; - -import org.traccar.web.shared.model.ApplicationSettings; -import org.traccar.web.shared.model.Device; -import org.traccar.web.shared.model.Position; -import org.traccar.web.shared.model.User; - -import com.google.gwt.user.client.rpc.AsyncCallback; - -public interface DataServiceAsync { - - void authenticated(AsyncCallback<User> callback); - - void login(String login, String password, AsyncCallback<User> callback); - - void logout(AsyncCallback<Boolean> callback); - - void register(String login, String password, AsyncCallback<User> callback); - - void getUsers(AsyncCallback<List<User>> callback); - - void addUser(User user, AsyncCallback<User> callback); - - void updateUser(User user, AsyncCallback<User> callback); - - void removeUser(User user, AsyncCallback<User> 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); - - void updateApplicationSettings(ApplicationSettings applicationSettings, AsyncCallback<ApplicationSettings> callback); - -} diff --git a/src/org/traccar/web/client/model/DeviceProperties.java b/src/org/traccar/web/client/model/DeviceProperties.java deleted file mode 100644 index 35f946a2..00000000 --- a/src/org/traccar/web/client/model/DeviceProperties.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.web.client.model; - -import org.traccar.web.shared.model.Device; - -import com.google.gwt.editor.client.Editor.Path; -import com.sencha.gxt.core.client.ValueProvider; -import com.sencha.gxt.data.shared.LabelProvider; -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(); - - @Path("name") - LabelProvider<Device> label(); - -} diff --git a/src/org/traccar/web/client/model/EnumKeyProvider.java b/src/org/traccar/web/client/model/EnumKeyProvider.java deleted file mode 100644 index c41d420e..00000000 --- a/src/org/traccar/web/client/model/EnumKeyProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.traccar.web.client.model; - -import com.sencha.gxt.data.shared.ModelKeyProvider; - - -public class EnumKeyProvider<T extends Enum<T>> implements ModelKeyProvider<T> { - - @Override - public String getKey(T item) { - return String.valueOf(item.ordinal()); - } - -} diff --git a/src/org/traccar/web/client/model/PositionProperties.java b/src/org/traccar/web/client/model/PositionProperties.java deleted file mode 100644 index 86ab5327..00000000 --- a/src/org/traccar/web/client/model/PositionProperties.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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(); - -} diff --git a/src/org/traccar/web/client/model/StateItem.java b/src/org/traccar/web/client/model/StateItem.java deleted file mode 100644 index 651d2a24..00000000 --- a/src/org/traccar/web/client/model/StateItem.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.traccar.web.client.model; - - -public class StateItem { - - public StateItem(String name, String value) { - this.name = name; - this.value = value; - } - - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - private String value; - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - -} diff --git a/src/org/traccar/web/client/model/StateItemProperties.java b/src/org/traccar/web/client/model/StateItemProperties.java deleted file mode 100644 index e3700a52..00000000 --- a/src/org/traccar/web/client/model/StateItemProperties.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.traccar.web.client.model; - -import com.google.gwt.editor.client.Editor.Path; -import com.sencha.gxt.core.client.ValueProvider; -import com.sencha.gxt.data.shared.ModelKeyProvider; -import com.sencha.gxt.data.shared.PropertyAccess; - -public interface StateItemProperties extends PropertyAccess<StateItem> { - - @Path("name") - ModelKeyProvider<StateItem> id(); - - ValueProvider<StateItem, String> name(); - - ValueProvider<StateItem, String> value(); - -} diff --git a/src/org/traccar/web/client/model/StateReader.java b/src/org/traccar/web/client/model/StateReader.java deleted file mode 100644 index 10ed9809..00000000 --- a/src/org/traccar/web/client/model/StateReader.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.traccar.web.client.model; - -import java.util.LinkedList; -import java.util.List; - -import org.traccar.web.client.ApplicationContext; -import org.traccar.web.shared.model.Position; - -import com.google.gwt.xml.client.Node; -import com.google.gwt.xml.client.NodeList; -import com.google.gwt.xml.client.XMLParser; - -public class StateReader { - - private static String toString(Object object) { - if (object != null) { - return object.toString(); - } - return null; - } - - public static List<StateItem> getState(Position position) { - List<StateItem> state = new LinkedList<StateItem>(); - - state.add(new StateItem("valid", toString(position.getValid()))); - state.add(new StateItem("time", ApplicationContext.getInstance().getFormatterUtil().getTimeFormat().format(position.getTime()))); - state.add(new StateItem("latitude", toString(position.getLatitude()))); - state.add(new StateItem("longitude", toString(position.getLongitude()))); - state.add(new StateItem("altitude", toString(position.getAltitude()))); - state.add(new StateItem("speed", ApplicationContext.getInstance().getFormatterUtil().getSpeedFormat().format(position.getSpeed()))); - state.add(new StateItem("course", toString(position.getCourse()))); - state.add(new StateItem("power", toString(position.getPower()))); - state.add(new StateItem("address", position.getAddress())); - - String other = position.getOther(); - if (other != null) { - try { - NodeList nodes = XMLParser.parse(other).getFirstChild().getChildNodes(); - for (int i = 0; i < nodes.getLength(); i++) { - Node node = nodes.item(i); - state.add(new StateItem(node.getNodeName(), node.getFirstChild().getNodeValue())); - } - } catch (Exception error) { - } - } - - return state; - } - -} diff --git a/src/org/traccar/web/client/model/UserProperties.java b/src/org/traccar/web/client/model/UserProperties.java deleted file mode 100644 index cba2996f..00000000 --- a/src/org/traccar/web/client/model/UserProperties.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.web.client.model; - -import org.traccar.web.shared.model.User; - -import com.sencha.gxt.core.client.ValueProvider; -import com.sencha.gxt.data.shared.ModelKeyProvider; -import com.sencha.gxt.data.shared.PropertyAccess; - -public interface UserProperties extends PropertyAccess<User> { - - ModelKeyProvider<User> id(); - - ValueProvider<User, String> login(); - - ValueProvider<User, String> password(); - - ValueProvider<User, Boolean> admin(); - -} diff --git a/src/org/traccar/web/client/model/UserSettingsProperties.java b/src/org/traccar/web/client/model/UserSettingsProperties.java deleted file mode 100644 index dad7111d..00000000 --- a/src/org/traccar/web/client/model/UserSettingsProperties.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.web.client.model; - -import org.traccar.web.shared.model.UserSettings; -import org.traccar.web.shared.model.UserSettings.SpeedUnit; - -import com.sencha.gxt.core.client.ValueProvider; -import com.sencha.gxt.data.shared.LabelProvider; -import com.sencha.gxt.data.shared.ModelKeyProvider; -import com.sencha.gxt.data.shared.PropertyAccess; - -public interface UserSettingsProperties extends PropertyAccess<UserSettings> { - - ModelKeyProvider<UserSettings> id(); - - ValueProvider<UserSettings, UserSettings.SpeedUnit> speedUnit(); - - public static class SpeedUnitLabelProvider implements LabelProvider<UserSettings.SpeedUnit> { - - @Override - public String getLabel(SpeedUnit item) { - switch (item) { - case kilometersPerHour: - return "km/h"; - case knots: - return "knots"; - case milesPerHour: - return "mph"; - default: - return null; - } - } - - } - -} |