Fix the build.
[castle.git] / MonoRail / Castle.MonoRail.Views.Brail / BrailJSGenerator.cs
blob5313803108e1f97174251b08e871ff4634f5fbcf
1 // Copyright 2004-2007 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.Helpers;
20 using Castle.MonoRail.Framework.Internal;
22 /// <summary>
23 ///
24 /// </summary>
25 public class BrailJSGenerator : JSGeneratorBase, IQuackFu
27 public BrailJSGenerator(PrototypeHelper.JSGenerator generator)
28 : base(generator)
32 /// <summary>
33 /// Defines the behavior when a property is read
34 /// </summary>
35 /// <param name="propName">Property name.</param>
36 /// <param name="parameters">Parameters for indexers</param>
37 /// <returns>value back to the template</returns>
38 public object QuackGet(string propName, object[] parameters)
40 return QuackInvoke(propName, parameters);
43 /// <summary>
44 /// Defines the behavior when a property is written
45 /// </summary>
46 /// <param name="propName">Property name.</param>
47 /// <param name="parameters">Parameters for indexers</param>
48 /// <param name="value">The value to assign.</param>
49 public object QuackSet(string propName, object[] parameters, object value)
51 throw new NotSupportedException("You can't set properties on the generator");
54 /// <summary>
55 /// Invokes the specified method.
56 /// </summary>
57 /// <param name="method">The method name.</param>
58 /// <param name="args">The method arguments.</param>
59 /// <returns>value back to the template</returns>
60 public object QuackInvoke(string method, params object[] args)
62 if (method == "get_Item")
63 method = "el";
64 return InternalInvoke(method, args);
67 /// <summary>
68 /// Delegates to the generator
69 /// </summary>
70 /// <returns>
71 /// A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
72 /// </returns>
73 public override string ToString()
75 return generator.ToString();
78 protected override object CreateNullGenerator()
80 return null;
83 protected override object CreateJSCollectionGenerator(IJSCollectionGenerator collectionGenerator)
85 return new BrailJSCollectionGenerator(collectionGenerator);
88 protected override object CreateJSElementGenerator(IJSElementGenerator elementGenerator)
90 return new BrailJSElementGenerator(elementGenerator);