Search in sources :

Example 1 with MemoryProxy

use of com.extjs.gxt.ui.client.data.MemoryProxy in project kapua by eclipse.

the class UserManageForm method onRender.

protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    // 
    // Permission tab
    // 
    FormLayout permissionsLayout = new FormLayout();
    permissionsLayout.setLabelWidth(Constants.LABEL_WIDTH_FORM);
    permissionsFieldSet = new FieldSet();
    permissionsFieldSet.setBorders(false);
    permissionsFieldSet.setLayout(permissionsLayout);
    // permissions table columns
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    final CheckBoxSelectionModel<GwtUserPermission> sm = new CheckBoxSelectionModel<GwtUserPermission>();
    configs.add(sm.getColumn());
    ColumnConfig column = new ColumnConfig("accountPermission", MSGS.userPermissionsPermissionName(), 270);
    column.setAlignment(HorizontalAlignment.LEFT);
    configs.add(column);
    // Permissions table
    m_columnModel = new ColumnModel(configs);
    // 
    // Initial empty values
    List<GwtUserPermission> gwtUserPermissions = GwtUserPermission.getAllPermissions(m_accountId);
    MemoryProxy<List<GwtUserPermission>> proxy = new MemoryProxy<List<GwtUserPermission>>(gwtUserPermissions);
    ListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(proxy);
    ListStore<GwtUserPermission> permissions = new ListStore<GwtUserPermission>(loader);
    loader.load();
    // Grid
    m_permisssionGrid = new EditorGrid<GwtUserPermission>(permissions, m_columnModel);
    m_permisssionGrid.setBorders(true);
    m_permisssionGrid.setStripeRows(true);
    m_permisssionGrid.getView().setAutoFill(true);
    m_permisssionGrid.setWidth(440);
    m_permisssionGrid.setHeight(374);
    m_permisssionGrid.setAutoExpandColumn("accountPermission");
    m_permisssionGrid.setSelectionModel(sm);
    m_permisssionGrid.addPlugin(sm);
    LabelField permissionsField = new LabelField();
    permissionsField.setFieldLabel(MSGS.userFormPermissions());
    permissionsFieldSet.add(permissionsField, formData);
    permissionsFieldSet.add(m_permisssionGrid, formData);
    m_tabUserPermission = new TabItem(MSGS.userFormAccess());
    m_tabUserPermission.setBorders(false);
    m_tabUserPermission.setStyleAttribute("background-color", "#E8E8E8");
    m_tabUserPermission.setScrollMode(Scroll.AUTOY);
    m_tabUserPermission.add(permissionsFieldSet);
    m_tabUserPermission.setLayout(new FitLayout());
    m_tabsPanel.add(m_tabUserPermission);
    add(m_formPanel);
}
Also used : FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) ModelData(com.extjs.gxt.ui.client.data.ModelData) GwtUserPermission(org.eclipse.kapua.app.console.shared.model.GwtUserPermission) CheckBoxSelectionModel(com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel) ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig) ArrayList(java.util.ArrayList) MemoryProxy(com.extjs.gxt.ui.client.data.MemoryProxy) BaseListLoader(com.extjs.gxt.ui.client.data.BaseListLoader) ListLoadResult(com.extjs.gxt.ui.client.data.ListLoadResult) ListStore(com.extjs.gxt.ui.client.store.ListStore) TabItem(com.extjs.gxt.ui.client.widget.TabItem) FieldSet(com.extjs.gxt.ui.client.widget.form.FieldSet) ArrayList(java.util.ArrayList) List(java.util.List) ColumnModel(com.extjs.gxt.ui.client.widget.grid.ColumnModel) LabelField(com.extjs.gxt.ui.client.widget.form.LabelField) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Aggregations

BaseListLoader (com.extjs.gxt.ui.client.data.BaseListLoader)1 ListLoadResult (com.extjs.gxt.ui.client.data.ListLoadResult)1 MemoryProxy (com.extjs.gxt.ui.client.data.MemoryProxy)1 ModelData (com.extjs.gxt.ui.client.data.ModelData)1 ListStore (com.extjs.gxt.ui.client.store.ListStore)1 TabItem (com.extjs.gxt.ui.client.widget.TabItem)1 FieldSet (com.extjs.gxt.ui.client.widget.form.FieldSet)1 LabelField (com.extjs.gxt.ui.client.widget.form.LabelField)1 CheckBoxSelectionModel (com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel)1 ColumnConfig (com.extjs.gxt.ui.client.widget.grid.ColumnConfig)1 ColumnModel (com.extjs.gxt.ui.client.widget.grid.ColumnModel)1 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)1 FormLayout (com.extjs.gxt.ui.client.widget.layout.FormLayout)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 GwtUserPermission (org.eclipse.kapua.app.console.shared.model.GwtUserPermission)1