001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.uif.modifier;
017
018import org.kuali.rice.krad.uif.UifConstants;
019import org.kuali.rice.krad.uif.view.View;
020import org.kuali.rice.krad.uif.component.Component;
021import org.kuali.rice.krad.uif.component.ConfigurableBase;
022
023import java.util.ArrayList;
024import java.util.List;
025
026/**
027 * Base class for <code>ComponentModifier</code> implementations
028 * 
029 * <p>
030 * Holds run phase property and defaults to the INITIALIZE phase, and the order
031 * property for setting the order in which the component modifier will be
032 * invoked
033 * </p>
034 * 
035 * @author Kuali Rice Team (rice.collab@kuali.org)
036 */
037public abstract class ComponentModifierBase extends ConfigurableBase implements ComponentModifier {
038        private static final long serialVersionUID = -8284332412469942130L;
039
040        private String runPhase;
041        private String runCondition;
042        private int order;
043
044        public ComponentModifierBase() {
045        super();
046
047                runPhase = UifConstants.ViewPhases.INITIALIZE;
048                order = 0;
049        }
050
051    /**
052     * Default performInitialization impl (does nothing)
053     *
054     * @see org.kuali.rice.krad.uif.modifier.ComponentModifierBase#performInitialization
055     */
056    @Override
057    public void performInitialization(View view, Object model, Component component) {
058
059    }
060
061    /**
062     * @see org.kuali.rice.krad.uif.modifier.ComponentModifierBase#getComponentPrototypes()
063     */
064    public List<Component> getComponentPrototypes() {
065        List<Component> components = new ArrayList<Component>();
066
067        return components;
068    }
069
070    /**
071         * @see org.kuali.rice.krad.uif.modifier.ComponentModifier#getRunPhase()
072         */
073        public String getRunPhase() {
074                return this.runPhase;
075        }
076
077        /**
078         * Setter for the component initializer run phase
079         * 
080         * @param runPhase
081         */
082        public void setRunPhase(String runPhase) {
083                this.runPhase = runPhase;
084        }
085
086        /**
087         * @see org.kuali.rice.krad.uif.modifier.ComponentModifier#getRunCondition()
088         */
089        public String getRunCondition() {
090                return this.runCondition;
091        }
092
093        /**
094         * Setter for the component modifiers run condition
095         * 
096         * @param runCondition
097         */
098        public void setRunCondition(String runCondition) {
099                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}