コード例 #1
0
  public AddressbookTree() {
    super();
    SectionStackSection section = new SectionStackSection();
    section.setCanCollapse(false);
    section.setExpanded(true);
    section.setResizeable(true);

    TreeGrid tree = new TreeGrid();
    tree.setWidth100();
    tree.setHeight100();
    tree.setAnimateFolderTime(100);
    tree.setAnimateFolders(true);
    tree.setAnimateFolderSpeed(1000);
    tree.setShowSortArrow(SortArrow.CORNER);
    tree.setShowAllRecords(true);
    tree.setLoadDataOnDemand(false);
    tree.setCanSort(false);
    tree.setCellHeight(17);
    tree.setShowHeader(false);

    TreeGridField field = new TreeGridField();
    field.setCanFilter(true);
    field.setName("name");
    field.setTitle("<b>SmartGWT Showcase</b>");
    tree.setFields(field);

    Tree treeData = new Tree();
    treeData.setModelType(TreeModelType.PARENT);
    treeData.setNameProperty("name");
    treeData.setOpenProperty("isOpen");
    treeData.setIdField("nodeID");
    treeData.setParentIdField("parentNodeID");
    treeData.setRootValue("root");
    treeData.setData(DemoData.getAddressBookTreeData());

    tree.setData(treeData);
    section.setItems(tree);

    setSections(section);
  }
コード例 #2
0
  @Override
  protected void onDraw() {
    super.onDraw();

    final TreeGrid treeGrid = new CustomResourceTypeTreeGrid();

    treeGrid.setHeight100();

    treeGrid.setTitle(MSG.view_type_resourceTypes());
    treeGrid.setAnimateFolders(false);
    treeGrid.setResizeFieldsInRealTime(true);

    final TreeGridField name, plugin, category;
    name = new TreeGridField("name");
    plugin = new TreeGridField("plugin");
    category = new TreeGridField("category");

    treeGrid.setFields(name, plugin, category);

    addMember(treeGrid);

    ResourceTypeCriteria criteria = new ResourceTypeCriteria();
    criteria.addFilterIgnored((showIgnoredResourceTypes ? (Boolean) null : Boolean.FALSE));
    criteria.fetchParentResourceTypes(true);
    criteria.setPageControl(PageControl.getUnlimitedInstance());

    resourceTypeService.findResourceTypesByCriteria(
        criteria,
        new AsyncCallback<PageList<ResourceType>>() {
          public void onFailure(Throwable caught) {
            CoreGUI.getErrorHandler().handleError(MSG.widget_typeTree_loadFail(), caught);
          }

          public void onSuccess(PageList<ResourceType> result) {

            treeGrid.getTree().linkNodes(ResourceTypePluginTreeDataSource.buildNodes(result));
          }
        });
  }