SmartGWT - 无法更改配置属性“x”组件创建后

发布于 2024-12-21 12:15:03 字数 1636 浏览 2 评论 0原文

在此示例中 http://www.smartclient.com/smartgwt/showcase/#tree_databinding_local ,我开始动态实现自己的树结构(TreeGrid)。当我尝试渲染它时,出现此错误(标题)。

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));
      }
    });

  }

}

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));
      }
    });

  }

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

昨迟人 2024-12-28 12:15:03

“x”是什么意思?通常,如果组件已在窗口上绘制(隐式或显式调用绘制),则无法更改其属性值。因此,唯一可能的解决方案是在每次更改时使用新的 X 值重新创建对象。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文