public DynamicTagCreator() { loader = new FileTemplateLoader(); }
public TemplateFactory newTemplateFactory(File file, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { return newTemplateFactory(file, DefaultEncoding, null, expressionLanguage); }
public TemplateDocument parseTemplate(File file, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { return parseTemplate(file, DefaultEncoding, expressionLanguage); }
FileTemplateLoader loader = new FileTemplateLoader(); TemplateFactory templateFactory = loader.parseAndCreateTemplateFactory(template, Expressions.cambridgeExpressionLanguage);
public TemplateFactory newTemplateFactory(File file, String encoding, TemplateModifier modifier, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { TemplateDocument document = parseTemplate(file, encoding, expressionLanguage); if (modifier != null) { modifier.modifyTemplate(document); } try { if (document.getIncludes() != null) { return new FileTemplateFactory(this, document.normalize(), file, encoding, modifier, getFiles(document.getIncludes()), changeDetectionInterval); } return new FileTemplateFactory(this, document.normalize(), file, encoding, modifier, null, changeDetectionInterval); } catch (BehaviorInstantiationException e) { throw new TemplateLoadingException(e); } }
TemplateDocument doc = l.parseTemplate(templateFile, encoding, expressionLanguage); if (modifier != null) includes = l.getFiles(doc.getIncludes());
public TemplateFactory newTemplateFactory(File file, String encoding, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { return newTemplateFactory(file, encoding, null, expressionLanguage); }
public TemplateDocument parseTemplate(String templateFile, String encoding, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { return parseTemplate(new File(templateFile), encoding, expressionLanguage); } }
public TemplateFactory newTemplateFactory(File file, TemplateModifier modifier, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { return newTemplateFactory(file, DefaultEncoding, modifier, expressionLanguage); }
public TemplateDocument parseTemplate(String templateFile, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { return parseTemplate(new File(templateFile), expressionLanguage); }
public TemplateFactory newTemplateFactory(String template, TemplateModifier modifier, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { return newTemplateFactory(new File(template), modifier, expressionLanguage); }
public TemplateDocument parseTemplate(File file, String encoding, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { try { return parseTemplate(new FileInputStream(file), encoding, expressionLanguage); } catch (FileNotFoundException e) { throw new TemplateLoadingException(e); } }
public TemplateFactory newTemplateFactory(String template, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { return newTemplateFactory(new File(template), expressionLanguage); }
/** * Parses the template reading from the provided input stream and generates an instance of the TagNode * class that gets passed in. The html elements defined in the template file becomes inner elements * of the created TagNode. It then returns the TagNode object that gets created. * * @param in InputStream to read the template from. * @param cl The TagNode implementation class. * @return Returns the newly created tag node object which contains the template contents. * @throws TemplateLoadingException Might be thrown if there is a problem in parsing the provided template. */ public <T extends TagNode> T createTag(InputStream in, Class<T> cl, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { TemplateDocument doc = loader.parseTemplate(in, expressionLanguage); ArrayList<TemplateNode> nodes = doc.getChildren(); try { T tag = cl.newInstance(); tag.addChildren(nodes); return tag; } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return null; }
public TemplateFactory newTemplateFactory(String template, String encoding, TemplateModifier modifier, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { return newTemplateFactory(new File(template), encoding, modifier, expressionLanguage); }
/** * Parses the template reading from the provided template file and generates an instance of the TagNode * class that gets passed in. The html elements defined in the template file becomes inner elements * of the created TagNode. It then returns the TagNode object that gets created. * * @param tagTemplate Template file * @param cl The TagNode implementation class. * @return Returns the newly created tag node object which contains the template contents. * @throws TemplateLoadingException Might be thrown if there is a problem in parsing the provided template. */ public <T extends TagNode> T createTag(File tagTemplate, Class<T> cl, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { TemplateDocument doc = loader.parseTemplate(tagTemplate, expressionLanguage); ArrayList<TemplateNode> nodes = doc.getChildren(); try { T tag = cl.newInstance(); tag.addChildren(nodes); return tag; } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return null; } }
public TemplateFactory newTemplateFactory(String template, String encoding, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { return newTemplateFactory(new File(template), encoding, expressionLanguage); }