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