diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-08-03 15:13:14 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-08-03 15:13:14 +1200 |
commit | fcaf637431fee2cdd5ccab79b6de1edf44bac777 (patch) | |
tree | 28b12e76700f4ac03d4d10e0d0944762d30621a0 /src/org/traccar/web/client/view | |
parent | 207e4f459d1e91c66376916f2a99cf66f7d04bd0 (diff) | |
download | trackermap-web-fcaf637431fee2cdd5ccab79b6de1edf44bac777.tar.gz trackermap-web-fcaf637431fee2cdd5ccab79b6de1edf44bac777.tar.bz2 trackermap-web-fcaf637431fee2cdd5ccab79b6de1edf44bac777.zip |
Remove files and update readme
Diffstat (limited to 'src/org/traccar/web/client/view')
23 files changed, 0 insertions, 1930 deletions
diff --git a/src/org/traccar/web/client/view/ApplicationSettingsDialog.java b/src/org/traccar/web/client/view/ApplicationSettingsDialog.java deleted file mode 100644 index 24b9f96d..00000000 --- a/src/org/traccar/web/client/view/ApplicationSettingsDialog.java +++ /dev/null @@ -1,81 +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.view; - -import org.traccar.web.shared.model.ApplicationSettings; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.editor.client.Editor; -import com.google.gwt.editor.client.SimpleBeanEditorDriver; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.ui.Widget; -import com.sencha.gxt.widget.core.client.Window; -import com.sencha.gxt.widget.core.client.event.SelectEvent; -import com.sencha.gxt.widget.core.client.form.CheckBox; - -public class ApplicationSettingsDialog implements Editor<ApplicationSettings> { - - private static ApplicationSettingsDialogUiBinder uiBinder = GWT.create(ApplicationSettingsDialogUiBinder.class); - - interface ApplicationSettingsDialogUiBinder extends UiBinder<Widget, ApplicationSettingsDialog> { - } - - private ApplicationSettingsDriver driver = GWT.create(ApplicationSettingsDriver.class); - - interface ApplicationSettingsDriver extends SimpleBeanEditorDriver<ApplicationSettings, ApplicationSettingsDialog> { - } - - public interface ApplicationSettingsHandler { - public void onSave(ApplicationSettings applicationSettings); - } - - private ApplicationSettingsHandler applicationSettingsHandler; - - @UiField - Window window; - - @UiField - CheckBox registrationEnabled; - - public ApplicationSettingsDialog(ApplicationSettings applicationSettings, ApplicationSettingsHandler applicationSettingsHandler) { - this.applicationSettingsHandler = applicationSettingsHandler; - uiBinder.createAndBindUi(this); - driver.initialize(this); - driver.edit(applicationSettings); - } - - public void show() { - window.show(); - } - - public void hide() { - window.hide(); - } - - @UiHandler("saveButton") - public void onLoginClicked(SelectEvent event) { - window.hide(); - applicationSettingsHandler.onSave(driver.flush()); - } - - @UiHandler("cancelButton") - public void onRegisterClicked(SelectEvent event) { - window.hide(); - } - -} diff --git a/src/org/traccar/web/client/view/ApplicationSettingsDialog.ui.xml b/src/org/traccar/web/client/view/ApplicationSettingsDialog.ui.xml deleted file mode 100644 index effdc4ad..00000000 --- a/src/org/traccar/web/client/view/ApplicationSettingsDialog.ui.xml +++ /dev/null @@ -1,33 +0,0 @@ -<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> -<ui:UiBinder - xmlns:ui="urn:ui:com.google.gwt.uibinder" - xmlns:g="urn:import:com.google.gwt.user.client.ui" - xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client" - xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container" - xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form" - xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button"> - - <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="verticalLayoutData"> - <ui:attributes width="1" height="-1" /> - </ui:with> - - <gxt:Window ui:field="window" pixelSize="300, 110" modal="true" headingText="Global Settings" focusWidget="{saveButton}"> - <container:VerticalLayoutContainer> - <container:child layoutData="{verticalLayoutData}"> - <form:FieldLabel text="Registration"> - <form:widget> - <form:CheckBox ui:field="registrationEnabled" /> - </form:widget> - </form:FieldLabel> - </container:child> - </container:VerticalLayoutContainer> - - <gxt:button> - <button:TextButton ui:field="saveButton" text="Save" /> - </gxt:button> - <gxt:button> - <button:TextButton ui:field="cancelButton" text="Cancel" /> - </gxt:button> - </gxt:Window> - -</ui:UiBinder> diff --git a/src/org/traccar/web/client/view/ApplicationView.java b/src/org/traccar/web/client/view/ApplicationView.java deleted file mode 100644 index dfa5335d..00000000 --- a/src/org/traccar/web/client/view/ApplicationView.java +++ /dev/null @@ -1,52 +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.view; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Widget; -import com.sencha.gxt.widget.core.client.ContentPanel; - -public class ApplicationView extends Composite { - - private static ApplicationViewUiBinder uiBinder = GWT.create(ApplicationViewUiBinder.class); - - interface ApplicationViewUiBinder extends UiBinder<Widget, ApplicationView> { - } - - @UiField(provided = true) - ContentPanel devicePanel; - - @UiField(provided = true) - ContentPanel statePanel; - - @UiField(provided = true) - ContentPanel mapPanel; - - @UiField(provided = true) - ContentPanel archivePanel; - - public ApplicationView(ContentPanel deviceView, ContentPanel stateView, ContentPanel mapView, ContentPanel archiveView) { - devicePanel = deviceView; - statePanel = stateView; - mapPanel = mapView; - archivePanel = archiveView; - initWidget(uiBinder.createAndBindUi(this)); - } - -} diff --git a/src/org/traccar/web/client/view/ApplicationView.ui.xml b/src/org/traccar/web/client/view/ApplicationView.ui.xml deleted file mode 100644 index 0b05ab9b..00000000 --- a/src/org/traccar/web/client/view/ApplicationView.ui.xml +++ /dev/null @@ -1,56 +0,0 @@ -<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> -<ui:UiBinder - xmlns:ui="urn:ui:com.google.gwt.uibinder" - xmlns:g="urn:import:com.google.gwt.user.client.ui" - xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container" - xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client"> - - <ui:with type="com.sencha.gxt.core.client.util.Margins" field="topMargins"> - <ui:attributes top="5" right="0" bottom="0" left="0" /> - </ui:with> - <ui:with type="com.sencha.gxt.core.client.util.Margins" field="westMargins"> - <ui:attributes top="5" right="5" bottom="0" left="5" /> - </ui:with> - <ui:with type="com.sencha.gxt.core.client.util.Margins" field="centerMargins"> - <ui:attributes top="5" right="5" bottom="0" left="0" /> - </ui:with> - <ui:with type="com.sencha.gxt.core.client.util.Margins" field="southMargins"> - <ui:attributes top="5" right="5" bottom="5" left="5" /> - </ui:with> - - <ui:with type="com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData" field="westData"> - <ui:attributes size="0.15" maxSize="2147483647" margins="{westMargins}" split="true" /> - </ui:with> - <ui:with type="com.sencha.gxt.widget.core.client.container.MarginData" field="centerData"> - <ui:attributes margins="{centerMargins}" /> - </ui:with> - <ui:with type="com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData" field="southData"> - <ui:attributes size="0.25" maxSize="2147483647" margins="{southMargins}" split="true" /> - </ui:with> - - <ui:with type="com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData" field="bottomData"> - <ui:attributes size="0.5" maxSize="2147483647" margins="{topMargins}" split="true" /> - </ui:with> - - <container:Viewport> - <container:BorderLayoutContainer> - <container:west layoutData="{westData}"> - <container:BorderLayoutContainer> - <container:center> - <gxt:ContentPanel ui:field="devicePanel" /> - </container:center> - <container:south layoutData="{bottomData}"> - <gxt:ContentPanel ui:field="statePanel" /> - </container:south> - </container:BorderLayoutContainer> - </container:west> - <container:center layoutData="{centerData}"> - <gxt:ContentPanel ui:field="mapPanel" /> - </container:center> - <container:south layoutData="{southData}"> - <gxt:ContentPanel ui:field="archivePanel" /> - </container:south> - </container:BorderLayoutContainer> - </container:Viewport> - -</ui:UiBinder> diff --git a/src/org/traccar/web/client/view/ArchiveView.java b/src/org/traccar/web/client/view/ArchiveView.java deleted file mode 100644 index 9cc579f8..00000000 --- a/src/org/traccar/web/client/view/ArchiveView.java +++ /dev/null @@ -1,196 +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.view; - -import java.util.Date; -import java.util.LinkedList; -import java.util.List; - -import org.traccar.web.client.ApplicationContext; -import org.traccar.web.client.model.BaseStoreHandlers; -import org.traccar.web.client.model.DeviceProperties; -import org.traccar.web.client.model.PositionProperties; -import org.traccar.web.shared.model.Device; -import org.traccar.web.shared.model.Position; - -import com.google.gwt.cell.client.DateCell; -import com.google.gwt.core.client.GWT; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.ui.Widget; -import com.sencha.gxt.cell.core.client.NumberCell; -import com.sencha.gxt.core.client.Style.SelectionMode; -import com.sencha.gxt.data.shared.ListStore; -import com.sencha.gxt.data.shared.event.StoreHandlers; -import com.sencha.gxt.widget.core.client.ContentPanel; -import com.sencha.gxt.widget.core.client.event.SelectEvent; -import com.sencha.gxt.widget.core.client.form.ComboBox; -import com.sencha.gxt.widget.core.client.form.DateField; -import com.sencha.gxt.widget.core.client.form.TimeField; -import com.sencha.gxt.widget.core.client.grid.ColumnConfig; -import com.sencha.gxt.widget.core.client.grid.ColumnModel; -import com.sencha.gxt.widget.core.client.grid.Grid; -import com.sencha.gxt.widget.core.client.selection.SelectionChangedEvent; - -public class ArchiveView implements SelectionChangedEvent.SelectionChangedHandler<Position> { - - private static ArchiveViewUiBinder uiBinder = GWT.create(ArchiveViewUiBinder.class); - - interface ArchiveViewUiBinder extends UiBinder<Widget, ArchiveView> { - } - - public interface ArchiveHandler { - public void onSelected(Position position); - public void onLoad(Device device, Date from, Date to); - public void onClear(); - } - - private ArchiveHandler archiveHandler; - - @UiField - ContentPanel contentPanel; - - public ContentPanel getView() { - return contentPanel; - } - - ListStore<Device> deviceStore; - - @UiField - DateField fromDate; - - @UiField - TimeField fromTime; - - @UiField - DateField toDate; - - @UiField - TimeField toTime; - - @UiField(provided = true) - ComboBox<Device> deviceCombo; - - @UiField(provided = true) - ColumnModel<Position> columnModel; - - @UiField(provided = true) - ListStore<Position> positionStore; - - @UiField - Grid<Position> grid; - - public ArchiveView(ArchiveHandler archiveHandler, ListStore<Position> positionStore, ListStore<Device> deviceStore) { - this.archiveHandler = archiveHandler; - this.positionStore = positionStore; - deviceStore.addStoreHandlers(deviceStoreHandlers); - this.deviceStore = deviceStore; - - DeviceProperties deviceProperties = GWT.create(DeviceProperties.class); - deviceCombo = new ComboBox<Device>(deviceStore, deviceProperties.label()); - - PositionProperties positionProperties = GWT.create(PositionProperties.class); - - List<ColumnConfig<Position, ?>> columnConfigList = new LinkedList<ColumnConfig<Position, ?>>(); - - columnConfigList.add(new ColumnConfig<Position, Boolean>(positionProperties.valid(), 0, "Valid")); - - ColumnConfig<Position, Date> columnConfigDate = new ColumnConfig<Position, Date>(positionProperties.time(), 0, "Time"); - columnConfigDate.setCell(new DateCell(ApplicationContext.getInstance().getFormatterUtil().getTimeFormat())); - columnConfigList.add(columnConfigDate); - - columnConfigList.add(new ColumnConfig<Position, Double>(positionProperties.latitude(), 0, "Latitude")); - columnConfigList.add(new ColumnConfig<Position, Double>(positionProperties.longitude(), 0, "Longitude")); - columnConfigList.add(new ColumnConfig<Position, Double>(positionProperties.altitude(), 0, "Altitude")); - - ColumnConfig<Position, Double> columnConfigDouble = new ColumnConfig<Position, Double>(positionProperties.speed(), 0, "Speed"); - columnConfigDouble.setCell(new NumberCell<Double>(ApplicationContext.getInstance().getFormatterUtil().getSpeedFormat())); - columnConfigList.add(columnConfigDouble); - - columnConfigList.add(new ColumnConfig<Position, Double>(positionProperties.course(), 0, "Course")); - columnConfigList.add(new ColumnConfig<Position, Double>(positionProperties.power(), 0, "Power")); - - columnModel = new ColumnModel<Position>(columnConfigList); - - uiBinder.createAndBindUi(this); - - grid.getSelectionModel().addSelectionChangedHandler(this); - grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); - - // Initialize with current time - long min = 60 * 1000; - Date now = new Date(); - Date to = new Date(((now.getTime() + 15 * min) / (15 * min)) * 15 * min); - Date from = new Date(to.getTime() - 60 * min); - fromDate.setValue(from); - fromTime.setValue(from); - toDate.setValue(to); - toTime.setValue(to); - } - - @Override - public void onSelectionChanged(SelectionChangedEvent<Position> event) { - if (event.getSelection().isEmpty()) { - archiveHandler.onSelected(null); - } else { - archiveHandler.onSelected(event.getSelection().get(0)); - } - } - - @SuppressWarnings("deprecation") - private static Date getCombineDate(DateField dateField, TimeField timeField) { - Date result = null; - Date date = dateField.getValue(); - Date time = timeField.getValue(); - if (date != null && time != null) { - result = new Date( - date.getYear(), date.getMonth(), date.getDate(), - time.getHours(), time.getMinutes(), time.getSeconds()); - } - return result; - } - - @UiHandler("loadButton") - public void onLoadClicked(SelectEvent event) { - archiveHandler.onLoad( - deviceCombo.getValue(), - getCombineDate(fromDate, fromTime), - getCombineDate(toDate, toTime)); - } - - @UiHandler("clearButton") - public void onClearClicked(SelectEvent event) { - archiveHandler.onClear(); - } - - private StoreHandlers<Device> deviceStoreHandlers = new BaseStoreHandlers<Device>() { - - @Override - public void onAnything() { - Device oldDevice = deviceCombo.getValue(); - if (oldDevice != null) { - deviceCombo.setValue(deviceStore.findModel(oldDevice)); - } - } - - }; - - public void selectPosition(Position position) { - grid.getSelectionModel().select(positionStore.findModel(position), false); - } - -} diff --git a/src/org/traccar/web/client/view/ArchiveView.ui.xml b/src/org/traccar/web/client/view/ArchiveView.ui.xml deleted file mode 100644 index f27d38ff..00000000 --- a/src/org/traccar/web/client/view/ArchiveView.ui.xml +++ /dev/null @@ -1,62 +0,0 @@ -<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> -<ui:UiBinder - xmlns:ui="urn:ui:com.google.gwt.uibinder" - xmlns:g="urn:import:com.google.gwt.user.client.ui" - xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container" - xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client" - xmlns:toolbar="urn:import:com.sencha.gxt.widget.core.client.toolbar" - xmlns:grid="urn:import:com.sencha.gxt.widget.core.client.grid" - xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button" - xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form"> - - <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="toolBarRowData"> - <ui:attributes width="1" height="-1" /> - </ui:with> - <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="layoutData"> - <ui:attributes width="1" height="1" /> - </ui:with> - - <ui:with type="com.sencha.gxt.data.shared.ListStore" field="positionStore" /> - <ui:with type="com.sencha.gxt.widget.core.client.grid.ColumnModel" field="columnModel" /> - - <ui:with type="com.sencha.gxt.widget.core.client.grid.GridView" field="view"> - <ui:attributes stripeRows="true" autoFill="true" /> - </ui:with> - - <gxt:ContentPanel ui:field="contentPanel" headingText="Archive"> - <container:VerticalLayoutContainer> - - <container:child layoutData="{toolBarRowData}"> - <toolbar:ToolBar> - - <toolbar:LabelToolItem label="Device:" /> - <form:ComboBox ui:field="deviceCombo" editable="false" triggerAction="ALL" /> - <toolbar:SeparatorToolItem /> - - <toolbar:LabelToolItem label="From:" /> - <form:DateField width="125" ui:field="fromDate" /> - <toolbar:LabelToolItem width="5" /> - <form:TimeField width="75" ui:field="fromTime" triggerAction="ALL" /> - <toolbar:SeparatorToolItem /> - - <toolbar:LabelToolItem label="To:" /> - <form:DateField width="125" ui:field="toDate" /> - <toolbar:LabelToolItem width="5" /> - <form:TimeField width="75" ui:field="toTime" triggerAction="ALL" /> - <toolbar:SeparatorToolItem /> - - <button:TextButton ui:field="loadButton" text="Load" /> - <toolbar:FillToolItem /> - <button:TextButton ui:field="clearButton" text="Clear" /> - - </toolbar:ToolBar> - </container:child> - - <container:child layoutData="{layoutData}"> - <grid:Grid ui:field="grid" store="{positionStore}" cm="{columnModel}" view="{view}" /> - </container:child> - - </container:VerticalLayoutContainer> - </gxt:ContentPanel> - -</ui:UiBinder> diff --git a/src/org/traccar/web/client/view/DeviceDialog.java b/src/org/traccar/web/client/view/DeviceDialog.java deleted file mode 100644 index 9e94e963..00000000 --- a/src/org/traccar/web/client/view/DeviceDialog.java +++ /dev/null @@ -1,84 +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.view; - -import org.traccar.web.shared.model.Device; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.editor.client.Editor; -import com.google.gwt.editor.client.SimpleBeanEditorDriver; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.ui.Widget; -import com.sencha.gxt.widget.core.client.Window; -import com.sencha.gxt.widget.core.client.event.SelectEvent; -import com.sencha.gxt.widget.core.client.form.TextField; - -public class DeviceDialog implements Editor<Device> { - - private static DeviceDialogUiBinder uiBinder = GWT.create(DeviceDialogUiBinder.class); - - interface DeviceDialogUiBinder extends UiBinder<Widget, DeviceDialog> { - } - - private DeviceDriver driver = GWT.create(DeviceDriver.class); - - interface DeviceDriver extends SimpleBeanEditorDriver<Device, DeviceDialog> { - } - - public interface DeviceHandler { - public void onSave(Device device); - } - - private DeviceHandler deviceHandler; - - @UiField - Window window; - - @UiField - TextField name; - - @UiField - TextField uniqueId; - - public DeviceDialog(Device device, DeviceHandler deviceHandler) { - this.deviceHandler = deviceHandler; - uiBinder.createAndBindUi(this); - driver.initialize(this); - driver.edit(device); - } - - public void show() { - window.show(); - } - - public void hide() { - window.hide(); - } - - @UiHandler("saveButton") - public void onLoginClicked(SelectEvent event) { - window.hide(); - deviceHandler.onSave(driver.flush()); - } - - @UiHandler("cancelButton") - public void onRegisterClicked(SelectEvent event) { - window.hide(); - } - -} diff --git a/src/org/traccar/web/client/view/DeviceDialog.ui.xml b/src/org/traccar/web/client/view/DeviceDialog.ui.xml deleted file mode 100644 index 4f7ccc56..00000000 --- a/src/org/traccar/web/client/view/DeviceDialog.ui.xml +++ /dev/null @@ -1,40 +0,0 @@ -<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> -<ui:UiBinder - xmlns:ui="urn:ui:com.google.gwt.uibinder" - xmlns:g="urn:import:com.google.gwt.user.client.ui" - xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client" - xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container" - xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form" - xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button"> - - <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="verticalLayoutData"> - <ui:attributes width="1" height="-1" /> - </ui:with> - - <gxt:Window ui:field="window" pixelSize="300, 130" modal="true" headingText="Device" focusWidget="{saveButton}"> - <container:VerticalLayoutContainer> - <container:child layoutData="{verticalLayoutData}"> - <form:FieldLabel text="Name"> - <form:widget> - <form:TextField ui:field="name" /> - </form:widget> - </form:FieldLabel> - </container:child> - <container:child layoutData="{verticalLayoutData}"> - <form:FieldLabel text="Unique Identifier"> - <form:widget> - <form:TextField ui:field="uniqueId" /> - </form:widget> - </form:FieldLabel> - </container:child> - </container:VerticalLayoutContainer> - - <gxt:button> - <button:TextButton ui:field="saveButton" text="Save" /> - </gxt:button> - <gxt:button> - <button:TextButton ui:field="cancelButton" text="Cancel" /> - </gxt:button> - </gxt:Window> - -</ui:UiBinder> diff --git a/src/org/traccar/web/client/view/DeviceView.java b/src/org/traccar/web/client/view/DeviceView.java deleted file mode 100644 index 21d906c8..00000000 --- a/src/org/traccar/web/client/view/DeviceView.java +++ /dev/null @@ -1,186 +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.view; - -import java.util.LinkedList; -import java.util.List; - -import org.traccar.web.client.Application; -import org.traccar.web.client.ApplicationContext; -import org.traccar.web.client.model.BaseAsyncCallback; -import org.traccar.web.client.model.DeviceProperties; -import org.traccar.web.shared.model.Device; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.logical.shared.SelectionEvent; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.ui.Widget; -import com.sencha.gxt.core.client.Style.SelectionMode; -import com.sencha.gxt.data.shared.ListStore; -import com.sencha.gxt.widget.core.client.ContentPanel; -import com.sencha.gxt.widget.core.client.button.TextButton; -import com.sencha.gxt.widget.core.client.event.SelectEvent; -import com.sencha.gxt.widget.core.client.grid.ColumnConfig; -import com.sencha.gxt.widget.core.client.grid.ColumnModel; -import com.sencha.gxt.widget.core.client.grid.Grid; -import com.sencha.gxt.widget.core.client.menu.Item; -import com.sencha.gxt.widget.core.client.menu.MenuItem; -import com.sencha.gxt.widget.core.client.selection.SelectionChangedEvent; - -public class DeviceView implements SelectionChangedEvent.SelectionChangedHandler<Device> { - - private static DeviceViewUiBinder uiBinder = GWT.create(DeviceViewUiBinder.class); - - interface DeviceViewUiBinder extends UiBinder<Widget, DeviceView> { - } - - public interface DeviceHandler { - public void onSelected(Device device); - public void onAdd(); - public void onEdit(Device device); - public void onRemove(Device device); - } - - private DeviceHandler deviceHandler; - - @UiField - ContentPanel contentPanel; - - public ContentPanel getView() { - return contentPanel; - } - - @UiField - TextButton addButton; - - @UiField - TextButton editButton; - - @UiField - TextButton removeButton; - - @UiField(provided = true) - ColumnModel<Device> columnModel; - - @UiField(provided = true) - ListStore<Device> deviceStore; - - @UiField - Grid<Device> grid; - - @UiField - MenuItem settingsUsers; - - @UiField - MenuItem settingsGlobal; - - public DeviceView(DeviceHandler deviceHandler, SettingsHandler settingsHandler, ListStore<Device> deviceStore) { - this.deviceHandler = deviceHandler; - this.settingsHandler = settingsHandler; - this.deviceStore = deviceStore; - - DeviceProperties deviceProperties = GWT.create(DeviceProperties.class); - - List<ColumnConfig<Device, ?>> columnConfigList = new LinkedList<ColumnConfig<Device, ?>>(); - columnConfigList.add(new ColumnConfig<Device, String>(deviceProperties.name(), 0, "Name")); - columnConfigList.add(new ColumnConfig<Device, String>(deviceProperties.uniqueId(), 0, "Unique Identifier")); - columnModel = new ColumnModel<Device>(columnConfigList); - - uiBinder.createAndBindUi(this); - - grid.getSelectionModel().addSelectionChangedHandler(this); - grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); - - if (ApplicationContext.getInstance().getUser().getAdmin()) { - settingsUsers.enable(); - settingsGlobal.enable(); - } - } - - @Override - public void onSelectionChanged(SelectionChangedEvent<Device> event) { - editButton.setEnabled(!event.getSelection().isEmpty()); - removeButton.setEnabled(!event.getSelection().isEmpty()); - - if (event.getSelection().isEmpty()) { - deviceHandler.onSelected(null); - } else { - deviceHandler.onSelected(event.getSelection().get(0)); - } - } - - @UiHandler("addButton") - public void onAddClicked(SelectEvent event) { - deviceHandler.onAdd(); - } - - @UiHandler("editButton") - public void onEditClicked(SelectEvent event) { - deviceHandler.onEdit(grid.getSelectionModel().getSelectedItem()); - } - - @UiHandler("removeButton") - public void onRemoveClicked(SelectEvent event) { - deviceHandler.onRemove(grid.getSelectionModel().getSelectedItem()); - } - - @UiHandler("logoutButton") - public void onLogoutClicked(SelectEvent event) { - Application.getDataService().logout(new BaseAsyncCallback<Boolean>() { - @Override - public void onSuccess(Boolean result) { - Window.Location.reload(); - } - }); - } - - public void selectDevice(Device device) { - grid.getSelectionModel().select(deviceStore.findModel(device), false); - } - - public interface SettingsHandler { - public void onAccountSelected(); - public void onPreferencesSelected(); - public void onUsersSelected(); - public void onApplicationSelected(); - } - - private SettingsHandler settingsHandler; - - @UiHandler("settingsAccount") - public void onSettingsAccountSelected(SelectionEvent<Item> event) { - settingsHandler.onAccountSelected(); - } - - @UiHandler("settingsPreferences") - public void onSettingsPreferencesSelected(SelectionEvent<Item> event) { - settingsHandler.onPreferencesSelected(); - } - - @UiHandler("settingsUsers") - public void onSettingsUsersSelected(SelectionEvent<Item> event) { - settingsHandler.onUsersSelected(); - } - - @UiHandler("settingsGlobal") - public void onSettingsGlobalSelected(SelectionEvent<Item> event) { - settingsHandler.onApplicationSelected(); - } - -} diff --git a/src/org/traccar/web/client/view/DeviceView.ui.xml b/src/org/traccar/web/client/view/DeviceView.ui.xml deleted file mode 100644 index 38721ca0..00000000 --- a/src/org/traccar/web/client/view/DeviceView.ui.xml +++ /dev/null @@ -1,57 +0,0 @@ -<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> -<ui:UiBinder - xmlns:ui="urn:ui:com.google.gwt.uibinder" - xmlns:g="urn:import:com.google.gwt.user.client.ui" - xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container" - xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client" - xmlns:toolbar="urn:import:com.sencha.gxt.widget.core.client.toolbar" - xmlns:grid="urn:import:com.sencha.gxt.widget.core.client.grid" - xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button" - xmlns:menu="urn:import:com.sencha.gxt.widget.core.client.menu"> - - <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="toolBarRowData"> - <ui:attributes width="1" height="-1" /> - </ui:with> - <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="layoutData"> - <ui:attributes width="1" height="1" /> - </ui:with> - - <ui:with type="com.sencha.gxt.data.shared.ListStore" field="deviceStore" /> - <ui:with type="com.sencha.gxt.widget.core.client.grid.ColumnModel" field="columnModel" /> - - <ui:with type="com.sencha.gxt.widget.core.client.grid.GridView" field="view"> - <ui:attributes stripeRows="true" autoFill="true" /> - </ui:with> - - <gxt:ContentPanel ui:field="contentPanel" headingText="Devices"> - <container:VerticalLayoutContainer> - - <container:child layoutData="{toolBarRowData}"> - <toolbar:ToolBar> - <button:TextButton ui:field="addButton" text="Add" /> - <button:TextButton ui:field="editButton" text="Edit" enabled="false" /> - <button:TextButton ui:field="removeButton" text="Remove" enabled="false" /> - <toolbar:FillToolItem /> - <toolbar:SeparatorToolItem /> - <button:TextButton ui:field="settingsButton" text="Settings"> - <button:menu> - <menu:Menu> - <menu:MenuItem text="Account" ui:field="settingsAccount" /> - <menu:MenuItem text="Preferences" ui:field="settingsPreferences" /> - <menu:MenuItem text="Users" ui:field="settingsUsers" enabled="false" /> - <menu:MenuItem text="Global" ui:field="settingsGlobal" enabled="false" /> - </menu:Menu> - </button:menu> - </button:TextButton> - <button:TextButton ui:field="logoutButton" text="Logout" /> - </toolbar:ToolBar> - </container:child> - - <container:child layoutData="{layoutData}"> - <grid:Grid ui:field="grid" store="{deviceStore}" cm="{columnModel}" view="{view}" /> - </container:child> - - </container:VerticalLayoutContainer> - </gxt:ContentPanel> - -</ui:UiBinder> diff --git a/src/org/traccar/web/client/view/LoginDialog.java b/src/org/traccar/web/client/view/LoginDialog.java deleted file mode 100644 index 59b46239..00000000 --- a/src/org/traccar/web/client/view/LoginDialog.java +++ /dev/null @@ -1,84 +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.view; - -import org.traccar.web.client.ApplicationContext; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.ui.Widget; -import com.sencha.gxt.widget.core.client.Window; -import com.sencha.gxt.widget.core.client.button.TextButton; -import com.sencha.gxt.widget.core.client.event.SelectEvent; -import com.sencha.gxt.widget.core.client.form.PasswordField; -import com.sencha.gxt.widget.core.client.form.TextField; - -public class LoginDialog { - - private static LoginDialogUiBinder uiBinder = GWT.create(LoginDialogUiBinder.class); - - interface LoginDialogUiBinder extends UiBinder<Widget, LoginDialog> { - } - - public interface LoginHandler { - public void onLogin(String login, String password); - public void onRegister(String login, String password); - } - - private LoginHandler loginHandler; - - @UiField - Window window; - - @UiField - TextField login; - - @UiField - PasswordField password; - - @UiField - TextButton registerButton; - - public LoginDialog(LoginHandler loginHandler) { - this.loginHandler = loginHandler; - uiBinder.createAndBindUi(this); - - if (ApplicationContext.getInstance().getApplicationSettings().getRegistrationEnabled()) { - registerButton.enable(); - } - } - - public void show() { - window.show(); - } - - public void hide() { - window.hide(); - } - - @UiHandler("loginButton") - public void onLoginClicked(SelectEvent event) { - loginHandler.onLogin(login.getText(), password.getText()); - } - - @UiHandler("registerButton") - public void onRegisterClicked(SelectEvent event) { - loginHandler.onRegister(login.getText(), password.getText()); - } - -} diff --git a/src/org/traccar/web/client/view/LoginDialog.ui.xml b/src/org/traccar/web/client/view/LoginDialog.ui.xml deleted file mode 100644 index c9314430..00000000 --- a/src/org/traccar/web/client/view/LoginDialog.ui.xml +++ /dev/null @@ -1,40 +0,0 @@ -<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> -<ui:UiBinder - xmlns:ui="urn:ui:com.google.gwt.uibinder" - xmlns:g="urn:import:com.google.gwt.user.client.ui" - xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client" - xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container" - xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form" - xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button"> - - <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="verticalLayoutData"> - <ui:attributes width="1" height="-1" /> - </ui:with> - - <gxt:Window ui:field="window" pixelSize="300, 130" modal="true" closable="false" headingText="Authentication" focusWidget="{loginButton}"> - <container:VerticalLayoutContainer> - <container:child layoutData="{verticalLayoutData}"> - <form:FieldLabel text="User"> - <form:widget> - <form:TextField ui:field="login" /> - </form:widget> - </form:FieldLabel> - </container:child> - <container:child layoutData="{verticalLayoutData}"> - <form:FieldLabel text="Password"> - <form:widget> - <form:PasswordField ui:field="password" /> - </form:widget> - </form:FieldLabel> - </container:child> - </container:VerticalLayoutContainer> - - <gxt:button> - <button:TextButton ui:field="loginButton" text="Login" /> - </gxt:button> - <gxt:button> - <button:TextButton ui:field="registerButton" text="Register" enabled="false" /> - </gxt:button> - </gxt:Window> - -</ui:UiBinder> diff --git a/src/org/traccar/web/client/view/MapPositionRenderer.java b/src/org/traccar/web/client/view/MapPositionRenderer.java deleted file mode 100644 index 15ba082e..00000000 --- a/src/org/traccar/web/client/view/MapPositionRenderer.java +++ /dev/null @@ -1,185 +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.view; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.gwtopenmaps.openlayers.client.Icon; -import org.gwtopenmaps.openlayers.client.Marker; -import org.gwtopenmaps.openlayers.client.event.EventHandler; -import org.gwtopenmaps.openlayers.client.event.EventObject; -import org.gwtopenmaps.openlayers.client.feature.VectorFeature; -import org.gwtopenmaps.openlayers.client.geometry.LineString; -import org.gwtopenmaps.openlayers.client.geometry.Point; -import org.gwtopenmaps.openlayers.client.layer.Markers; -import org.gwtopenmaps.openlayers.client.layer.Vector; -import org.traccar.web.shared.model.Device; -import org.traccar.web.shared.model.Position; - -import com.google.gwt.dom.client.Style; -import com.google.gwt.user.client.ui.RootPanel; - - -public class MapPositionRenderer { - - public interface SelectHandler { - public void onSelected(Position position); - } - - private final MapView mapView; - private final MarkerIconFactory.IconType iconType; - - protected Vector getVectorLayer() { - return mapView.getVectorLayer(); - } - - protected Markers getMarkerLayer() { - return mapView.getMarkerLayer(); - } - - private SelectHandler selectHandler; - - public MapPositionRenderer(MapView mapView, MarkerIconFactory.IconType iconType, SelectHandler selectHandler) { - this.mapView = mapView; - this.iconType = iconType; - this.selectHandler = selectHandler; - } - - private void addSelectEvent(Marker marker, final Position position) { - if (selectHandler != null) { - marker.getEvents().register("click", marker, new EventHandler() { - @Override - public void onHandle(EventObject eventObject) { - selectHandler.onSelected(position); - } - }); - marker.getEvents().register("mouseover", marker, new EventHandler() { - @Override - public void onHandle(EventObject eventObject) { - RootPanel.get().getElement().getStyle().setCursor(Style.Cursor.SE_RESIZE); - } - }); - marker.getEvents().register("mouseout", marker, new EventHandler() { - @Override - public void onHandle(EventObject eventObject) { - RootPanel.get().getElement().getStyle().setCursor(Style.Cursor.AUTO); - } - }); - } - } - - private void changeMarkerIcon(Long positionId, Icon icon) { - Marker oldMarker = markerMap.get(positionId); - Marker newMarker = new Marker(oldMarker.getLonLat(), icon); - addSelectEvent(newMarker, positionMap.get(positionId)); - markerMap.put(positionId, newMarker); - getMarkerLayer().addMarker(newMarker); - getMarkerLayer().removeMarker(oldMarker); - } - - private Map<Long, Marker> markerMap = new HashMap<Long, Marker>(); // Position.id -> Marker - private Map<Long, Long> deviceMap = new HashMap<Long, Long>(); // Device.id -> Position.id - private Map<Long, Position> positionMap = new HashMap<Long, Position>(); // Position.id -> Position - - private Long selectedPositionId; - private Long selectedDeviceId; - - public void showPositions(List<Position> positions) { - for (Marker marker : markerMap.values()) { - getMarkerLayer().removeMarker(marker); - } - markerMap.clear(); - deviceMap.clear(); - positionMap.clear(); - - for (Position position : positions) { - Marker marker = new Marker( - mapView.createLonLat(position.getLongitude(), position.getLatitude()), - MarkerIconFactory.getIcon(iconType, false)); - markerMap.put(position.getId(), marker); - deviceMap.put(position.getDevice().getId(), position.getId()); - positionMap.put(position.getId(), position); - addSelectEvent(marker, position); - getMarkerLayer().addMarker(marker); - } - - if (selectedPositionId != null) { - if (!selectPosition(null, selectedPositionId, false)) { - selectedPositionId = null; - } - } - - if (selectedDeviceId != null) { - if (!selectPosition(null, deviceMap.get(selectedDeviceId), false)) { - selectedDeviceId = null; - } - } - } - - public void showTrack(List<Position> positions) { - getVectorLayer().destroyFeatures(); - - if (!positions.isEmpty()) { - Point[] linePoints = new Point[positions.size()]; - - int i = 0; - for (Position position : positions) { - linePoints[i++] = mapView.createPoint(position.getLongitude(), position.getLatitude()); - } - - LineString lineString = new LineString(linePoints); - getVectorLayer().addFeature(new VectorFeature(lineString)); - //mapView.getMap().zoomToExtent(lineString.getBounds()); - } - } - - public void selectPosition(Position position, boolean center) { - Long oldPositionId = selectedPositionId; - Long newPositionId = (position != null) ? position.getId() : null; - if (selectPosition(oldPositionId, newPositionId, center)) { - selectedPositionId = position.getId(); - } else { - selectedPositionId = null; - } - } - - public void selectDevice(Device device, boolean center) { - Long oldPositionId = (selectedDeviceId != null) ? deviceMap.get(selectedDeviceId) : null; - Long newPositionId = (device != null) ? deviceMap.get(device.getId()) : null; - if (selectPosition(oldPositionId, newPositionId, center)) { - selectedDeviceId = device.getId(); - } else { - selectedDeviceId = null; - } - } - - private boolean selectPosition(Long oldPositionId, Long newPositionId, boolean center) { - if (oldPositionId != null && markerMap.containsKey(oldPositionId)) { - changeMarkerIcon(oldPositionId, MarkerIconFactory.getIcon(iconType, false)); - } - if (newPositionId != null && markerMap.containsKey(newPositionId)) { - changeMarkerIcon(newPositionId, MarkerIconFactory.getIcon(iconType, true)); - if (center) { - mapView.getMap().panTo(markerMap.get(newPositionId).getLonLat()); - } - return true; - } - return false; - } - -} diff --git a/src/org/traccar/web/client/view/MapView.java b/src/org/traccar/web/client/view/MapView.java deleted file mode 100644 index db51cd36..00000000 --- a/src/org/traccar/web/client/view/MapView.java +++ /dev/null @@ -1,211 +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.view; - -import java.util.List; - -import org.gwtopenmaps.openlayers.client.LonLat; -import org.gwtopenmaps.openlayers.client.Map; -import org.gwtopenmaps.openlayers.client.MapOptions; -import org.gwtopenmaps.openlayers.client.MapWidget; -import org.gwtopenmaps.openlayers.client.Projection; -import org.gwtopenmaps.openlayers.client.Style; -import org.gwtopenmaps.openlayers.client.control.LayerSwitcher; -import org.gwtopenmaps.openlayers.client.control.ScaleLine; -import org.gwtopenmaps.openlayers.client.geometry.Point; -import org.gwtopenmaps.openlayers.client.layer.Bing; -import org.gwtopenmaps.openlayers.client.layer.BingOptions; -import org.gwtopenmaps.openlayers.client.layer.BingType; -import org.gwtopenmaps.openlayers.client.layer.GoogleV3; -import org.gwtopenmaps.openlayers.client.layer.GoogleV3MapType; -import org.gwtopenmaps.openlayers.client.layer.GoogleV3Options; -import org.gwtopenmaps.openlayers.client.layer.Markers; -import org.gwtopenmaps.openlayers.client.layer.MarkersOptions; -import org.gwtopenmaps.openlayers.client.layer.OSM; -import org.gwtopenmaps.openlayers.client.layer.Vector; -import org.gwtopenmaps.openlayers.client.layer.VectorOptions; -import org.traccar.web.shared.model.Device; -import org.traccar.web.shared.model.Position; - -import com.google.gwt.core.client.Scheduler; -import com.google.gwt.event.logical.shared.ResizeEvent; -import com.google.gwt.event.logical.shared.ResizeHandler; -import com.google.gwt.user.client.Command; -import com.sencha.gxt.widget.core.client.ContentPanel; - -public class MapView { - - public interface MapHandler { - public void onPositionSelected(Position position); - public void onArchivePositionSelected(Position position); - } - - private MapHandler mapHandler; - - private ContentPanel contentPanel; - - public ContentPanel getView() { - return contentPanel; - } - - private MapWidget mapWidget; - private Map map; - private Vector vectorLayer; - private Markers markerLayer; - - public Map getMap() { - return map; - } - - public Vector getVectorLayer() { - return vectorLayer; - } - - public Markers getMarkerLayer() { - return markerLayer; - } - - public LonLat createLonLat(double longitude, double latitude) { - LonLat lonLat = new LonLat(longitude, latitude); - lonLat.transform(new Projection("EPSG:4326").getProjectionCode(), map.getProjection()); - return lonLat; - } - - public Point createPoint(double x, double y) { - Point point = new Point(x, y); - point.transform(new Projection("EPSG:4326"), new Projection(map.getProjection())); - return point; - } - - private void initMapLayers(Map map) { - map.addLayer(OSM.Mapnik("OpenStreetMap")); - - GoogleV3Options gHybridOptions = new GoogleV3Options(); - gHybridOptions.setNumZoomLevels(20); - gHybridOptions.setType(GoogleV3MapType.G_HYBRID_MAP); - map.addLayer(new GoogleV3("Google Hybrid", gHybridOptions)); - - GoogleV3Options gNormalOptions = new GoogleV3Options(); - gNormalOptions.setNumZoomLevels(22); - gNormalOptions.setType(GoogleV3MapType.G_NORMAL_MAP); - map.addLayer(new GoogleV3("Google Normal", gNormalOptions)); - - GoogleV3Options gSatelliteOptions = new GoogleV3Options(); - gSatelliteOptions.setNumZoomLevels(20); - gSatelliteOptions.setType(GoogleV3MapType.G_SATELLITE_MAP); - map.addLayer(new GoogleV3("Google Satellite", gSatelliteOptions)); - - GoogleV3Options gTerrainOptions = new GoogleV3Options(); - gTerrainOptions.setNumZoomLevels(16); - gTerrainOptions.setType(GoogleV3MapType.G_TERRAIN_MAP); - map.addLayer(new GoogleV3("Google Terrain", gTerrainOptions)); - - final String bingKey = "AseEs0DLJhLlTNoxbNXu7DGsnnH4UoWuGue7-irwKkE3fffaClwc9q_Mr6AyHY8F"; - map.addLayer(new Bing(new BingOptions("Bing Road", bingKey, BingType.ROAD))); - map.addLayer(new Bing(new BingOptions("Bing Hybrid", bingKey, BingType.HYBRID))); - map.addLayer(new Bing(new BingOptions("Bing Aerial", bingKey, BingType.AERIAL))); - } - - public MapView(MapHandler mapHandler) { - this.mapHandler = mapHandler; - contentPanel = new ContentPanel(); - contentPanel.setHeadingText("Map"); - - MapOptions defaultMapOptions = new MapOptions(); - - mapWidget = new MapWidget("100%", "100%", defaultMapOptions); - map = mapWidget.getMap(); - - Style style = new Style(); - style.setStrokeColor("blue"); - style.setStrokeWidth(3); - style.setFillOpacity(1); - - VectorOptions vectorOptions = new VectorOptions(); - vectorOptions.setStyle(style); - vectorLayer = new Vector("Vector", vectorOptions); - - MarkersOptions markersOptions = new MarkersOptions(); - markerLayer = new Markers("Markers", markersOptions); - - initMapLayers(map); - - map.addLayer(vectorLayer); - map.addLayer(markerLayer); - - map.addControl(new LayerSwitcher()); - map.addControl(new ScaleLine()); - map.setCenter(createLonLat(12.5, 41.9), 1); - - contentPanel.add(mapWidget); - - // Update map size - contentPanel.addResizeHandler(new ResizeHandler() { - @Override - public void onResize(ResizeEvent event) { - Scheduler.get().scheduleDeferred(new Command() { - @Override - public void execute() { - map.updateSize(); - } - }); - } - }); - - latestPositionRenderer = new MapPositionRenderer(this, MarkerIconFactory.IconType.iconLatest, latestPositionSelectHandler); - archivePositionRenderer = new MapPositionRenderer(this, MarkerIconFactory.IconType.iconArchive, archivePositionSelectHandler); - } - - private final MapPositionRenderer latestPositionRenderer; - - private final MapPositionRenderer archivePositionRenderer; - - public void showLatestPositions(List<Position> positions) { - latestPositionRenderer.showPositions(positions); - } - - public void showArchivePositions(List<Position> positions) { - archivePositionRenderer.showTrack(positions); - archivePositionRenderer.showPositions(positions); - } - - public void selectDevice(Device device) { - latestPositionRenderer.selectDevice(device, true); - } - - public void selectArchivePosition(Position position) { - archivePositionRenderer.selectPosition(position, true); - } - - private MapPositionRenderer.SelectHandler latestPositionSelectHandler = new MapPositionRenderer.SelectHandler() { - - @Override - public void onSelected(Position position) { - mapHandler.onPositionSelected(position); - } - - }; - - private MapPositionRenderer.SelectHandler archivePositionSelectHandler = new MapPositionRenderer.SelectHandler() { - - @Override - public void onSelected(Position position) { - mapHandler.onArchivePositionSelected(position); - } - - }; - -} diff --git a/src/org/traccar/web/client/view/MarkerIconFactory.java b/src/org/traccar/web/client/view/MarkerIconFactory.java deleted file mode 100644 index 46965d57..00000000 --- a/src/org/traccar/web/client/view/MarkerIconFactory.java +++ /dev/null @@ -1,51 +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.view; - -import org.gwtopenmaps.openlayers.client.Icon; -import org.gwtopenmaps.openlayers.client.Pixel; -import org.gwtopenmaps.openlayers.client.Size; - -class MarkerIconFactory { - - private static final Size iconSize = new Size(21, 25); - private static final Pixel iconOffset = new Pixel(-10.5f, -25.0f); - - private static final String iconUrl = "http://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/img/"; - private static final String iconRed = iconUrl + "marker.png"; - private static final String iconBlue = iconUrl + "marker-blue.png"; - private static final String iconGreen = iconUrl + "marker-green.png"; - private static final String iconGold = iconUrl + "marker-gold.png"; - - public static enum IconType { - iconLatest, - iconArchive - }; - - public static String getIconUrl(IconType type, boolean selected) { - if (type == IconType.iconLatest) { - return selected ? iconGreen : iconRed; - } else if (type == IconType.iconArchive) { - return selected ? iconGold : iconBlue; - } - return null; - } - - public static Icon getIcon(IconType type, boolean selected) { - return new Icon(getIconUrl(type, selected), iconSize, iconOffset); - } - -} diff --git a/src/org/traccar/web/client/view/StateView.java b/src/org/traccar/web/client/view/StateView.java deleted file mode 100644 index 700d55a6..00000000 --- a/src/org/traccar/web/client/view/StateView.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.traccar.web.client.view; - -import java.util.LinkedList; -import java.util.List; - -import org.traccar.web.client.model.StateItem; -import org.traccar.web.client.model.StateItemProperties; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.ui.Widget; -import com.sencha.gxt.data.shared.ListStore; -import com.sencha.gxt.widget.core.client.ContentPanel; -import com.sencha.gxt.widget.core.client.grid.ColumnConfig; -import com.sencha.gxt.widget.core.client.grid.ColumnModel; -import com.sencha.gxt.widget.core.client.grid.Grid; - -public class StateView { - - private static StateViewUiBinder uiBinder = GWT.create(StateViewUiBinder.class); - - interface StateViewUiBinder extends UiBinder<Widget, StateView> { - } - - @UiField - ContentPanel contentPanel; - - public ContentPanel getView() { - return contentPanel; - } - - @UiField(provided = true) - ColumnModel<StateItem> columnModel; - - @UiField(provided = true) - ListStore<StateItem> stateStore; - - @UiField - Grid<StateItem> grid; - - public StateView(ListStore<StateItem> stateStore) { - this.stateStore = stateStore; - - StateItemProperties stateItemProperties = GWT.create(StateItemProperties.class); - - List<ColumnConfig<StateItem, ?>> columnConfigList = new LinkedList<ColumnConfig<StateItem, ?>>(); - columnConfigList.add(new ColumnConfig<StateItem, String>(stateItemProperties.name(), 0, "Attribute")); - columnConfigList.add(new ColumnConfig<StateItem, String>(stateItemProperties.value(), 0, "Value")); - columnModel = new ColumnModel<StateItem>(columnConfigList); - - uiBinder.createAndBindUi(this); - - grid.getSelectionModel().setLocked(true); - } - -} - diff --git a/src/org/traccar/web/client/view/StateView.ui.xml b/src/org/traccar/web/client/view/StateView.ui.xml deleted file mode 100644 index 2a7c2ac9..00000000 --- a/src/org/traccar/web/client/view/StateView.ui.xml +++ /dev/null @@ -1,22 +0,0 @@ -<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> -<ui:UiBinder - xmlns:ui="urn:ui:com.google.gwt.uibinder" - xmlns:g="urn:import:com.google.gwt.user.client.ui" - xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container" - xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client" - xmlns:toolbar="urn:import:com.sencha.gxt.widget.core.client.toolbar" - xmlns:grid="urn:import:com.sencha.gxt.widget.core.client.grid" - xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button"> - - <ui:with type="com.sencha.gxt.data.shared.ListStore" field="stateStore" /> - <ui:with type="com.sencha.gxt.widget.core.client.grid.ColumnModel" field="columnModel" /> - - <ui:with type="com.sencha.gxt.widget.core.client.grid.GridView" field="view"> - <ui:attributes stripeRows="true" autoFill="true" /> - </ui:with> - - <gxt:ContentPanel ui:field="contentPanel" headingText="State"> - <grid:Grid ui:field="grid" store="{stateStore}" cm="{columnModel}" view="{view}" /> - </gxt:ContentPanel> - -</ui:UiBinder> diff --git a/src/org/traccar/web/client/view/UserDialog.java b/src/org/traccar/web/client/view/UserDialog.java deleted file mode 100644 index ac2eca32..00000000 --- a/src/org/traccar/web/client/view/UserDialog.java +++ /dev/null @@ -1,95 +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.view; - -import org.traccar.web.client.ApplicationContext; -import org.traccar.web.shared.model.User; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.editor.client.Editor; -import com.google.gwt.editor.client.SimpleBeanEditorDriver; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.ui.Widget; -import com.sencha.gxt.widget.core.client.Window; -import com.sencha.gxt.widget.core.client.event.SelectEvent; -import com.sencha.gxt.widget.core.client.form.CheckBox; -import com.sencha.gxt.widget.core.client.form.PasswordField; -import com.sencha.gxt.widget.core.client.form.TextField; - -public class UserDialog implements Editor<User> { - - private static UserDialogUiBinder uiBinder = GWT.create(UserDialogUiBinder.class); - - interface UserDialogUiBinder extends UiBinder<Widget, UserDialog> { - } - - private UserDriver driver = GWT.create(UserDriver.class); - - interface UserDriver extends SimpleBeanEditorDriver<User, UserDialog> { - } - - public interface UserHandler { - public void onSave(User user); - } - - private UserHandler userHandler; - - @UiField - Window window; - - @UiField - TextField login; - - @UiField - PasswordField password; - - @UiField - CheckBox admin; - - public UserDialog(User user, UserHandler userHandler) { - this.userHandler = userHandler; - uiBinder.createAndBindUi(this); - - if (ApplicationContext.getInstance().getUser().getAdmin()) { - admin.setEnabled(true); - } - - driver.initialize(this); - driver.edit(user); - } - - public void show() { - window.show(); - } - - public void hide() { - window.hide(); - } - - @UiHandler("saveButton") - public void onLoginClicked(SelectEvent event) { - window.hide(); - userHandler.onSave(driver.flush()); - } - - @UiHandler("cancelButton") - public void onRegisterClicked(SelectEvent event) { - window.hide(); - } - -} diff --git a/src/org/traccar/web/client/view/UserDialog.ui.xml b/src/org/traccar/web/client/view/UserDialog.ui.xml deleted file mode 100644 index 9f7fe21d..00000000 --- a/src/org/traccar/web/client/view/UserDialog.ui.xml +++ /dev/null @@ -1,47 +0,0 @@ -<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> -<ui:UiBinder - xmlns:ui="urn:ui:com.google.gwt.uibinder" - xmlns:g="urn:import:com.google.gwt.user.client.ui" - xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client" - xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container" - xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form" - xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button"> - - <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="verticalLayoutData"> - <ui:attributes width="1" height="-1" /> - </ui:with> - - <gxt:Window ui:field="window" pixelSize="300, 150" modal="true" headingText="Account" focusWidget="{saveButton}"> - <container:VerticalLayoutContainer> - <container:child layoutData="{verticalLayoutData}"> - <form:FieldLabel text="User"> - <form:widget> - <form:TextField ui:field="login" /> - </form:widget> - </form:FieldLabel> - </container:child> - <container:child layoutData="{verticalLayoutData}"> - <form:FieldLabel text="Password"> - <form:widget> - <form:PasswordField ui:field="password" /> - </form:widget> - </form:FieldLabel> - </container:child> - <container:child layoutData="{verticalLayoutData}"> - <form:FieldLabel text="Administrator"> - <form:widget> - <form:CheckBox ui:field="admin" enabled="false" /> - </form:widget> - </form:FieldLabel> - </container:child> - </container:VerticalLayoutContainer> - - <gxt:button> - <button:TextButton ui:field="saveButton" text="Save" /> - </gxt:button> - <gxt:button> - <button:TextButton ui:field="cancelButton" text="Cancel" /> - </gxt:button> - </gxt:Window> - -</ui:UiBinder> diff --git a/src/org/traccar/web/client/view/UserSettingsDialog.java b/src/org/traccar/web/client/view/UserSettingsDialog.java deleted file mode 100644 index be13eca8..00000000 --- a/src/org/traccar/web/client/view/UserSettingsDialog.java +++ /dev/null @@ -1,97 +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.view; - -import java.util.Arrays; - -import org.traccar.web.client.model.EnumKeyProvider; -import org.traccar.web.client.model.UserSettingsProperties; -import org.traccar.web.shared.model.UserSettings; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.editor.client.Editor; -import com.google.gwt.editor.client.SimpleBeanEditorDriver; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.ui.Widget; -import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction; -import com.sencha.gxt.data.shared.ListStore; -import com.sencha.gxt.widget.core.client.Window; -import com.sencha.gxt.widget.core.client.event.SelectEvent; -import com.sencha.gxt.widget.core.client.form.ComboBox; - -public class UserSettingsDialog implements Editor<UserSettings> { - - private static UserSettingsDialogUiBinder uiBinder = GWT.create(UserSettingsDialogUiBinder.class); - - interface UserSettingsDialogUiBinder extends UiBinder<Widget, UserSettingsDialog> { - } - - private UserSettingsDriver driver = GWT.create(UserSettingsDriver.class); - - interface UserSettingsDriver extends SimpleBeanEditorDriver<UserSettings, UserSettingsDialog> { - } - - public interface UserSettingsHandler { - public void onSave(UserSettings userSettings); - } - - private UserSettingsHandler userSettingsHandler; - - @UiField - Window window; - - @UiField(provided = true) - ComboBox<UserSettings.SpeedUnit> speedUnit; - - public UserSettingsDialog(UserSettings userSettings, UserSettingsHandler userSettingsHandler) { - this.userSettingsHandler = userSettingsHandler; - - ListStore<UserSettings.SpeedUnit> speedUnitStore = new ListStore<UserSettings.SpeedUnit>( - new EnumKeyProvider<UserSettings.SpeedUnit>()); - speedUnitStore.addAll(Arrays.asList(UserSettings.SpeedUnit.values())); - - speedUnit = new ComboBox<UserSettings.SpeedUnit>( - speedUnitStore, new UserSettingsProperties.SpeedUnitLabelProvider()); - speedUnit.setForceSelection(true); - speedUnit.setTriggerAction(TriggerAction.ALL); - - uiBinder.createAndBindUi(this); - driver.initialize(this); - driver.edit(userSettings); - } - - public void show() { - window.show(); - } - - public void hide() { - window.hide(); - } - - @UiHandler("saveButton") - public void onLoginClicked(SelectEvent event) { - window.hide(); - userSettingsHandler.onSave(driver.flush()); - } - - @UiHandler("cancelButton") - public void onRegisterClicked(SelectEvent event) { - window.hide(); - } - -} diff --git a/src/org/traccar/web/client/view/UserSettingsDialog.ui.xml b/src/org/traccar/web/client/view/UserSettingsDialog.ui.xml deleted file mode 100644 index db6c6932..00000000 --- a/src/org/traccar/web/client/view/UserSettingsDialog.ui.xml +++ /dev/null @@ -1,33 +0,0 @@ -<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> -<ui:UiBinder - xmlns:ui="urn:ui:com.google.gwt.uibinder" - xmlns:g="urn:import:com.google.gwt.user.client.ui" - xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client" - xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container" - xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form" - xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button"> - - <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="verticalLayoutData"> - <ui:attributes width="1" height="-1" /> - </ui:with> - - <gxt:Window ui:field="window" pixelSize="300, 110" modal="true" headingText="Preferences" focusWidget="{saveButton}"> - <container:VerticalLayoutContainer> - <container:child layoutData="{verticalLayoutData}"> - <form:FieldLabel text="Speed Units"> - <form:widget> - <form:ComboBox ui:field="speedUnit" /> - </form:widget> - </form:FieldLabel> - </container:child> - </container:VerticalLayoutContainer> - - <gxt:button> - <button:TextButton ui:field="saveButton" text="Save" /> - </gxt:button> - <gxt:button> - <button:TextButton ui:field="cancelButton" text="Cancel" /> - </gxt:button> - </gxt:Window> - -</ui:UiBinder> diff --git a/src/org/traccar/web/client/view/UsersDialog.java b/src/org/traccar/web/client/view/UsersDialog.java deleted file mode 100644 index 3da8979b..00000000 --- a/src/org/traccar/web/client/view/UsersDialog.java +++ /dev/null @@ -1,110 +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.view; - -import java.util.LinkedList; -import java.util.List; - -import org.traccar.web.client.model.UserProperties; -import org.traccar.web.shared.model.User; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.ui.Widget; -import com.sencha.gxt.core.client.Style.SelectionMode; -import com.sencha.gxt.data.shared.ListStore; -import com.sencha.gxt.widget.core.client.Window; -import com.sencha.gxt.widget.core.client.button.TextButton; -import com.sencha.gxt.widget.core.client.event.SelectEvent; -import com.sencha.gxt.widget.core.client.grid.ColumnConfig; -import com.sencha.gxt.widget.core.client.grid.ColumnModel; -import com.sencha.gxt.widget.core.client.grid.Grid; -import com.sencha.gxt.widget.core.client.selection.SelectionChangedEvent; - -public class UsersDialog implements SelectionChangedEvent.SelectionChangedHandler<User> { - - private static UsersDialogUiBinder uiBinder = GWT.create(UsersDialogUiBinder.class); - - interface UsersDialogUiBinder extends UiBinder<Widget, UsersDialog> { - } - - public interface UserHandler { - public void onAdd(); - public void onRemove(User user); - } - - private UserHandler userHandler; - - @UiField - Window window; - - @UiField - TextButton addButton; - - @UiField - TextButton removeButton; - - @UiField(provided = true) - ColumnModel<User> columnModel; - - @UiField(provided = true) - ListStore<User> userStore; - - @UiField - Grid<User> grid; - - public UsersDialog(ListStore<User> userStore, UserHandler userHandler) { - this.userStore = userStore; - this.userHandler = userHandler; - - UserProperties userProperties = GWT.create(UserProperties.class); - - List<ColumnConfig<User, ?>> columnConfigList = new LinkedList<ColumnConfig<User, ?>>(); - columnConfigList.add(new ColumnConfig<User, String>(userProperties.login(), 0, "Name")); - columnConfigList.add(new ColumnConfig<User, Boolean>(userProperties.admin(), 0, "Administrator")); - columnModel = new ColumnModel<User>(columnConfigList); - - uiBinder.createAndBindUi(this); - - grid.getSelectionModel().addSelectionChangedHandler(this); - grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); - } - - public void show() { - window.show(); - } - - public void hide() { - window.hide(); - } - - @Override - public void onSelectionChanged(SelectionChangedEvent<User> event) { - removeButton.setEnabled(!event.getSelection().isEmpty()); - } - @UiHandler("addButton") - public void onAddClicked(SelectEvent event) { - userHandler.onAdd(); - } - - @UiHandler("removeButton") - public void onRemoveClicked(SelectEvent event) { - userHandler.onRemove(grid.getSelectionModel().getSelectedItem()); - } - -} diff --git a/src/org/traccar/web/client/view/UsersDialog.ui.xml b/src/org/traccar/web/client/view/UsersDialog.ui.xml deleted file mode 100644 index 2110e760..00000000 --- a/src/org/traccar/web/client/view/UsersDialog.ui.xml +++ /dev/null @@ -1,50 +0,0 @@ -<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> -<ui:UiBinder - xmlns:ui="urn:ui:com.google.gwt.uibinder" - xmlns:g="urn:import:com.google.gwt.user.client.ui" - xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client" - xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container" - xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form" - xmlns:toolbar="urn:import:com.sencha.gxt.widget.core.client.toolbar" - xmlns:grid="urn:import:com.sencha.gxt.widget.core.client.grid" - xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button" - xmlns:menu="urn:import:com.sencha.gxt.widget.core.client.menu"> - - <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="toolBarRowData"> - <ui:attributes width="1" height="-1" /> - </ui:with> - <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="layoutData"> - <ui:attributes width="1" height="1" /> - </ui:with> - - <ui:with type="com.sencha.gxt.data.shared.ListStore" field="userStore" /> - <ui:with type="com.sencha.gxt.widget.core.client.grid.ColumnModel" field="columnModel" /> - - <ui:with type="com.sencha.gxt.widget.core.client.grid.GridView" field="view"> - <ui:attributes stripeRows="true" autoFill="true" /> - </ui:with> - - <gxt:Window ui:field="window" pixelSize="640, 480" modal="true" headingText="Users"> - <container:VerticalLayoutContainer> - <container:child layoutData="{layoutData}"> - <gxt:ContentPanel ui:field="contentPanel" headerVisible="false"> - <container:VerticalLayoutContainer> - - <container:child layoutData="{toolBarRowData}"> - <toolbar:ToolBar> - <button:TextButton ui:field="addButton" text="Add" /> - <button:TextButton ui:field="removeButton" text="Remove" enabled="false" /> - </toolbar:ToolBar> - </container:child> - - <container:child layoutData="{layoutData}"> - <grid:Grid ui:field="grid" store="{userStore}" cm="{columnModel}" view="{view}" /> - </container:child> - - </container:VerticalLayoutContainer> - </gxt:ContentPanel> - </container:child> - </container:VerticalLayoutContainer> - </gxt:Window> - -</ui:UiBinder> |