1 /**
2 * Copyright 2005-2014 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 org.kuali.rice.krad.uif.UifConstants;
19 import org.kuali.rice.krad.uif.view.View;
20 import org.kuali.rice.krad.uif.component.Component;
21 import org.kuali.rice.krad.uif.component.ConfigurableBase;
22
23 import java.util.ArrayList;
24 import java.util.List;
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 ConfigurableBase 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 * @see org.kuali.rice.krad.uif.modifier.ComponentModifierBase#performInitialization
55 */
56 @Override
57 public void performInitialization(View view, 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 public String getRunPhase() {
74 return this.runPhase;
75 }
76
77 /**
78 * Setter for the component initializer run phase
79 *
80 * @param runPhase
81 */
82 public void setRunPhase(String runPhase) {
83 this.runPhase = runPhase;
84 }
85
86 /**
87 * @see org.kuali.rice.krad.uif.modifier.ComponentModifier#getRunCondition()
88 */
89 public String getRunCondition() {
90 return this.runCondition;
91 }
92
93 /**
94 * Setter for the component modifiers run condition
95 *
96 * @param runCondition
97 */
98 public void setRunCondition(String runCondition) {
99 this.runCondition = runCondition;
100 }
101
102 /**
103 * @see org.springframework.core.Ordered#getOrder()
104 */
105 public int getOrder() {
106 return this.order;
107 }
108
109 /**
110 * @see org.kuali.rice.krad.uif.component.Ordered#setOrder(int)
111 */
112 public void setOrder(int order) {
113 this.order = order;
114 }
115
116 }