Coverage Report - org.kuali.rice.krad.uif.modifier.ComponentModifier
 
Classes in this File Line Coverage Branch Coverage Complexity
ComponentModifier
N/A
N/A
1
 
 1  
 /**
 2  
  * Copyright 2005-2011 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.view.View;
 19  
 import org.kuali.rice.krad.uif.component.Component;
 20  
 import org.kuali.rice.krad.uif.component.Configurable;
 21  
 import org.kuali.rice.krad.uif.component.Ordered;
 22  
 
 23  
 import java.io.Serializable;
 24  
 import java.util.List;
 25  
 import java.util.Set;
 26  
 
 27  
 /**
 28  
  * Provides modification functionality for a <code>Component</code>
 29  
  *
 30  
  * <p>
 31  
  * <code>ComponentModifier</code> instances are configured by the component's
 32  
  * dictionary definition. They can be used to provide dynamic initialization
 33  
  * behavior for a certain type of component or all components based on the
 34  
  * getComponentsForLifecycle method. In addition they can do dynamic generation of
 35  
  * new <code>Component</code> instances, or replacement of the components or
 36  
  * their properties.
 37  
  * </p>
 38  
  *
 39  
  * <p>
 40  
  * Modifiers provide for more usability and flexibility of component
 41  
  * configuration. For instance if a <code>Group</code> definition is already
 42  
  * configured that is close to what the developer needs, but they need to make
 43  
  * global changes of the group, then can invoke or create a
 44  
  * <code>ComponentModifier</code> for the group to apply those changes. The
 45  
  * configuration can then inherit the exiting group definition and then specify
 46  
  * the modifier to run with the component's componentModifiers property.
 47  
  * </p>
 48  
  *
 49  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 50  
  */
 51  
 public interface ComponentModifier extends Configurable, Serializable, Ordered {
 52  
 
 53  
     /**
 54  
      * Should be called to initialize the ComponentModifier
 55  
      *
 56  
      * <p>
 57  
      * This is where component modifiers can set defaults and setup other necessary
 58  
      * state. The initialize method should only be called once per layout
 59  
      * manager lifecycle and is invoked within the initialize phase of the view
 60  
      * lifecylce.
 61  
      * </p>
 62  
      *
 63  
      * <p>
 64  
      * Note if the component modifier holds nested components, they should be initialized
 65  
      * in this method by calling the view helper service
 66  
      * </p>
 67  
      *
 68  
      * @param view - View instance the component modifier is a part of
 69  
      * @parma model - object instance containing the view data
 70  
      * @param component - Component the modifier is configured on
 71  
      * @see org.kuali.rice.krad.uif.service.ViewHelperService#performInitialization
 72  
      */
 73  
     public void performInitialization(View view, Object model, Component component);
 74  
 
 75  
     /**
 76  
      * Invoked within the configured phase of the component lifecycle. This is
 77  
      * where the <code>ComponentModifier</code> should perform its work against
 78  
      * the given <code>Component</code> instance
 79  
      *
 80  
      * @param view - the view instance to which the component belongs
 81  
      * @param model - top level object containing the view data
 82  
      * @param component - the component instance to modify
 83  
      * @see org.kuali.rice.krad.uif.modifier.ComponentModifier.performModification
 84  
      *      (View, Component)
 85  
      */
 86  
     public void performModification(View view, Object model, Component component);
 87  
 
 88  
     /**
 89  
      * <code>Set</code> of <code>Component</code> classes that may be sent to
 90  
      * the modifier
 91  
      *
 92  
      * <p>
 93  
      * If an empty or null list is returned, it is assumed the modifier supports
 94  
      * all components. The returned set will be used by the dictionary
 95  
      * validation
 96  
      * </p>
 97  
      *
 98  
      * @return Set component classes
 99  
      */
 100  
     public Set<Class<? extends Component>> getSupportedComponents();
 101  
 
 102  
     /**
 103  
      * List of components that are maintained by the modifier as prototypes for creating other component instances
 104  
      *
 105  
      * <p>
 106  
      * Prototypes are held for configuring how a component should be created during the lifecycle. An example of this
 107  
      * are the fields in a collection group that are created for each collection record. They only participate in the
 108  
      * initialize phase.
 109  
      * </p>
 110  
      *
 111  
      * @return List<Component> child component prototypes
 112  
      */
 113  
     public List<Component> getComponentPrototypes();
 114  
 
 115  
     /**
 116  
      * Indicates what phase of the component lifecycle the
 117  
      * <code>ComponentModifier</code> should be invoked in (INITIALIZE,
 118  
      * APPLY_MODEL, or FINALIZE)
 119  
      *
 120  
      * @return String view lifecycle phase
 121  
      * @see org.kuali.rice.krad.uif.UifConstants.ViewPhases
 122  
      */
 123  
     public String getRunPhase();
 124  
 
 125  
     /**
 126  
      * Conditional expression to evaluate for determining whether the component
 127  
      * modifier should be run. If the expression evaluates to true the modifier
 128  
      * will be executed, otherwise it will not be executed
 129  
      *
 130  
      * @return String el expression that should evaluate to boolean
 131  
      */
 132  
     public String getRunCondition();
 133  
 
 134  
     /**
 135  
      * @see org.springframework.core.Ordered#getOrder()
 136  
      */
 137  
     public int getOrder();
 138  
 
 139  
     /**
 140  
      * @see org.kuali.rice.krad.uif.component.Ordered#setOrder(int)
 141  
      */
 142  
     public void setOrder(int order);
 143  
 
 144  
 }