I am trying to use the CustomLayout in a liferay portlet that I am developing. My code looks something like this…
CustomLayout customLayout = new CustomLayout("summary");
mainWindow.addComponent(customLayout);
I get the following error message.
Layout file layouts/summary.html is missing. Components will be drawn for debug purposes.
Where exactly do I put this layout file? I put them in my VAADIN/themes/[my theme]
/layouts folder. Still does not find the file. I also tried the default, runo and liferay theme locations. Still got the same error.
Assuming your theme and resources from it (such as icons) work, the correct location should in your case be VAADIN/themes/[my theme]
/layouts/summary.html . Most of the mechanism for loading it is shared with that of loading theme resources, so first check if loading other resources (on the client side) from the theme works.
If you cannot get the layout loading to work otherwise, try if loading the template contents on the server and setting the template contents helps - use CustomLayout.setTemplateContents(String) instead of giving a file name.
Which Vaadin version are you using?
Are you using portlet 2.0 with the VAADIN directory copied on the portal and the related settings in portal-ext.properties?
I think loading templates from theme directory may be bit problematic in portal environments. I’d suggest to keep templates next to your java classes and loading them like this:
new CustomLayout(getClass().getResourceAsStream(TEMPLATE_NAME));
Event if not working with portlets, saving them close to the java classes that use them if often much more comfortable. If you have a separate graphic designer who works at the html level this might not be an optimal and you might want to deny his/her access to source folders. Otherwise you’ll find the templates easiest if you locate them next to your java files.