Hello
Iam using Vaadin 7 with CDI. Everything worked perfectly until I wanted to use other UI class in my project for dynamic document generation.
@CDIUI(value = "PrintUI")
public static class PrintUI extends UI {
@EJB
MyBean myBean;
@Override protected void init(VaadinRequest request) {
setContent(new Label(myBean.getHTMLContent(), ContentMode.HTML)); //myBean throws NPE
}
}
//method somewhere in the main UI class custom component
void printOpenedPage ()
{ // Create an opener extension
BrowserWindowOpener opener = new BrowserWindowOpener(PrintUI.class);
opener.setFeatures("height=200,width=400,resizable");
// A button to open the printer-friendly page.
Button print = new Button("Click to Print");
opener.extend(print);
}
My problem is that when I open the window I always get NPE because MyBean object in’t injected. I tried to use @Inject and @EJB. Also tried to inject a local interface of the class, but no luck. Is it possible to access Stateless ejb objects in UI class that is opened trough BrowserWindowOpener class?
Thanks in advance