KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > flow > javascript > fom > PageLocalScopeHolder


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.components.flow.javascript.fom;
17
18 import org.mozilla.javascript.Scriptable;
19 import org.mozilla.javascript.ScriptableObject;
20
21 /**
22  * @version CVS $Id: PageLocalScopeHolder.java 54079 2004-10-08 13:30:28Z vgritsenko $
23  */

24 public class PageLocalScopeHolder implements PageLocalScope {
25
26     private Scriptable scope;
27     private PageLocalScopeImpl delegate;
28
29     public PageLocalScopeHolder(Scriptable scope) {
30         this.scope = scope;
31     }
32
33     public boolean has(PageLocal local, String JavaDoc name) {
34         return delegate.has(local, name);
35     }
36
37     public boolean has(PageLocal local, int index) {
38         return delegate.has(local, index);
39     }
40
41     public Object JavaDoc get(PageLocal local, String JavaDoc name) {
42         return delegate.get(local, name);
43     }
44
45     public Object JavaDoc get(PageLocal local, int index) {
46         return delegate.get(local, index);
47     }
48
49     public void put(PageLocal local, String JavaDoc name, Object JavaDoc value) {
50         delegate.put(local, name, value);
51     }
52
53     public void put(PageLocal local, int index, Object JavaDoc value) {
54         delegate.put(local, index, value);
55     }
56
57     public void delete(PageLocal local, String JavaDoc name) {
58         delegate.delete(local, name);
59     }
60
61     public void delete(PageLocal local, int index) {
62         delegate.delete(local, index);
63     }
64
65     public Object JavaDoc[] getIds(PageLocal local) {
66         return delegate.getIds(local);
67     }
68
69     public Object JavaDoc getDefaultValue(PageLocal local, Class JavaDoc hint) {
70         return delegate.getDefaultValue(local, hint);
71     }
72
73     public void setDelegate(PageLocalScopeImpl delegate) {
74         this.delegate = delegate;
75     }
76
77     public PageLocalScopeImpl getDelegate() {
78         return delegate;
79     }
80
81     public PageLocal createPageLocal() {
82         PageLocalImpl pageLocal = new PageLocalImpl();
83         pageLocal.setPrototype(ScriptableObject.getClassPrototype(scope,
84                                                                   pageLocal.getClassName()));
85         pageLocal.setParentScope(scope);
86         pageLocal.setPageLocalScope(this);
87         return pageLocal;
88     }
89 }
90
Popular Tags