public FileSystemTemplateStore(String[] templatesPath) { this.templatesPath = Templates.withDefaultPath(templatesPath); }
public static Template compile(String source) { return compile(source, Object.class); }
public static String[] templatesPath() { return Templates.getPath(); }
@Override public void cleanUp() { Templates.reset(); }
public static Template load(String filename) { return load(filename, Object.class); }
@Override public void restartApp() { Templates.reset(); }
public static Template load(String filename) { return load(filename, Object.class); }
@Override public byte[] load(String resourceName) { String[] path = Templates.withDefaultPath(templatesPath); return Res.from(resourceName, path).getBytesOrNull(); }
public void renderContentTemplates(Map<String, Object> model) { for (PageMenuItem item : items) { if (item.getCaption().contains("{")) { item.setCaption(Templates.compile(item.getCaption()).render(model)); } if (item.getSubmenu() != null) { for (PageSubMenuItem subItem : item.getSubmenu().getItems()) { subItem.setCaption(Templates.compile(subItem.getCaption()).render(model)); } } } } }
private static void resetAppStateBeforeRestart() { App.path = null; App.boot = null; App.status = AppStatus.NOT_STARTED; App.dirty = false; Groups.reset(); Conf.reset(); Env.reset(); Res.reset(); Templates.reset(); JSON.reset(); Beany.reset(); AppStarter.reset(); AppBootstrap.reset(); ClasspathScanner.reset(); invoked.clear(); SetupUtil.reloadAll(); Conf.reset(); // reset the config again Setup.initDefaults(); // this changes the config Conf.reset(); // reset the config again }
public static String[] templatesPath() { return Templates.getPath(); }
public FileSystemTemplateStore(String[] templatesPath) { this.templatesPath = Templates.withDefaultPath(templatesPath); }
public static Template compile(String source) { return compile(source, Object.class); }
@Override public byte[] load(String resourceName) throws Exception { String[] path = Templates.withDefaultPath(templatesPath); return Res.from(resourceName, path).getBytesOrNull(); }