001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kns.question;
017
018import java.util.ArrayList;
019
020/**
021 * This class is a base class to implement questions types.
022 * 
023 * 
024 *         "confirmation questions") rather than specific questions.
025 */
026
027public class QuestionBase implements Question {
028    String question;
029    ArrayList buttons;
030
031    /**
032     * default constructor
033     * 
034     * @param question the question to assign to this question prompt
035     * @param buttons the buttons associated with it
036     */
037    public QuestionBase(String question, ArrayList buttons) {
038        this.question = question;
039        this.buttons = buttons;
040    }
041
042    /**
043     * returns the index associated with a specified button
044     * 
045     * @param btnText the text of the button
046     * @return the index of this button
047     */
048    public String getButtonIndex(String btnText) {
049        return "" + buttons.indexOf(btnText);
050    }
051
052    /**
053     * @return Returns the buttons.
054     */
055    public ArrayList getButtons() {
056        return buttons;
057    }
058
059    /**
060     * @param buttons The buttons to set.
061     */
062    public void setButtons(ArrayList buttons) {
063        this.buttons = buttons;
064    }
065
066    /**
067     * @return Returns the question.
068     */
069    public String getQuestion() {
070        return question;
071    }
072
073    /**
074     * @param question The question to set.
075     */
076    public void setQuestion(String question) {
077        this.question = question;
078    }
079}