Hi all!
I’m still new to Vaadin and Java web development, so please forgive my ignorance…
I have two Vaadin projects side by side in Eclipse, and both run and compile fine on my Tomcat server. Now I would like to use the main UI of one project in a layout of the other project … How do I do that? Simply adjusting the project path isn’t enough - that way the classes are known only at design time, but not at runtime…
Thanks for any hints!
Cheers,
CJ
Thanks for your answer!
-
is out of question - since my second project needs authentication from my first project - if I need to deploy it as a standalone web app, I would need to reimplement the authentication also for the second web app.
-
This was also my thought - what I was trying to do is export my second project as a .jar and put it in the WEB-INF/lib of my first project … however I might have missed something - how would I then use the second project’s main class (extended from UI, let’s call it SecondMainUI) in my first project?
SecondMainUI smain = new SecondMainUI();
firstproject.addComponent(smain);
won’t work, I guess - and also by default the init function of SecondMainUI is protected …
Any ideas?
Thanks al lot,
Christian
Got it working!
What I did was write a function in my second project that encapsulates the init function and returns the layout as an output parameter. I can then add this layout to my main project. Here is the code (VaadinShellUI is the second project, TorrentmanagerUI is the main project, and I have a .jar with VaadinShellUI included in the web-inf/lib folder of TorrentmanagerUI):
VaadinShellUI vaadinShell = new VaadinShellUI();
vaadinShell.setSession(((TorrentmanagerUI) UI.getCurrent())
.getSession());
VerticalLayout vaadinShellLayout = vaadinShell.extInit();
verticalSplitPanel.addComponent(vaadinShellLayout);
Still open to suggestions if someone has a more elegant solution!
Cheers,
CJ