Search in sources :

Example 1 with HorizontalFormBuilder

use of org.akaza.openclinica.view.form.HorizontalFormBuilder in project OpenClinica by OpenClinica.

the class TableTag method doTag.

@Override
public void doTag() throws JspException, IOException {
    JspContext context = getJspContext();
    JspWriter tagWriter = context.getOut();
    boolean isViewData = datacontext != null && datacontext.equalsIgnoreCase(VIEW_DATA_ENTRY);
    DisplaySectionBean dBean = (DisplaySectionBean) context.findAttribute("section");
    StudyBean studyBean = (StudyBean) context.findAttribute("study");
    // tabId is used to seed the tabindex attributes of the form's input
    // elements,
    // according to the section's tab number
    int tabId;
    // this is for viewDataEntryServlet
    Object tabObject = context.findAttribute("tabId");
    if (tabObject == null) {
        // this is for DataEntryServlet
        tabObject = context.findAttribute("tab");
    }
    if (tabObject == null) {
        tabObject = new Integer("1");
    }
    tabId = new Integer(tabObject.toString());
    if (dBean != null) {
        HorizontalFormBuilder formBuilder = new HorizontalFormBuilder();
        // FormBuilder sets tabindexSeed to 1 in its constructor
        if (tabId > 1)
            formBuilder.setTabindexSeed(tabId);
        formBuilder.setDataEntry(isViewData);
        formBuilder.setEventCRFbean(dBean.getEventCRF());
        formBuilder.setDisplayItemGroups(dBean.getDisplayFormGroups());
        formBuilder.setSectionBean(dBean.getSection());
        if (studyBean != null) {
            formBuilder.setStudyBean(studyBean);
        }
        tagWriter.println(formBuilder.createMarkup());
    } else {
        tagWriter.println("The section bean was not found<br />");
    }
/*
         * FormBuilderTest builder = new FormBuilderTest();
         * tagWriter.println(builder.createTable());
         */
}
Also used : DisplaySectionBean(org.akaza.openclinica.bean.submit.DisplaySectionBean) JspContext(javax.servlet.jsp.JspContext) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) JspWriter(javax.servlet.jsp.JspWriter) HorizontalFormBuilder(org.akaza.openclinica.view.form.HorizontalFormBuilder)

Aggregations

JspContext (javax.servlet.jsp.JspContext)1 JspWriter (javax.servlet.jsp.JspWriter)1 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)1 DisplaySectionBean (org.akaza.openclinica.bean.submit.DisplaySectionBean)1 HorizontalFormBuilder (org.akaza.openclinica.view.form.HorizontalFormBuilder)1