/*
 * Copyright (C) 2009 JavaRosa
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package org.javarosa.form.api;

import java.util.Vector;

import org.javarosa.core.model.FormDef;
import org.javarosa.core.model.FormIndex;
import org.javarosa.core.model.SelectChoice;
import org.javarosa.core.model.data.IAnswerData;
import org.javarosa.core.model.instance.TreeElement;

/**
 * This class gives you all the information you need to display a question when
 * your current FormIndex references a QuestionEvent.
 * 
 * 
 */
public class FormEntryPrompt extends FormEntryCaption {

    TreeElement mTreeElement;


    public FormEntryPrompt(FormDef form, FormIndex index) {
        super(form, index);
        this.mTreeElement = form.getDataModel().resolveReference(index.getReference());
    }


    public int getControlType() {
        return getQuestionDef().getControlType();
    }


    public int getDataType() {
        return mTreeElement.dataType;
    }


    // attributes available in the bind, instance and body
    public String getPromptAttributes() {
        // TODO: implement me.
        return null;
    }


    public IAnswerData getAnswerValue() {
        return mTreeElement.getValue();
    }


    public String getAnswerText() {
        return mTreeElement.getValue().getDisplayText();
    }


    public String getConstraintText() {
        return mTreeElement.getConstraint().constraintMsg;
    }


    public Vector<SelectChoice> getSelectChoices() {
        return getQuestionDef().getChoices();
    }


    public String getHelpText() {
        return getQuestionDef().getHelpText();
    }


    public boolean isRequired() {
        return mTreeElement.required;
    }


    public boolean isReadOnly() {
        return !mTreeElement.isEnabled();
    }
}

@@ -1116,16 +1116,169 @@
 ment;%0A%0A%0A
+    /**%0A     * This empty constructor exists for convenience of any supertypes of this prompt%0A     */%0A    protected FormEntryPrompt() %7B%0A    %09%0A    %7D%0A    %0A
     publ

Fix fake entry prompt empty constructor