1 // Copyright 2004-2007 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
.Helpers
;
20 using Castle
.MonoRail
.Framework
.Internal
;
25 public class BrailJSGenerator
: JSGeneratorBase
, IQuackFu
27 public BrailJSGenerator(PrototypeHelper
.JSGenerator generator
)
33 /// Defines the behavior when a property is read
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
);
44 /// Defines the behavior when a property is written
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");
55 /// Invokes the specified method.
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")
64 return InternalInvoke(method
, args
);
68 /// Delegates to the generator
71 /// A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
73 public override string ToString()
75 return generator
.ToString();
78 protected override object CreateNullGenerator()
83 protected override object CreateJSCollectionGenerator(IJSCollectionGenerator collectionGenerator
)
85 return new BrailJSCollectionGenerator(collectionGenerator
);
88 protected override object CreateJSElementGenerator(IJSElementGenerator elementGenerator
)
90 return new BrailJSElementGenerator(elementGenerator
);