1 /**
2 * Copyright 2005-2012 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.kns.question;
17
18 import java.util.ArrayList;
19
20 /**
21 * This class is a base class to implement questions types.
22 *
23 *
24 * "confirmation questions") rather than specific questions.
25 */
26
27 public class QuestionBase implements Question {
28 String question;
29 ArrayList buttons;
30
31 /**
32 * default constructor
33 *
34 * @param question the question to assign to this question prompt
35 * @param buttons the buttons associated with it
36 */
37 public QuestionBase(String question, ArrayList buttons) {
38 this.question = question;
39 this.buttons = buttons;
40 }
41
42 /**
43 * returns the index associated with a specified button
44 *
45 * @param btnText the text of the button
46 * @return the index of this button
47 */
48 public String getButtonIndex(String btnText) {
49 return "" + buttons.indexOf(btnText);
50 }
51
52 /**
53 * @return Returns the buttons.
54 */
55 public ArrayList getButtons() {
56 return buttons;
57 }
58
59 /**
60 * @param buttons The buttons to set.
61 */
62 public void setButtons(ArrayList buttons) {
63 this.buttons = buttons;
64 }
65
66 /**
67 * @return Returns the question.
68 */
69 public String getQuestion() {
70 return question;
71 }
72
73 /**
74 * @param question The question to set.
75 */
76 public void setQuestion(String question) {
77 this.question = question;
78 }
79 }