1 /** 2 * Copyright 2005-2016 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.rice.krad.uif.lifecycle.model; 17 18 import org.kuali.rice.krad.uif.component.Component; 19 import org.kuali.rice.krad.uif.lifecycle.LifecycleElementState; 20 import org.kuali.rice.krad.uif.lifecycle.ViewLifecyclePhase; 21 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleTaskBase; 22 23 /** 24 * Perform post-expression evaluation tasks. 25 * 26 * <p> 27 * This task is used for optimization in core KRAD features. Since expression evaluation can be 28 * heavy, common behavior defined as expressions in delivered UIF components can be moved to this 29 * task in order to handle evaluation in code instead. 30 * </p> 31 * 32 * @author Kuali Rice Team (rice.collab@kuali.org) 33 */ 34 public class AfterEvaluateExpressionTask extends ViewLifecycleTaskBase<Component> { 35 36 /** 37 * Create a task to assign component IDs during the apply model phase. 38 * 39 * @param phase The apply model phase for the component. 40 */ 41 public AfterEvaluateExpressionTask() { 42 super(Component.class); 43 } 44 45 /** 46 * {@inheritDoc} 47 */ 48 @Override 49 protected void performLifecycleTask() { 50 LifecycleElementState elementState = getElementState(); 51 if (!(elementState instanceof ViewLifecyclePhase)) { 52 return; 53 } 54 55 ViewLifecyclePhase phase = (ViewLifecyclePhase) elementState; 56 Component component = (Component) phase.getElement(); 57 component.afterEvaluateExpression(); 58 } 59 60 }