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.modifier;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
22  import org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase;
23  import org.kuali.rice.krad.uif.UifConstants;
24  import org.kuali.rice.krad.uif.component.Component;
25  
26  /**
27   * Base class for <code>ComponentModifier</code> implementations
28   *
29   * <p>
30   * Holds run phase property and defaults to the INITIALIZE phase, and the order
31   * property for setting the order in which the component modifier will be
32   * invoked
33   * </p>
34   *
35   * @author Kuali Rice Team (rice.collab@kuali.org)
36   */
37  public abstract class ComponentModifierBase extends UifDictionaryBeanBase implements ComponentModifier {
38      private static final long serialVersionUID = -8284332412469942130L;
39  
40      private String runPhase;
41      private String runCondition;
42      private int order;
43  
44      public ComponentModifierBase() {
45          super();
46  
47          runPhase = UifConstants.ViewPhases.INITIALIZE;
48          order = 0;
49      }
50  
51      /**
52       * Default performInitialization impl (does nothing)
53       *
54       * {@inheritDoc}
55       */
56      @Override
57      public void performInitialization(Object model, Component component) {
58  
59      }
60  
61      /**
62       * @see org.kuali.rice.krad.uif.modifier.ComponentModifierBase#getComponentPrototypes()
63       */
64      public List<Component> getComponentPrototypes() {
65          List<Component> components = new ArrayList<Component>();
66  
67          return components;
68      }
69  
70      /**
71       * @see org.kuali.rice.krad.uif.modifier.ComponentModifier#getRunPhase()
72       */
73      @BeanTagAttribute
74      public String getRunPhase() {
75          return this.runPhase;
76      }
77  
78      /**
79       * Setter for the component initializer run phase
80       *
81       * @param runPhase
82       */
83      public void setRunPhase(String runPhase) {
84          this.runPhase = runPhase;
85      }
86  
87      /**
88       * @see org.kuali.rice.krad.uif.modifier.ComponentModifier#getRunCondition()
89       */
90      @BeanTagAttribute
91      public String getRunCondition() {
92          return this.runCondition;
93      }
94  
95      /**
96       * Setter for the component modifiers run condition
97       *
98       * @param runCondition
99       */
100     public void setRunCondition(String runCondition) {
101         this.runCondition = runCondition;
102     }
103 
104     /**
105      * @see org.springframework.core.Ordered#getOrder()
106      */
107     @BeanTagAttribute
108     public int getOrder() {
109         return this.order;
110     }
111 
112     /**
113      * @see org.kuali.rice.krad.uif.component.Ordered#setOrder(int)
114      */
115     public void setOrder(int order) {
116         this.order = order;
117     }
118 
119 }