Search in sources :

Example 1 with TreeStore

use of com.extjs.gxt.ui.client.store.TreeStore in project activityinfo by bedatadriven.

the class TargetIndicatorView method createGridAndAddToContainer.

@Override
protected Grid<ModelData> createGridAndAddToContainer(Store store) {
    final TreeStore treeStore = (TreeStore) store;
    tree = new EditorTreeGrid<ModelData>(treeStore, createColumnModel());
    tree.setAutoExpandColumn("name");
    tree.setSelectionModel(new ImprovedCellTreeGridSelectionModel<ModelData>());
    tree.setClicksToEdit(EditorGrid.ClicksToEdit.ONE);
    tree.setLoadMask(true);
    tree.setStateId("TargetValueGrid" + db.getId());
    tree.setStateful(true);
    tree.setIconProvider(new ModelIconProvider<ModelData>() {

        @Override
        public AbstractImagePrototype getIcon(ModelData model) {
            if (model instanceof IsActivityDTO) {
                return IconImageBundle.ICONS.activity();
            } else if (model instanceof TargetValueDTO) {
                return IconImageBundle.ICONS.indicator();
            } else if (model instanceof Link) {
                return IconImageBundle.ICONS.folder();
            } else {
                return null;
            }
        }
    });
    addBeforeEditListener();
    addAfterEditListener();
    add(tree, new BorderLayoutData(Style.LayoutRegion.CENTER));
    return tree;
}
Also used : AbstractImagePrototype(com.google.gwt.user.client.ui.AbstractImagePrototype) ModelData(com.extjs.gxt.ui.client.data.ModelData) TreeStore(com.extjs.gxt.ui.client.store.TreeStore) BorderLayoutData(com.extjs.gxt.ui.client.widget.layout.BorderLayoutData) Link(org.activityinfo.ui.client.page.common.nav.Link)

Example 2 with TreeStore

use of com.extjs.gxt.ui.client.store.TreeStore in project activityinfo by bedatadriven.

the class SiteAdminTreeLoaderTest method load.

@Test
public void load() {
    DispatcherStub dispatcher = new DispatcherStub();
    dispatcher.setResult(new GetSchema(), DTOs.PEAR.SCHEMA);
    dispatcher.setResult(new GetAdminEntities(1), DTOs.PROVINCES);
    SiteAdminTreeLoader loader = new SiteAdminTreeLoader(dispatcher, new AdminGroupingModel(1));
    new TreeStore<ModelData>(loader);
    loader.load();
}
Also used : AdminGroupingModel(org.activityinfo.ui.client.page.entry.grouping.AdminGroupingModel) TreeStore(com.extjs.gxt.ui.client.store.TreeStore) DispatcherStub(org.activityinfo.ui.client.dispatch.DispatcherStub) GetAdminEntities(org.activityinfo.legacy.shared.command.GetAdminEntities) GetSchema(org.activityinfo.legacy.shared.command.GetSchema) Test(org.junit.Test)

Aggregations

TreeStore (com.extjs.gxt.ui.client.store.TreeStore)2 ModelData (com.extjs.gxt.ui.client.data.ModelData)1 BorderLayoutData (com.extjs.gxt.ui.client.widget.layout.BorderLayoutData)1 AbstractImagePrototype (com.google.gwt.user.client.ui.AbstractImagePrototype)1 GetAdminEntities (org.activityinfo.legacy.shared.command.GetAdminEntities)1 GetSchema (org.activityinfo.legacy.shared.command.GetSchema)1 DispatcherStub (org.activityinfo.ui.client.dispatch.DispatcherStub)1 Link (org.activityinfo.ui.client.page.common.nav.Link)1 AdminGroupingModel (org.activityinfo.ui.client.page.entry.grouping.AdminGroupingModel)1 Test (org.junit.Test)1