Using the above pattern, you can implement a ScreenFactory using implemented api:
public static <T extends UiModel> T create(Models model, UiContainer uiContainer) {
if (!isInitialized(uiContainer)) throw new MdxException("ScreenFactory not initialized!");
if (isCached(model)) return (T) uiCache.get(model);
if (model != null) {
T container = (T) uiLoader.load(model.getLayout(), model.getInstance(), uiContainer);
uiCache.put(model, container);
Container modelContainer = container.getContainer();
modelContainer.setWidthToWidthOf(uiContainer);
modelContainer.setHeightToHeightOf(uiContainer);
return container;
}
return null;
}