1 15 package org.apache.tapestry.junit.mock.app; 16 17 import org.apache.tapestry.IDirect; 18 import org.apache.tapestry.IRequestCycle; 19 import org.apache.tapestry.callback.DirectCallback; 20 import org.apache.tapestry.callback.ICallback; 21 import org.apache.tapestry.html.BasePage; 22 23 30 31 public abstract class ProtectedLink extends BasePage 32 { 33 public void linkClicked(IRequestCycle cycle) 34 { 35 Object [] parameters = cycle.getListenerParameters(); 36 37 Guard guard = (Guard) cycle.getPage("Guard"); 38 39 if (!guard.isVisited()) 40 { 41 ICallback callback = new DirectCallback((IDirect) getComponent("link"), parameters); 42 guard.setCallback(callback); 43 cycle.activate(guard); 44 return; 45 } 46 47 ProtectedLinkResult page = (ProtectedLinkResult) cycle.getPage("ProtectedLinkResult"); 48 page.setParameters(parameters); 49 50 cycle.activate(page); 51 } 52 } 53 | Popular Tags |