diff options
Diffstat (limited to 'src/org/traccar/web/client/view/StateView.java')
-rw-r--r-- | src/org/traccar/web/client/view/StateView.java | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/org/traccar/web/client/view/StateView.java b/src/org/traccar/web/client/view/StateView.java new file mode 100644 index 00000000..700d55a6 --- /dev/null +++ b/src/org/traccar/web/client/view/StateView.java @@ -0,0 +1,58 @@ +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); + } + +} + |