Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ViewStateImpl |
|
| 1.0;1 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 | * contributor license agreements. See the NOTICE file distributed with | |
4 | * this work for additional information regarding copyright ownership. | |
5 | * The ASF licenses this file to you under the Apache License, Version 2.0 | |
6 | * (the "License"); you may not use this file except in compliance with | |
7 | * the License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | */ | |
17 | ||
18 | package org.apache.shale.dialog.basic.config; | |
19 | ||
20 | import org.apache.shale.dialog.basic.model.ViewState; | |
21 | ||
22 | /** | |
23 | * <p>{@link ViewStateImpl} is a basic implementation of | |
24 | * {@link ViewState}.</p> | |
25 | * | |
26 | * @since 1.0.4 | |
27 | */ | |
28 | ||
29 | 0 | public class ViewStateImpl extends AbstractState implements ViewState { |
30 | ||
31 | ||
32 | // ------------------------------------------------------ Instance Variables | |
33 | ||
34 | ||
35 | /** | |
36 | * <p>Flag indicating that the transition to this view should be done | |
37 | * with a redirect.</p> | |
38 | */ | |
39 | 0 | private boolean redirect = false; |
40 | ||
41 | ||
42 | /** | |
43 | * <p>The view identifier of the JavaServer Faces view to render if this | |
44 | * state is entered.</p> | |
45 | */ | |
46 | 0 | private String viewId = null; |
47 | ||
48 | ||
49 | // -------------------------------------------------------------- Properties | |
50 | ||
51 | ||
52 | /** | |
53 | * {@inheritDoc} | |
54 | */ | |
55 | public boolean isRedirect() { | |
56 | ||
57 | 0 | return this.redirect; |
58 | ||
59 | } | |
60 | ||
61 | ||
62 | /** | |
63 | * {@inheritDoc} | |
64 | */ | |
65 | public String getViewId() { | |
66 | ||
67 | 0 | return this.viewId; |
68 | ||
69 | } | |
70 | ||
71 | ||
72 | // ---------------------------------------------------------- Public Methods | |
73 | ||
74 | ||
75 | /** | |
76 | * <p>Render a printable version of this instance.</p> | |
77 | * | |
78 | * @return The printable version of this instance | |
79 | */ | |
80 | public String toString() { | |
81 | ||
82 | 0 | return "ViewState[dialog=" + |
83 | ((getDialog() != null) ? getDialog().getName() : "<null>") + | |
84 | ",name=" + getName() + | |
85 | ",redirect=" + this.redirect + | |
86 | ",viewId=" + this.viewId + "]"; | |
87 | ||
88 | } | |
89 | ||
90 | ||
91 | // --------------------------------------------------- Configuration Methods | |
92 | ||
93 | ||
94 | /** | |
95 | * <p>Set the redirect flag for this state.</p> | |
96 | * | |
97 | * @param redirect The new redirect flag | |
98 | */ | |
99 | public void setRedirect(boolean redirect) { | |
100 | ||
101 | 0 | this.redirect = redirect; |
102 | ||
103 | 0 | } |
104 | ||
105 | ||
106 | /** | |
107 | * <p>Set the view identifier of the JavaServer Faces view to render | |
108 | * if this state is entered.</p> | |
109 | * | |
110 | * @param viewId The new view identifier | |
111 | */ | |
112 | public void setViewId(String viewId) { | |
113 | ||
114 | 0 | this.viewId = viewId; |
115 | ||
116 | 0 | } |
117 | ||
118 | ||
119 | } |