Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd CustomComponent in Window?
    text
    copied!<p>I created a CustomComponent and I wanna add this CustomComponent in a WindowTemplate created. I solved create a WindowTemplate for all Window of my project, but I still can not add CustomComponent in template window.</p> <p>I'm trying this.</p> <pre><code>/** WindowTemplate for all Window configs app */ 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")); HorizontalLayout hLayout = new HorizontalLayout(); hLayout.addComponent(cc); setContent(hLayout); center(); } } /** my customcomponent */ public class CadCur extends CustomComponent { private AbsoluteLayout mainLayout; private TextField email; public CadCur() { buildMainLayout(); setCompositionRoot(mainLayout); } @AutoGenerated private AbsoluteLayout buildMainLayout() { 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; } </code></pre> <p>}</p> <pre><code>/** a UI class */ public class PrincipalUI extends UI{ @Override protected void init(VaadinRequest request) { getCurrent().addWindow(new WindowTemplate("MyWindow", new CadCur()); } } </code></pre> <p>How to do this ?</p> <p>thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload