01: /* DelegatingVariableResolver.java
02: {{IS_NOTE
03: Purpose:
04:
05: Description:
06:
07: History:
08: Jul 25, 2007 10:03:38 AM , Created by Dennis Chen
09: }}IS_NOTE
10:
11: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
12:
13: {{IS_RIGHT
14: This program is distributed under GPL Version 2.0 in the hope that
15: it will be useful, but WITHOUT ANY WARRANTY.
16: }}IS_RIGHT
17: */
18: package org.zkoss.jsf.zul.util;
19:
20: import org.zkoss.xel.VariableResolver;
21:
22: /**
23: * A Variable Resolver to find variable from JSF context.
24: *
25: * <br/>Configuration in zul file:<br/>
26: * <?variable-resolver class="org.zkoss.jsf.zul.util.DelegatingVariableResolver"?>
27: *
28: * @author Dennis.Chen
29: *
30: */
31: public class DelegatingVariableResolver implements VariableResolver {
32:
33: public DelegatingVariableResolver() {
34: }
35:
36: /**
37: * Get bean from JSF context,<br/>
38: *
39: * @param name bean name
40: * @return bean get from JSF context
41: */
42: public Object resolveVariable(String name) {
43: Object obj = ContextUtil.getBean(name);
44:
45: return obj;
46: }
47: }
|