简体   繁体   中英

Vaadin Designer Not an Editable Custom Component

New to using Vaadin and I wanted to use the designer to modify the default page given when creating a vaadin project.

However I keep getting this error: 'Could not open design view: Failed to parse visually editable class caused by Not an editable CustomComponent'

The code is as follows:

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

}

I think I have the xulrunner installed correctly as I'm not getting this error when I start up eclipse.

Any help appreciated.

I haven't seen it explicitly stated anywhere yet, but I'm 90% sure the editor works with descendants of com.vaadin.ui.CustomComponent . Thus, my suggestion is to create a new CustomComponent/Vaadin Composite as described here , edit it visually and add an instance of it to your UI.

PS If you go and do some manual changes and still want to keep it editor-parseable, you should pay attention to at least the following (from what I can recall now):

  • @Autogenerated fields and methods
  • alignments it generates as new Alignment(34) instead of Alignment.MIDDLE_RIGHT
  • labels `ContentMode.HTML (not 100% sure but I remember setting these in the constructors instead of the autogenerated methods)

Seems there was an issue with the Service pack of eclipse I was using. Took me a while to get redirected to the page after googling for ages that told me this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM