Search in sources :

Example 6 with JspContext

use of javax.servlet.jsp.JspContext 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)6 JspWriter (javax.servlet.jsp.JspWriter)3 ArrayList (java.util.ArrayList)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 JspFragment (javax.servlet.jsp.tagext.JspFragment)2 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)2 DisplaySectionBean (org.akaza.openclinica.bean.submit.DisplaySectionBean)2 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 Writer (java.io.Writer)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 StringTokenizer (java.util.StringTokenizer)1 RequestDispatcher (javax.servlet.RequestDispatcher)1 ServletConfig (javax.servlet.ServletConfig)1 ServletContext (javax.servlet.ServletContext)1 ServletException (javax.servlet.ServletException)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 HttpServletResponseWrapper (javax.servlet.http.HttpServletResponseWrapper)1 HttpSession (javax.servlet.http.HttpSession)1