java Vaadin Designer不是可编辑的自定义组件
不熟悉使用Vaadin,我想使用designer修改创建Vaadin项目时给出的默认页面
然而,我经常遇到这样的错误:“无法打开设计视图:由于没有可编辑的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时没有遇到这个错误
感谢您的帮助
# 1 楼答案
我还没有在任何地方看到它的明确表述,但我90%确定the editor与
com.vaadin.ui.CustomComponent
的后代一起工作。因此,我的建议是创建一个新的CustomComponent/Vaadin组合,如here所述,对其进行可视化编辑,并将其实例添加到UI中另外,如果你去做一些手动更改,但仍然想让编辑器保持可解析性,你应该至少注意以下几点(从我现在的记忆中):
@Autogenerated
字段和方法new Alignment(34)
,而不是Alignment.MIDDLE_RIGHT
# 2 楼答案
我使用的eclipse服务包似乎有问题。在谷歌搜索了很久之后,我花了一段时间才被重定向到这个页面