View Javadoc
1   /**
2    * Copyright 2005-2015 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.initialize;
17  
18  import java.util.List;
19  
20  import org.kuali.rice.krad.uif.component.Component;
21  import org.kuali.rice.krad.uif.component.PropertyReplacer;
22  import org.kuali.rice.krad.uif.lifecycle.ViewLifecycle;
23  import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleTaskBase;
24  import org.kuali.rice.krad.uif.modifier.ComponentModifier;
25  
26  /**
27   * Populate property values on the all property replacers and component modifiers from the
28   * expression graph.
29   *
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  public class PopulateReplacersAndModifiersFromExpressionGraphTask extends ViewLifecycleTaskBase<Component> {
33  
34      /**
35       * Default constructor.
36       */
37      public PopulateReplacersAndModifiersFromExpressionGraphTask() {
38          super(Component.class);
39      }
40  
41  
42      /**
43       * {@inheritDoc}
44       */
45      @Override
46      protected void performLifecycleTask() {
47          Component component = (Component) getElementState().getElement();
48  
49          // move expressions on property replacers and component modifiers
50          List<PropertyReplacer> componentPropertyReplacers = component.getPropertyReplacers();
51          if (componentPropertyReplacers != null) {
52              for (PropertyReplacer replacer : componentPropertyReplacers) {
53                  ViewLifecycle.getExpressionEvaluator().populatePropertyExpressionsFromGraph(replacer, true);
54              }
55          }
56  
57          List<ComponentModifier> componentModifiers = component.getComponentModifiers();
58          if (componentModifiers != null) {
59              for (ComponentModifier modifier : component.getComponentModifiers()) {
60                  ViewLifecycle.getExpressionEvaluator().populatePropertyExpressionsFromGraph(modifier, true);
61              }
62          }
63      }
64  
65  }