Update Castle.MicroKernel-vs2005.csproj with missing files.
[castle.git] / MonoRail / Castle.MonoRail.Views.Brail / BrailJSGenerator.cs
blob09899170a3d3c49f72c6ae40215d02e6eeed647a
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.MonoRail.Views.Brail
17 using System;
18 using Boo.Lang;
19 using Castle.MonoRail.Framework.JSGeneration;
20 using Castle.MonoRail.Framework.JSGeneration.DynamicDispatching;
22 /// <summary>
23 ///
24 /// </summary>
25 public class BrailJSGenerator : JSGeneratorDispatcherBase, IQuackFu
27 /// <summary>
28 /// Initializes a new instance of the <see cref="BrailJSGenerator"/> class.
29 /// </summary>
30 /// <param name="codeGen">The code gen.</param>
31 /// <param name="generator">The generator.</param>
32 /// <param name="extensions">The extensions.</param>
33 /// <param name="elementExtensions">The element extensions.</param>
34 public BrailJSGenerator(IJSCodeGenerator codeGen, IJSGenerator generator, object[] extensions, object[] elementExtensions) :
35 base(codeGen, generator, extensions, elementExtensions)
39 /// <summary>
40 /// Defines the behavior when a property is read
41 /// </summary>
42 /// <param name="propName">Property name.</param>
43 /// <param name="parameters">Parameters for indexers</param>
44 /// <returns>value back to the template</returns>
45 public object QuackGet(string propName, object[] parameters)
47 return QuackInvoke(propName, parameters);
50 /// <summary>
51 /// Defines the behavior when a property is written
52 /// </summary>
53 /// <param name="propName">Property name.</param>
54 /// <param name="parameters">Parameters for indexers</param>
55 /// <param name="value">The value to assign.</param>
56 public object QuackSet(string propName, object[] parameters, object value)
58 throw new NotSupportedException("You can't set properties on the generator");
61 /// <summary>
62 /// Invokes the specified method.
63 /// </summary>
64 /// <param name="method">The method name.</param>
65 /// <param name="args">The method arguments.</param>
66 /// <returns>value back to the template</returns>
67 public object QuackInvoke(string method, params object[] args)
69 if (method == "get_Item")
71 method = "el";
73 return InternalInvoke(method, args);
76 public override string ToString()
78 return CodeGen.ToString();
81 protected override object CreateNullGenerator()
83 return null;
86 protected override object CreateJSElementGeneratorProxy(IJSCodeGenerator codeGen, IJSElementGenerator elementGenerator,
87 object[] elementExtensions)
89 return new BrailJSElementGenerator(codeGen, elementGenerator, elementExtensions);