1 /* 2 * Copyright 2011 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 1.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/ecl1.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 /** 24 * Base class for <code>ComponentModifier</code> implementations 25 * 26 * <p> 27 * Holds run phase property and defaults to the INITIALIZE phase, and the order 28 * property for setting the order in which the component modifier will be 29 * invoked 30 * </p> 31 * 32 * @author Kuali Rice Team (rice.collab@kuali.org) 33 */ 34 public abstract class ComponentModifierBase extends ConfigurableBase implements ComponentModifier { 35 private static final long serialVersionUID = -8284332412469942130L; 36 37 private String runPhase; 38 private String runCondition; 39 private int order; 40 41 public ComponentModifierBase() { 42 super(); 43 44 runPhase = UifConstants.ViewPhases.INITIALIZE; 45 order = 0; 46 } 47 48 /** 49 * Default performInitialization impl (does nothing) 50 * 51 * @see org.kuali.rice.krad.uif.modifier.ComponentModifierBase#performInitialization 52 */ 53 @Override 54 public void performInitialization(View view, Component component) { 55 56 } 57 58 /** 59 * Default implementation of the overloaded performModification method that 60 * calls the version that does not take the model (more commonly 61 * implemented) 62 * 63 * @see org.kuali.rice.krad.uif.modifier.ComponentModifier#performModification(org.kuali.rice.krad.uif.view.View, 64 * java.lang.Object, org.kuali.rice.krad.uif.component.Component) 65 */ 66 @Override 67 public void performModification(View view, Object model, Component component) { 68 performModification(view, component); 69 } 70 71 /** 72 * @see org.kuali.rice.krad.uif.modifier.ComponentModifier#performModification(org.kuali.rice.krad.uif.view.View, 73 * org.kuali.rice.krad.uif.component.Component) 74 */ 75 @Override 76 public void performModification(View view, Component component) { 77 // do nothing 78 } 79 80 /** 81 * @see org.kuali.rice.krad.uif.modifier.ComponentModifier#getRunPhase() 82 */ 83 public String getRunPhase() { 84 return this.runPhase; 85 } 86 87 /** 88 * Setter for the component initializer run phase 89 * 90 * @param runPhase 91 */ 92 public void setRunPhase(String runPhase) { 93 this.runPhase = runPhase; 94 } 95 96 /** 97 * @see org.kuali.rice.krad.uif.modifier.ComponentModifier#getRunCondition() 98 */ 99 public String getRunCondition() { 100 return this.runCondition; 101 } 102 103 /** 104 * Setter for the component modifiers run condition 105 * 106 * @param runCondition 107 */ 108 public void setRunCondition(String runCondition) { 109 this.runCondition = runCondition; 110 } 111 112 /** 113 * @see org.springframework.core.Ordered#getOrder() 114 */ 115 public int getOrder() { 116 return this.order; 117 } 118 119 /** 120 * @see org.kuali.rice.krad.uif.component.Ordered#setOrder(int) 121 */ 122 public void setOrder(int order) { 123 this.order = order; 124 } 125 126 }