diff options
Diffstat (limited to 'src/org/traccar/web/client/view')
-rw-r--r-- | src/org/traccar/web/client/view/DeviceView.java | 34 | ||||
-rw-r--r-- | src/org/traccar/web/client/view/DeviceView.ui.xml | 14 |
2 files changed, 45 insertions, 3 deletions
diff --git a/src/org/traccar/web/client/view/DeviceView.java b/src/org/traccar/web/client/view/DeviceView.java index c3f3f7a3..8a0b6243 100644 --- a/src/org/traccar/web/client/view/DeviceView.java +++ b/src/org/traccar/web/client/view/DeviceView.java @@ -24,6 +24,7 @@ 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; @@ -37,6 +38,7 @@ 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.selection.SelectionChangedEvent; public class DeviceView implements SelectionChangedEvent.SelectionChangedHandler<Device> { @@ -80,8 +82,9 @@ public class DeviceView implements SelectionChangedEvent.SelectionChangedHandler @UiField Grid<Device> grid; - public DeviceView(DeviceHandler deviceHandler, ListStore<Device> deviceStore) { + public DeviceView(DeviceHandler deviceHandler, SettingsHandler settingsHandler, ListStore<Device> deviceStore) { this.deviceHandler = deviceHandler; + this.settingsHandler = settingsHandler; this.deviceStore = deviceStore; DeviceProperties deviceProperties = GWT.create(DeviceProperties.class); @@ -138,4 +141,33 @@ public class DeviceView implements SelectionChangedEvent.SelectionChangedHandler grid.getSelectionModel().select(deviceStore.findModel(device), false); } + public interface SettingsHandler { + public void onAccountSelected(); + public void onPreferencesSelected(); + public void onUsersSelected(); + public void onGlobalSelected(); + } + + private SettingsHandler settingsHandler; + + @UiHandler("settingsAccount") + public void onSettingsAccountSelected(SelectionEvent<Item> event) { + settingsHandler.onAccountSelected(); + } + + @UiHandler("preferencesAccount") + public void onSettingsPreferencesSelected(SelectionEvent<Item> event) { + settingsHandler.onPreferencesSelected(); + } + + @UiHandler("usersAccount") + public void onSettingsUsersSelected(SelectionEvent<Item> event) { + settingsHandler.onUsersSelected(); + } + + @UiHandler("globalAccount") + public void onSettingsGlobalSelected(SelectionEvent<Item> event) { + settingsHandler.onGlobalSelected(); + } + } diff --git a/src/org/traccar/web/client/view/DeviceView.ui.xml b/src/org/traccar/web/client/view/DeviceView.ui.xml index 77de651e..f612957d 100644 --- a/src/org/traccar/web/client/view/DeviceView.ui.xml +++ b/src/org/traccar/web/client/view/DeviceView.ui.xml @@ -6,7 +6,8 @@ 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: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" /> @@ -32,7 +33,16 @@ <button:TextButton ui:field="removeButton" text="Remove" enabled="false" /> <toolbar:FillToolItem /> <toolbar:SeparatorToolItem /> - <button:TextButton ui:field="settingsButton" text="Settings" enabled="false" /> + <button:TextButton ui:field="settingsButton" text="Settings"> + <button:menu> + <menu:Menu> + <menu:MenuItem text="Account" ui:field="settingsAccount" /> + <menu:MenuItem text="Preferences" ui:field="preferencesAccount" /> + <menu:MenuItem text="Users" ui:field="usersAccount" /> + <menu:MenuItem text="Global" ui:field="globalAccount" /> + </menu:Menu> + </button:menu> + </button:TextButton> <button:TextButton ui:field="logoutButton" text="Logout" /> </toolbar:ToolBar> </container:child> |