001: /* ZKApplicationImpl.java
002: {{IS_NOTE
003: Purpose:
004:
005: Description:
006:
007: History:
008: Jul 25, 2007 10:03:38 AM , Created by Dennis Chen
009: }}IS_NOTE
010:
011: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
012:
013: {{IS_RIGHT
014: This program is distributed under GPL Version 2.0 in the hope that
015: it will be useful, but WITHOUT ANY WARRANTY.
016: }}IS_RIGHT
017: */
018: package org.zkoss.seam.jsf;
019:
020: import java.util.Collection;
021: import java.util.Iterator;
022: import java.util.Locale;
023:
024: import javax.faces.FacesException;
025: import javax.faces.application.Application;
026: import javax.faces.application.NavigationHandler;
027: import javax.faces.application.StateManager;
028: import javax.faces.application.ViewHandler;
029: import javax.faces.component.UIComponent;
030: import javax.faces.context.FacesContext;
031: import javax.faces.convert.Converter;
032: import javax.faces.el.MethodBinding;
033: import javax.faces.el.PropertyResolver;
034: import javax.faces.el.ReferenceSyntaxException;
035: import javax.faces.el.ValueBinding;
036: import javax.faces.el.VariableResolver;
037: import javax.faces.event.ActionListener;
038: import javax.faces.validator.Validator;
039:
040: /**
041: * This is a delegate class for Application. You should not use this class directly.<br/>
042: * @author Dennis.Chen
043: *
044: */
045: /**package**/
046: class ZKApplicationImpl extends Application {
047:
048: protected Application application;
049:
050: public Application getDelegate() {
051: return application;
052: }
053:
054: public ZKApplicationImpl(Application app) {
055: this .application = app;
056: }
057:
058: @Override
059: public void addComponent(String componentType, String componentClass) {
060: application.addComponent(componentType, componentClass);
061: }
062:
063: @Override
064: public void addConverter(String converterId, String converterClass) {
065: application.addConverter(converterId, converterClass);
066: }
067:
068: @Override
069: public void addConverter(Class targetClass, String converterClass) {
070: application.addConverter(targetClass, converterClass);
071: }
072:
073: @Override
074: public void addValidator(String validatorId, String validatorClass) {
075: application.addValidator(validatorId, validatorClass);
076: }
077:
078: @Override
079: public UIComponent createComponent(String componentType)
080: throws FacesException {
081: return application.createComponent(componentType);
082: }
083:
084: @Override
085: public UIComponent createComponent(ValueBinding componentBinding,
086: FacesContext context, String componentType)
087: throws FacesException {
088: return application.createComponent(componentBinding, context,
089: componentType);
090: }
091:
092: @Override
093: public Converter createConverter(String converterId) {
094: /*
095: if ( Contexts.isApplicationContextActive() ) { String name =
096: Init.instance().getConverters().get(converterId); if (name!=null) {
097: return (Converter) Component.getInstance(name); } }
098: */
099: return application.createConverter(converterId);
100: }
101:
102: @Override
103: public Converter createConverter(Class targetClass) {
104: /*
105: if ( Contexts.isApplicationContextActive() ) { String name =
106: Init.instance().getConvertersByClass().get(targetClass); if
107: (name!=null) { return (Converter) Component.getInstance(name); } }
108: */
109: return application.createConverter(targetClass);
110: }
111:
112: @Override
113: public MethodBinding createMethodBinding(String expression,
114: Class[] params) throws ReferenceSyntaxException {
115: return application.createMethodBinding(expression, params);
116: /*
117: if (params!=null && params.length>0) { //TODO: if (
118: paramTypes.length==1 && FacesEvent.class.isAssignableFrom(
119: paramTypes[0] ) ) // return new
120: OptionalParamMethodBinding(expression,params) return
121: application.createMethodBinding(expression, params); } else { return
122: new ActionParamMethodBinding(application, expression); }
123: */
124: }
125:
126: @Override
127: public Validator createValidator(String validatorId)
128: throws FacesException {
129: /*
130: if (Contexts.isApplicationContextActive()) {
131: String name = Init.instance().getValidators().get(validatorId);
132: if (name != null) {
133: return (Validator) Component.getInstance(name);
134: }
135: }
136: */
137: return application.createValidator(validatorId);
138: }
139:
140: @Override
141: public ValueBinding createValueBinding(String ref)
142: throws ReferenceSyntaxException {
143: return application.createValueBinding(ref);
144: }
145:
146: @Override
147: public ActionListener getActionListener() {
148: return application.getActionListener();
149: }
150:
151: @Override
152: public Iterator getComponentTypes() {
153: return application.getComponentTypes();
154: }
155:
156: @Override
157: public Iterator getConverterIds() {
158: return application.getConverterIds();
159: }
160:
161: @Override
162: public Iterator getConverterTypes() {
163: return application.getComponentTypes();
164: }
165:
166: @Override
167: public Locale getDefaultLocale() {
168: return application.getDefaultLocale();
169: }
170:
171: @Override
172: public String getDefaultRenderKitId() {
173: return application.getDefaultRenderKitId();
174: }
175:
176: @Override
177: public String getMessageBundle() {
178: return application.getMessageBundle();
179: }
180:
181: @Override
182: public NavigationHandler getNavigationHandler() {
183: return application.getNavigationHandler();
184: }
185:
186: @Override
187: public PropertyResolver getPropertyResolver() {
188: return application.getPropertyResolver();
189: }
190:
191: @Override
192: public StateManager getStateManager() {
193: return application.getStateManager();
194: }
195:
196: @Override
197: public Iterator getSupportedLocales() {
198: return application.getSupportedLocales();
199: }
200:
201: @Override
202: public Iterator getValidatorIds() {
203: return application.getValidatorIds();
204: }
205:
206: @Override
207: public VariableResolver getVariableResolver() {
208: return application.getVariableResolver();
209: }
210:
211: @Override
212: public ViewHandler getViewHandler() {
213: return application.getViewHandler();
214: }
215:
216: @Override
217: public void setActionListener(ActionListener listener) {
218: application.setActionListener(listener);
219: }
220:
221: @Override
222: public void setDefaultLocale(Locale locale) {
223: application.setDefaultLocale(locale);
224: }
225:
226: @Override
227: public void setDefaultRenderKitId(String renderKitId) {
228: application.setDefaultRenderKitId(renderKitId);
229: }
230:
231: @Override
232: public void setMessageBundle(String bundle) {
233: application.setMessageBundle(bundle);
234: }
235:
236: @Override
237: public void setNavigationHandler(NavigationHandler handler) {
238: application.setNavigationHandler(handler);
239: }
240:
241: @Override
242: public void setPropertyResolver(PropertyResolver resolver) {
243: application.setPropertyResolver(resolver);
244: }
245:
246: @Override
247: public void setStateManager(StateManager manager) {
248: application.setStateManager(manager);
249: }
250:
251: @Override
252: public void setSupportedLocales(Collection locales) {
253: application.setSupportedLocales(locales);
254: }
255:
256: @Override
257: public void setVariableResolver(VariableResolver resolver) {
258: application.setVariableResolver(resolver);
259: }
260:
261: @Override
262: public void setViewHandler(ViewHandler handler) {
263: application.setViewHandler(handler);
264: }
265: }
|