Hello
I’ve a create a template of Window for my application and now I create a CustomComponent using Visual Designer.
I want to add my CustomComponent on Window but does not work.
I’m trying this.
/** Window template */
public class WindowTemplate extends Window{
public WindowTemplate(String title, CustomComponent cc){
super(title);
setSizeUndefined();
setModal(true);
setClosable(false);
setDraggable(false);
setResizable(false);
setIcon(new ThemeResource("../icons/ibg_icon.png"));
setContent(cc);
center();
}
}
/** CustomComponent */
public class CadCur extends CustomComponent {
@AutoGenerated
private TextField email;
public CadCur() {
buildMainLayout();
setCompositionRoot(mainLayout);
}
@AutoGenerated
private AbsoluteLayout buildMainLayout() {
// common part: create layout
mainLayout = new AbsoluteLayout();
mainLayout.setImmediate(false);
mainLayout.setWidth("100%");
mainLayout.setHeight("100%");
// top-level component properties
setWidth("100.0%");
setHeight("100.0%");
// email
email = new TextField();
email.setCaption("Email");
email.setImmediate(false);
email.setWidth("50.0%");
email.setHeight("-1px");
email.setRequired(true);
mainLayout.addComponent(email, "top:96.0px;left:43.0px;");
return mainLayout;
}
}
/** UI */
public class PrincipalUI extends UI {
@Override
protected void init(VaadinRequest request) {
getCurrent().addWindow(new WindowTemplate("MyWindow", new CadCur()));
}
}
How to do this, any idea ?
thanks