【问题标题】:Vaadin Designer Not an Editable Custom ComponentVaadin Designer 不是可编辑的自定义组件
【发布时间】:2015-06-18 00:24:00
【问题描述】:

刚开始使用 Vaadin,我想使用设计器来修改创建 vaadin 项目时给出的默认页面。

但是我不断收到此错误:“无法打开设计视图:无法解析由 Not an editable CustomComponent 引起的可视可编辑类”

代码如下:

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@SuppressWarnings("serial")
@Theme("timekeeper")
public class TimekeeperUI extends UI {

    VerticalLayout layout = new VerticalLayout();

    @WebServlet(value = "/*", asyncSupported = true)
    @VaadinServletConfiguration(productionMode = false, ui = TimekeeperUI.class)
    public static class Servlet extends VaadinServlet {
    }

    @Override
    protected void init(VaadinRequest request) {
        layout.setMargin(true);
        setContent(layout);
    }

}

我认为我已正确安装了 xulrunner,因为我在启动 eclipse 时没有收到此错误。

任何帮助表示赞赏。

【问题讨论】:

    标签: java web ide vaadin designer


    【解决方案1】:

    我还没有看到它在任何地方明确说明,但我 90% 确定 the editor 可以与 com.vaadin.ui.CustomComponent 的后代一起使用。因此,我的建议是创建一个新的 CustomComponent/Vaadin Composite,如 here 所述,对其进行可视化编辑并将其实例添加到您的 UI。

    附:如果您进行了一些手动更改,但仍希望保持编辑器可解析,您应该至少注意以下几点(据我现在回忆):

    • @Autogenerated 字段和方法
    • 它生成为new Alignment(34) 而不是Alignment.MIDDLE_RIGHT 的对齐方式
    • labels `ContentMode.HTML(不是 100% 确定,但我记得在构造函数中设置这些而不是自动生成的方法)

    【讨论】:

      【解决方案2】:

      我使用的 Eclipse 服务包似乎存在问题。在谷歌搜索了很久告诉我这一点后,我花了一段时间才被重定向到页面。

      【讨论】:

      • 您能否分享更多有关您的问题的解决方案的详细信息?这将在未来对其他人有所帮助。
      • 解决方案不多,我不得不去下载更新版本的服务包。我使用的是 Luna SR1,所以我下载了 SR2,然后重新设置了我的环境
      猜你喜欢
      • 1970-01-01
      • 2021-11-01
      • 2019-05-24
      • 2011-12-04
      • 1970-01-01
      • 2015-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多