01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.components.flow.javascript.fom;
18:
19: import org.mozilla.javascript.Scriptable;
20: import org.mozilla.javascript.ScriptableObject;
21:
22: /**
23: * @version CVS $Id: PageLocalScopeHolder.java 433543 2006-08-22 06:22:54Z crossley $
24: */
25: public class PageLocalScopeHolder implements PageLocalScope {
26:
27: private Scriptable scope;
28: private PageLocalScopeImpl delegate;
29:
30: public PageLocalScopeHolder(Scriptable scope) {
31: this .scope = scope;
32: }
33:
34: public boolean has(PageLocal local, String name) {
35: return delegate.has(local, name);
36: }
37:
38: public boolean has(PageLocal local, int index) {
39: return delegate.has(local, index);
40: }
41:
42: public Object get(PageLocal local, String name) {
43: return delegate.get(local, name);
44: }
45:
46: public Object get(PageLocal local, int index) {
47: return delegate.get(local, index);
48: }
49:
50: public void put(PageLocal local, String name, Object value) {
51: delegate.put(local, name, value);
52: }
53:
54: public void put(PageLocal local, int index, Object value) {
55: delegate.put(local, index, value);
56: }
57:
58: public void delete(PageLocal local, String name) {
59: delegate.delete(local, name);
60: }
61:
62: public void delete(PageLocal local, int index) {
63: delegate.delete(local, index);
64: }
65:
66: public Object[] getIds(PageLocal local) {
67: return delegate.getIds(local);
68: }
69:
70: public Object getDefaultValue(PageLocal local, Class hint) {
71: return delegate.getDefaultValue(local, hint);
72: }
73:
74: public void setDelegate(PageLocalScopeImpl delegate) {
75: this .delegate = delegate;
76: }
77:
78: public PageLocalScopeImpl getDelegate() {
79: return delegate;
80: }
81:
82: public PageLocal createPageLocal() {
83: PageLocalImpl pageLocal = new PageLocalImpl();
84: pageLocal.setPrototype(ScriptableObject.getClassPrototype(
85: scope, pageLocal.getClassName()));
86: pageLocal.setParentScope(scope);
87: pageLocal.setPageLocalScope(this);
88: return pageLocal;
89: }
90: }
|