1 16 17 package org.springframework.web.jsf; 18 19 import javax.faces.application.NavigationHandler; 20 import javax.faces.context.FacesContext; 21 22 37 public abstract class DecoratingNavigationHandler extends NavigationHandler { 38 39 private NavigationHandler decoratedNavigationHandler; 40 41 42 45 protected DecoratingNavigationHandler() { 46 } 47 48 52 protected DecoratingNavigationHandler(NavigationHandler originalNavigationHandler) { 53 this.decoratedNavigationHandler = originalNavigationHandler; 54 } 55 56 60 public final NavigationHandler getDecoratedNavigationHandler() { 61 return decoratedNavigationHandler; 62 } 63 64 65 71 public final void handleNavigation(FacesContext facesContext, String fromAction, String outcome) { 72 handleNavigation(facesContext, fromAction, outcome, this.decoratedNavigationHandler); 73 } 74 75 95 public abstract void handleNavigation( 96 FacesContext facesContext, String fromAction, String outcome, NavigationHandler originalNavigationHandler); 97 98 99 127 protected final void callNextHandlerInChain( 128 FacesContext facesContext, String fromAction, String outcome, NavigationHandler originalNavigationHandler) { 129 130 NavigationHandler decoratedNavigationHandler = getDecoratedNavigationHandler(); 131 132 if (decoratedNavigationHandler instanceof DecoratingNavigationHandler) { 133 DecoratingNavigationHandler decHandler = (DecoratingNavigationHandler) decoratedNavigationHandler; 136 decHandler.handleNavigation(facesContext, fromAction, outcome, originalNavigationHandler); 137 } 138 else if (decoratedNavigationHandler != null) { 139 decoratedNavigationHandler.handleNavigation(facesContext, fromAction, outcome); 143 } 144 else if (originalNavigationHandler != null) { 145 originalNavigationHandler.handleNavigation(facesContext, fromAction, outcome); 148 } 149 } 150 151 } 152 | Popular Tags |