001/**
002 * Copyright 2005-2018 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 java.util.ArrayList;
019import java.util.List;
020
021import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
022import org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase;
023import org.kuali.rice.krad.uif.UifConstants;
024import org.kuali.rice.krad.uif.component.Component;
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 UifDictionaryBeanBase 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     * {@inheritDoc}
055     */
056    @Override
057    public void performInitialization(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    @BeanTagAttribute
074    public String getRunPhase() {
075        return this.runPhase;
076    }
077
078    /**
079     * Setter for the component initializer run phase
080     *
081     * @param runPhase
082     */
083    public void setRunPhase(String runPhase) {
084        this.runPhase = runPhase;
085    }
086
087    /**
088     * @see org.kuali.rice.krad.uif.modifier.ComponentModifier#getRunCondition()
089     */
090    @BeanTagAttribute
091    public String getRunCondition() {
092        return this.runCondition;
093    }
094
095    /**
096     * Setter for the component modifiers run condition
097     *
098     * @param runCondition
099     */
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}