View Javadoc
1   /**
2    * Copyright 2005-2015 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.lifecycle;
17  
18  import org.kuali.rice.krad.uif.freemarker.LifecycleRenderingContext;
19  import org.kuali.rice.krad.uif.view.ExpressionEvaluator;
20  
21  /**
22   * Interface for controlling the execution of the view lifecycle.
23   * 
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public interface ViewLifecycleProcessor {
27  
28      /**
29       * Performs a lifecycle phase according to this processor's semantics, blocking until the phase
30       * has been completely processed. Once the initial phase has been completely processed, this
31       * method will return.
32       * 
33       * @param initialPhase The initial lifecycle phase
34       */
35      void performPhase(ViewLifecyclePhase initialPhase);
36  
37      /**
38       * Pushes lifecycle phases to be processed within the lifecycle associated with this processor.
39       * 
40       * <p>A phase submitted using this method will be added to the front of the queue, to be processed
41       * by the next available processor.</p>
42       * 
43       * @param phase The phase to be processed within the lifecycle associated with this processor.
44       */
45      void pushPendingPhase(ViewLifecyclePhase phase);
46  
47      /**
48       * Queues a lifecycle phase to be processed within the lifecycle associated with this processor.
49       * 
50       * <p>A phase submitted using this method will be added to the end of the queue, to be processed
51       * after all other phases currently in the queue have been submitted.</p>
52       * 
53       * @param phase The phase to be processed within the lifecycle associated with this processor.
54       */
55      void offerPendingPhase(ViewLifecyclePhase phase);
56  
57      /**
58       * Gets the phase actively being processing on the current thread.
59       *
60       * @return lifecycle phase active on the current thread
61       */
62      ViewLifecyclePhase getActivePhase();
63  
64      /**
65       * Gets the lifecycle associated with this processor.
66       *
67       * @return lifecycle associated with this processor
68       */
69      ViewLifecycle getLifecycle();
70  
71      /**
72       * Gets a thread-local rending context for invoking FreeMarker operations on the current thread.
73       *
74       * @return rending context for invoking FreeMarker operations on the current thread
75       */
76      LifecycleRenderingContext getRenderingContext();
77  
78      /**
79       * Returns an instance of {@link org.kuali.rice.krad.uif.view.ExpressionEvaluator} that can be
80       * used for evaluating expressions contained on the view.
81       * 
82       * <p>A ExpressionEvaluator must be initialized with a model for expression evaluation. One
83       * instance is constructed for the view lifecycle and made available to all components/helpers
84       * through this method</p>
85       * 
86       * @return instance of ExpressionEvaluator
87       */
88      ExpressionEvaluator getExpressionEvaluator();
89  
90  }