1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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
19 using Castle
.MonoRail
.Framework
.JSGeneration
;
20 using Castle
.MonoRail
.Framework
.JSGeneration
.DynamicDispatching
;
25 public class BrailJSGenerator
: JSGeneratorDispatcherBase
, IQuackFu
28 /// Initializes a new instance of the <see cref="BrailJSGenerator"/> class.
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
)
40 /// Defines the behavior when a property is read
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
);
51 /// Defines the behavior when a property is written
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");
62 /// Invokes the specified method.
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")
73 return InternalInvoke(method
, args
);
76 public override string ToString()
78 return CodeGen
.ToString();
81 protected override object CreateNullGenerator()
86 protected override object CreateJSElementGeneratorProxy(IJSCodeGenerator codeGen
, IJSElementGenerator elementGenerator
,
87 object[] elementExtensions
)
89 return new BrailJSElementGenerator(codeGen
, elementGenerator
, elementExtensions
);