public virtual object Create(object parent, object configContext, XmlNode section) { STViewEngineConfiguration config = new STViewEngineConfiguration(); config.ConfigSection = section; XmlAttribute templateWriter = section.Attributes[ConfigConstants.ATTR_template_writer_type]; if (templateWriter != null) { config.TemplateWriterTypeName = templateWriter.Value; } XmlAttribute templateLexer = section.Attributes[ConfigConstants.ATTR_template_lexer_type]; if (templateLexer != null) { config.TemplateLexerTypeName = templateLexer.Value; } XmlNodeList renderers = section.SelectNodes( ConfigConstants.ELEMENT_attrib_renderers + "/" + ConfigConstants.ELEMENT_attrib_renderer ); ProcessAttributeRenderers(renderers, config); Validate(config); return config; }
public virtual object Create(object parent, object configContext, XmlNode section) { STViewEngineConfiguration config = new STViewEngineConfiguration(); config.ConfigSection = section; XmlAttribute templateWriter = section.Attributes[ConfigConstants.ATTR_template_writer_type]; if (templateWriter != null) { config.TemplateWriterTypeName = templateWriter.Value; } XmlAttribute templateLexer = section.Attributes[ConfigConstants.ATTR_template_lexer_type]; if (templateLexer != null) { config.TemplateLexerTypeName = templateLexer.Value; } XmlNodeList renderers = section.SelectNodes( ConfigConstants.ELEMENT_attrib_renderers + "/" + ConfigConstants.ELEMENT_attrib_renderer ); ProcessAttributeRenderers(renderers, config); Validate(config); return(config); }
internal static STViewEngineConfiguration GetConfig(string sectionName) { STViewEngineConfiguration config = (STViewEngineConfiguration) ConfigurationSettings.GetConfig(sectionName); if (config == null) { return(new STViewEngineConfiguration()); } return(config); }
private void ProcessAttributeRenderers(XmlNodeList renderers, STViewEngineConfiguration config) { foreach(XmlNode renderer in renderers) { string rendererTypeName = renderer.Attributes[ConfigConstants.ATTR_renderer_type].Value; string attributeTypeName = renderer.Attributes[ConfigConstants.ATTR_renderer_target_type].Value; XmlAttribute area = renderer.Attributes[ConfigConstants.ATTR_renderer_area]; if (area == null) config.RegisterAttributeRenderer(rendererTypeName, attributeTypeName); else config.RegisterAttributeRenderer(rendererTypeName, attributeTypeName, area.Value); } }
private void ProcessAttributeRenderers(XmlNodeList renderers, STViewEngineConfiguration config) { foreach (XmlNode renderer in renderers) { string rendererTypeName = renderer.Attributes[ConfigConstants.ATTR_renderer_type].Value; string attributeTypeName = renderer.Attributes[ConfigConstants.ATTR_renderer_target_type].Value; XmlAttribute area = renderer.Attributes[ConfigConstants.ATTR_renderer_area]; if (area == null) { config.RegisterAttributeRenderer(rendererTypeName, attributeTypeName); } else { config.RegisterAttributeRenderer(rendererTypeName, attributeTypeName, area.Value); } } }
protected void Validate(STViewEngineConfiguration config) { if (config.TemplateLexerTypeName != null) { ValidateTypeImplements(config.TemplateLexerTypeName, typeof(antlr.TokenStream)); } if (config.TemplateWriterTypeName != null) { ValidateTypeImplements(config.TemplateWriterTypeName, typeof(Antlr.StringTemplate.IStringTemplateWriter)); } foreach (string rendererTypeName in config.AllAttributeRenderers) { ValidateTypeImplements(rendererTypeName, typeof(Antlr.StringTemplate.IAttributeRenderer)); } }
public IAttributeRenderer GetRendererInstance() { return((IAttributeRenderer)Activator.CreateInstance(STViewEngineConfiguration.GetType(rendererTypeName))); }
protected void Validate(STViewEngineConfiguration config) { if (config.TemplateLexerTypeName != null) { ValidateTypeImplements(config.TemplateLexerTypeName, typeof(antlr.TokenStream)); } if (config.TemplateWriterTypeName != null) { ValidateTypeImplements(config.TemplateWriterTypeName, typeof(Antlr.StringTemplate.IStringTemplateWriter)); } foreach(string rendererTypeName in config.AllAttributeRenderers) { ValidateTypeImplements(rendererTypeName, typeof(Antlr.StringTemplate.IAttributeRenderer)); } }