Question

From this example http://www.smartclient.com/smartgwt/showcase/#tree_databinding_local , I started to implement my own tree structure dynamically (TreeGrid). When I try to render it, I get this error (title).

public class ProjectTreeGridScreen extends Screen {

  Tree tree;

  @Override
  protected void onLoad() {
    super.onLoad();

    TreeGrid treeGrid = new TreeGrid();

    setPageTitle(Util.C.projectListTitle());

    treeGrid.setWidth(600);
    treeGrid.setHeight(400);

    TreeGridField projectTree = new TreeGridField("ProjectName", "Project Tree");
    TreeGridField projectPath = new TreeGridField("ProjectPath", "Complete path");
    TreeGridField projectDescription = new TreeGridField("ProjectDescription", "Description");
    TreeGridField projectInfo = new TreeGridField("ProjectInfo", "Information");

    treeGrid.setFields(projectTree, projectPath, projectDescription, projectInfo);

    treeGrid.setData(tree);

    add(treeGrid);

  }

  @Override
  protected void onInitUI() {
    super.onInitUI();
    tree = new Tree();

    tree.setModelType(TreeModelType.PARENT);
    tree.setNameProperty("ProjectName");
    tree.setIdField("ProjectItem");
    tree.setParentIdField("ProjectParent");

    tree.setShowRoot(true);

    populateProjects();

  }

  protected void populateProjects() {

    Util.PROJECT_SVC.visibleProjects(
        new ScreenLoadCallback<List<Project>>(this) {
      @Override
      public void preDisplay(final List<Project> result) {
        tree.setData(ProjectTreeGridBuilder.fromRepositories(result));
      }
    });

  }

}
Was it helpful?

Solution

what do you mean by "x"? Normally, If a component has been drawn on the window (implicit or explicit call to draw), you cannot change it's properties values. So the only possible solution is to recreate the object with the new X value each time it is changing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top