Exemplo n.º 1
0
 public ViewComponentStringTemplate(string name, ViewComponentStringTemplateGroup group)
 {
     this.name = name;
     if (group != null)
     {
         this.group       = group;
         this.nativeGroup = group;
     }
 }
		public ViewComponentStringTemplate(string name, ViewComponentStringTemplateGroup group)
		{
			this.name = name;
			if (group != null)
			{
				this.group = group;
				this.nativeGroup = group;
			}
		}
Exemplo n.º 3
0
        public void Initialize()
        {
            config = STViewEngineConfiguration.GetConfig(ConfigConstants.ELEMENT_stview_sectionname);

            StringTemplateGroup componentGroup = new ViewComponentStringTemplateGroup(
                ConfigConstants.STGROUP_NAME_PREFIX + "_components",
                config.TemplateLexerType);

            StringTemplateGroup helpersSTGroup = new BasicStringTemplateGroup(
                ConfigConstants.STGROUP_NAME_PREFIX + "_helpersST",
                new EmbeddedResourceTemplateLoader(this.GetType().Assembly, ConfigConstants.HELPER_RESOURCE_NAMESPACE, false),
                config.TemplateLexerType);

            helpersSTGroup.SuperGroup = componentGroup;

            templateGroup = new BasicStringTemplateGroup(
                ConfigConstants.STGROUP_NAME_PREFIX,
                new FileSystemTemplateLoader(ViewSourceLoader.ViewRootDir, false),
                config.TemplateLexerType);
            templateGroup.SuperGroup = helpersSTGroup;

            if (config.TemplateWriterTypeName != null)
            {
                componentGroup.SetTemplateWriterType(config.TemplateWriterType);
                helpersSTGroup.SetTemplateWriterType(config.TemplateWriterType);
                templateGroup.SetTemplateWriterType(config.TemplateWriterType);
            }

            IEnumerator globalRenderersEnumerator = config.GetGlobalAttributeRenderers();

            while (globalRenderersEnumerator.MoveNext())
            {
                RendererInfo renderInfo = (RendererInfo)globalRenderersEnumerator.Current;
                componentGroup.RegisterAttributeRenderer(renderInfo.AttributeType, renderInfo.GetRendererInstance());
                helpersSTGroup.RegisterAttributeRenderer(renderInfo.AttributeType, renderInfo.GetRendererInstance());
                templateGroup.RegisterAttributeRenderer(renderInfo.AttributeType, renderInfo.GetRendererInstance());
            }
        }
		public void Initialize()
		{
			config = STViewEngineConfiguration.GetConfig(ConfigConstants.ELEMENT_stview_sectionname);

			StringTemplateGroup componentGroup = new ViewComponentStringTemplateGroup(
				ConfigConstants.STGROUP_NAME_PREFIX + "_components", 
				config.TemplateLexerType);

			StringTemplateGroup helpersSTGroup = new BasicStringTemplateGroup(
				ConfigConstants.STGROUP_NAME_PREFIX + "_helpersST", 
				new EmbeddedResourceTemplateLoader(this.GetType().Assembly, ConfigConstants.HELPER_RESOURCE_NAMESPACE, false),
				config.TemplateLexerType);
			helpersSTGroup.SuperGroup = componentGroup;

			templateGroup = new BasicStringTemplateGroup(
				ConfigConstants.STGROUP_NAME_PREFIX, 
				new FileSystemTemplateLoader(ViewSourceLoader.ViewRootDir, false),
				config.TemplateLexerType);
			templateGroup.SuperGroup = helpersSTGroup;

			if (config.TemplateWriterTypeName != null)
			{
				componentGroup.SetTemplateWriterType(config.TemplateWriterType);
				helpersSTGroup.SetTemplateWriterType(config.TemplateWriterType);
				templateGroup.SetTemplateWriterType(config.TemplateWriterType);
			}

			IEnumerator globalRenderersEnumerator = config.GetGlobalAttributeRenderers();
			while (globalRenderersEnumerator.MoveNext())
			{
				RendererInfo renderInfo = (RendererInfo)globalRenderersEnumerator.Current;
				componentGroup.RegisterAttributeRenderer(renderInfo.AttributeType, renderInfo.GetRendererInstance());
				helpersSTGroup.RegisterAttributeRenderer(renderInfo.AttributeType, renderInfo.GetRendererInstance());
				templateGroup.RegisterAttributeRenderer(renderInfo.AttributeType, renderInfo.GetRendererInstance());
			}
		}