I have problem with subj layout. This is error in my browser, when I`m start my project:
“Layout file layouts/customlayout.html is missing. Components will be drawn for debug purposes.”
Path to my .html file \WebContent\VAADIN\themes\reindeer\layouts\customlayout.html
You should use a custom theme with a different name than “reindeer” and add the custom layout html to that theme. If you use “reindeer” chances are that you serve the theme from the JAR through the servlet where there is no “customlayout.html”
I`m use usual (folder in \WebContent\VAADIN\themes with subfolder layouts where lay my customlayouts.html).
Result is identical . Using theme “reindeer” is my experiment.
Window mainWindow = new Window("MyApplication");
CustomLayout layout = new CustomLayout("customlayout");
TextField user = new TextField();
layout.addComponent(user, "user");
setTheme("my");
mainWindow.addComponent(layout);
setMainWindow(mainWindow);
Path to my customlayout.html “\WebContent\VAADIN\themes\my\layouts”
Is it true? Also this is not worked: “Layouts file is missing”.
Try to set the theme before to create your CustomLayout:
setTheme("my");
Window mainWindow = new Window("MyApplication");
CustomLayout layout = new CustomLayout("customlayout");
TextField user = new TextField();
layout.addComponent(user, "user");
mainWindow.addComponent(layout);
setMainWindow(mainWindow);
The HTML file is available with the full URL, but not rendered by Vaadin.
Looking at the com.vaadin.terminal.gwt.server.AbstractCommunicationManager, the following code on line 1084 shows that there’s something to be implemented… (Vaadin 6.5.4)
I don’t quite know what the “Handle exception” refers to, but it should not be a problem, it probably refers to more proper reporting in error situation. CustomLayouts works OK as you can see
in the Sampler and
in the live Book examples .
You probably have some path or name problem. Remember that you should not normally give any path to the CustomLayout constructor, just the template name, without the “.html” suffix.
I can access the html file through the browser without any issues. Might the issue be related to the fact that I use a Maven project layout rather than a standard VAADIN directory structure?
My
myLayout.html file is located at
./target/client-1.0-SNAPSHOT/WEB-INF/classes/VAADIN/themes/mytheme/layouts/myLayout.html .
The
styles.css file located at ./target/client-1.0-SNAPSHOT/WEB-INF/classes/VAADIN/themes/mytheme/styles.css works fine.
Is there any hard-coded path to WebContent or similar?! Can’t think of any other issue right now…
Yes, it could have something to do with the project structure or something. The VAADIN directory shouldn’t be in the classes directory, as it’s not loaded by the class loader, but in the root directory of the WAR. That should also be the case in Maven.
Actually, you
shouldn’t be able to access any files under the WEB-INF with browser, as the directory is a special one that is blocked from viewing.
You can see
this Maven project , which has a
templates located here . When I compile it to a WAR, the WAR will have the template file in “VAADIN/themes/sampler/layouts/examplecustomlayout.html” under its root directory.
In your case, it should be compiled to ./target/client-1.0-SNAPSHOT/VAADIN/themes/mytheme/layouts/myLayout.html.
The “WebContent” in Eclipse is simply the root directory of the packaged WAR.
There we go! Refactored my project structure according to the link you posted and it works now. Also, the HTML is no longer accessible, as you pointed out.
Use this folder structure… (I am using it in eclipse)
[Your Project name]
/[WebContent]
/VAADIN/themes/sampler/layouts/[your layout without .html extension]
For Maven, src/main/webapp corresponds to WebContent in Eclipse.
The ticket mentioned above should be fixed at some point, but is only an issue if the custom layouts come from a separate sub-project than the project using them and are packaged separately.
Since I migrated to Vaadin 7, I also have problems with
CustomLayout s. I’m not sure it’s exactly the problem described here, but it seems related to it.
I use a
CustomLayout with the template name “host”, and put the corresponding HTML file in
VAADIN/themes//layouts/host.html .
Worked well as long as this file was loadable by my custom layout class, but it broke when I removed the theme from my application project and packaged it into a separated bundle (with the error message mentionned in the first post).
What I don’t understand is that the client-side application doesn’t even try to load this file (I was expecting to see a failed request to this file in firebug, with a 404 error or something).
Anyway I checked and this
host.html file
is accessible through a web browser.
Am I wrong to believe that when using a template name, the HTML file is directly loaded by the client?
If I am wrong, does that mean theme resources cannot be removed from the application (and for example, served statically)?