01: /* ZKViewHandlerImpl.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.seam.jsf;
19:
20: import java.io.IOException;
21: import java.util.Locale;
22:
23: import javax.faces.FacesException;
24: import javax.faces.application.ViewHandler;
25: import javax.faces.component.UIViewRoot;
26: import javax.faces.context.FacesContext;
27:
28: /**
29: * This class is for integrate ZK with Seam, You should not use this class directly.<br/>
30: * The main purpose of this class is
31: * <ol>
32: * <li>
33: * Override getActionURL mehotd, because Seam call this method to decide navigate url.
34: * the default result will append the servlet path before the url. So I must avoid that when
35: * current request is a ZK's uiUpdate request.
36: * </li>
37: * <ol>
38: *
39: * @author Dennis.Chen
40: *
41: */
42: /**package**/
43: class ZKViewHandlerImpl extends ViewHandler {
44: private ViewHandler viewHandler;
45:
46: public ZKViewHandlerImpl(ViewHandler viewHandler) {
47: this .viewHandler = viewHandler;
48: }
49:
50: @Override
51: public Locale calculateLocale(FacesContext facesContext) {
52: return viewHandler.calculateLocale(facesContext);
53: }
54:
55: @Override
56: public String calculateRenderKitId(FacesContext ctx) {
57: return viewHandler.calculateRenderKitId(ctx);
58: }
59:
60: @Override
61: public UIViewRoot createView(FacesContext ctx, String viewId) {
62: return viewHandler.createView(ctx, viewId);
63: }
64:
65: @Override
66: public String getActionURL(FacesContext ctx, String viewId) {
67: if (ZKFacesContextImpl.isCurrentZKUiUpdate()) {
68: return viewId;
69: } else {
70: return viewHandler.getActionURL(ctx, viewId);
71: }
72: }
73:
74: @Override
75: public String getResourceURL(FacesContext ctx, String path) {
76: return viewHandler.getResourceURL(ctx, path);
77: }
78:
79: @Override
80: public void renderView(FacesContext ctx, UIViewRoot viewRoot)
81: throws IOException, FacesException {
82: viewHandler.renderView(ctx, viewRoot);
83: }
84:
85: @Override
86: public UIViewRoot restoreView(FacesContext ctx, String viewId) {
87: return viewHandler.restoreView(ctx, viewId);
88: }
89:
90: @Override
91: public void writeState(FacesContext ctx) throws IOException {
92: viewHandler.writeState(ctx);
93: }
94: }
|