1 16 package org.springframework.webflow.engine; 17 18 import org.springframework.core.style.ToStringCreator; 19 import org.springframework.util.Assert; 20 import org.springframework.webflow.execution.FlowExecutionException; 21 import org.springframework.webflow.execution.RequestContext; 22 import org.springframework.webflow.execution.ViewSelection; 23 24 36 public class ViewState extends TransitionableState { 37 38 41 private ActionList renderActionList = new ActionList(); 42 43 46 private ViewSelector viewSelector = NullViewSelector.INSTANCE; 47 48 55 public ViewState(Flow flow, String id) throws IllegalArgumentException { 56 super(flow, id); 57 } 58 59 63 public ViewSelector getViewSelector() { 64 return viewSelector; 65 } 66 67 70 public void setViewSelector(ViewSelector viewSelector) { 71 Assert.notNull(viewSelector, "The view selector to make view selections is required"); 72 this.viewSelector = viewSelector; 73 } 74 75 80 public ActionList getRenderActionList() { 81 return renderActionList; 82 } 83 84 96 protected ViewSelection doEnter(RequestControlContext context) throws FlowExecutionException { 97 if (viewSelector.isEntrySelectionRenderable(context)) { 98 renderActionList.execute(context); 100 } 101 return viewSelector.makeEntrySelection(context); 102 } 103 104 113 public ViewSelection refresh(RequestContext context) throws FlowExecutionException { 114 renderActionList.execute(context); 115 return viewSelector.makeRefreshSelection(context); 116 } 117 118 protected void appendToString(ToStringCreator creator) { 119 creator.append("viewSelector", viewSelector); 120 super.appendToString(creator); 121 } 122 } | Popular Tags |