theme's custom layouts inheritance


I have two themes: A and B.
Theme A contains a few CustomLayouts.
I want to use this custom layouts when application is using theme B. Is it possible ? Maybe there is way to make custom layouts not assigned to any of theme - so they could be used by any of them? Style inheritance is possible, but I have not found any information about layouts inheritance.

Thanks a lot for any help.

I found a workaround for this problem. But now I am testing it.

I am calling CustomLayout.setTemplateName(String templateName) method with parameter “…/…/layouts-common/CustomComp” and the vaadin is looking for my CustomComp at localization VAADIN/themes/layouts-common/CustomComp.html

I will write here when I will test it. But if any of you know better solution, feel free to comment, please.

it works. I create base class for my “common” custom layouts and it looks like this below:

public class AbstractCommonCustomLayout extends CustomLayout
public static final String LAYOUTS_COMMON_DIRECTORY_NAME = “layouts-common”;

public AbstractCommonCustomLayout()
	String templateName = getClass().getSimpleName();
	setTemplateName("../../" + AbstractCommonCustomLayout.LAYOUTS_COMMON_DIRECTORY_NAME + "/" + templateName);


but if you have better solution (maybe there is something out of the box) - give me some feedback, please.

One solution is to read templates using an InputStream. You can read it from a file if you like.

an example
for reading a template from a string through an InputStream.