Search in sources :

Example 6 with SubjectSDVContainer

use of org.akaza.openclinica.controller.helper.table.SubjectSDVContainer in project OpenClinica by OpenClinica.

the class SDVController method renderSubjectsTable.

/*
    Create a JMesa-based table for showing the event CRFs.
    */
private String renderSubjectsTable(List<EventCRFBean> eventCRFBeans, int studySubjectId, HttpServletRequest request) {
    StudySubjectDAO studySubjectDAO = new StudySubjectDAO(dataSource);
    StudySubjectBean subjectBean = (StudySubjectBean) studySubjectDAO.findByPK(studySubjectId);
    Collection<SubjectSDVContainer> items = sdvUtil.getSubjectRows(eventCRFBeans, request);
    //The number of items represents the total number of returned rows
    int totalRowCount = 0;
    if (items != null && items.size() > 0) {
        totalRowCount = items.size();
    }
    TableFacade tableFacade = createTableFacade("sdv", request);
    //set to the total row count
    if (totalRowCount > 1) {
        tableFacade.setMaxRowsIncrements(15, 50, totalRowCount);
    }
    tableFacade.setColumnProperties("studySubjectId", "personId", "secondaryId", "eventName", "eventDate", "enrollmentDate", "subjectStatus", "crfNameVersion", "crfStatus", "lastUpdatedDate", "lastUpdatedBy", "sdvStatusActions");
    tableFacade.setItems(items);
    //Fix column titles
    HtmlTable table = (HtmlTable) tableFacade.getTable();
    //i18n caption; TODO: convert to Spring messages
    ResourceBundle resourceBundle = ResourceBundle.getBundle("org.akaza.openclinica.i18n.words", LocaleResolver.getLocale(request));
    String[] allTitles = { resourceBundle.getString("study_subject_ID"), resourceBundle.getString("person_ID"), resourceBundle.getString("secondary_ID"), resourceBundle.getString("event_name"), resourceBundle.getString("event_date"), resourceBundle.getString("enrollment_date"), resourceBundle.getString("subject_status"), resourceBundle.getString("CRF_name") + " / " + resourceBundle.getString("version"), resourceBundle.getString("CRF_status"), resourceBundle.getString("last_updated_date"), resourceBundle.getString("last_updated_by"), resourceBundle.getString("SDV_status") + " / " + resourceBundle.getString("actions") };
    setTitles(allTitles, table);
    table.getTableRenderer().setWidth("800");
    return tableFacade.render();
}
Also used : HtmlTable(org.jmesa.view.html.component.HtmlTable) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) TableFacadeFactory.createTableFacade(org.jmesa.facade.TableFacadeFactory.createTableFacade) TableFacade(org.jmesa.facade.TableFacade) ResourceBundle(java.util.ResourceBundle) SubjectSDVContainer(org.akaza.openclinica.controller.helper.table.SubjectSDVContainer) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO)

Aggregations

SubjectSDVContainer (org.akaza.openclinica.controller.helper.table.SubjectSDVContainer)6 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)4 ArrayList (java.util.ArrayList)3 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)3 ResourceBundle (java.util.ResourceBundle)2 TableFacade (org.jmesa.facade.TableFacade)2 TableFacadeFactory.createTableFacade (org.jmesa.facade.TableFacadeFactory.createTableFacade)2 Limit (org.jmesa.limit.Limit)2 HtmlTable (org.jmesa.view.html.component.HtmlTable)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Locale (java.util.Locale)1 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)1 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)1 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)1 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)1 SubjectBean (org.akaza.openclinica.bean.submit.SubjectBean)1 EventCRFSDVFilter (org.akaza.openclinica.dao.EventCRFSDVFilter)1 EventCRFSDVSort (org.akaza.openclinica.dao.EventCRFSDVSort)1 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)1 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)1