use of org.akaza.openclinica.control.DefaultActionsEditor in project OpenClinica by OpenClinica.
the class ListEventsForSubjectTableFactory method configureColumns.
@Override
protected void configureColumns(TableFacade tableFacade, Locale locale) {
resword = ResourceBundleProvider.getWordsBundle(locale);
resformat = ResourceBundleProvider.getFormatBundle(locale);
tableFacade.setColumnProperties(columnNames);
Row row = tableFacade.getTable().getRow();
int index = 0;
configureColumn(row.getColumn(columnNames[index]), resword.getString("study_subject_ID"), null, null);
++index;
configureColumn(row.getColumn(columnNames[index]), resword.getString("subject_status"), new StatusCellEditor(), new StatusDroplistFilterEditor());
++index;
configureColumn(row.getColumn(columnNames[index]), resword.getString("site_id"), null, null);
++index;
configureColumn(row.getColumn(columnNames[index]), resword.getString("gender"), null, null, true, false);
++index;
// group class columns
for (int i = index; i < index + studyGroupClasses.size(); i++) {
StudyGroupClassBean studyGroupClass = studyGroupClasses.get(i - index);
configureColumn(row.getColumn(columnNames[i]), studyGroupClass.getName(), new StudyGroupClassCellEditor(studyGroupClass), new SubjectGroupClassDroplistFilterEditor(studyGroupClass), true, false);
}
configureColumn(row.getColumn(columnNames[index + studyGroupClasses.size()]), resword.getString("event_status"), new EventStatusCellEditor(), new SubjectEventStatusDroplistFilterEditor(), true, false);
++index;
configureColumn(row.getColumn(columnNames[index + studyGroupClasses.size()]), resword.getString("event_date"), new EventStartDateCellEditor(), null);
++index;
// crf columns
for (int i = index + studyGroupClasses.size(); i < columnNames.length - 1; i++) {
CRFBean crfBean = crfBeans.get(i - (index + studyGroupClasses.size()));
configureColumn(row.getColumn(columnNames[i]), crfBean.getName(), new EventCrfCellEditor(), new SubjectEventCRFStatusDroplistFilterEditor(), true, false);
}
String actionsHeader = resword.getString("rule_actions") + "               ";
configureColumn(row.getColumn(columnNames[columnNames.length - 1]), actionsHeader, new ActionsCellEditor(), new DefaultActionsEditor(locale), true, false);
}
use of org.akaza.openclinica.control.DefaultActionsEditor in project OpenClinica by OpenClinica.
the class ListStudySubjectTableFactory method configureColumns.
@Override
protected void configureColumns(TableFacade tableFacade, Locale locale) {
resword = ResourceBundleProvider.getWordsBundle(locale);
resformat = ResourceBundleProvider.getFormatBundle(locale);
tableFacade.setColumnProperties(columnNames);
Row row = tableFacade.getTable().getRow();
int index = 0;
configureColumn(row.getColumn(columnNames[index]), resword.getString("study_subject_ID"), new SubjectEditor(), null);
++index;
configureColumn(row.getColumn(columnNames[index]), resword.getString("subject_status"), new StatusCellEditor(), new StatusDroplistFilterEditor());
++index;
configureColumn(row.getColumn(columnNames[index]), resword.getString("site_id"), null, null);
++index;
configureColumn(row.getColumn(columnNames[index]), resword.getString("rule_oid"), null, null);
++index;
configureColumn(row.getColumn(columnNames[index]), resword.getString("gender"), null, null, true, false);
++index;
configureColumn(row.getColumn(columnNames[index]), resword.getString("secondary_ID"), null, null);
++index;
// group class columns
for (int i = index; i < index + studyGroupClasses.size(); i++) {
StudyGroupClassBean studyGroupClass = studyGroupClasses.get(i - index);
// configureColumn(row.getColumn(columnNames[i]),
// studyGroupClass.getName(), new
// StudyGroupClassCellEditor(studyGroupClass), null, false, false);
configureColumn(row.getColumn(columnNames[i]), studyGroupClass.getName(), new StudyGroupClassCellEditor(studyGroupClass), new SubjectGroupClassDroplistFilterEditor(studyGroupClass), true, false);
}
// study event definition columns
for (int i = index + studyGroupClasses.size(); i < columnNames.length - 1; i++) {
StudyEventDefinitionBean studyEventDefinition = studyEventDefinitions.get(i - (index + studyGroupClasses.size()));
configureColumn(row.getColumn(columnNames[i]), studyEventDefinition.getName(), new StudyEventDefinitionMapCellEditor(), new SubjectEventStatusDroplistFilterEditor(), true, false);
}
String actionsHeader = resword.getString("rule_actions") + "                                 ";
configureColumn(row.getColumn(columnNames[columnNames.length - 1]), actionsHeader, new ActionsCellEditor(), new DefaultActionsEditor(locale), true, false);
}
use of org.akaza.openclinica.control.DefaultActionsEditor in project OpenClinica by OpenClinica.
the class SubjectIdSDVFactory method configureColumns.
@Override
protected void configureColumns(TableFacade tableFacade, Locale locale) {
tableFacade.setColumnProperties("sdvStatus", "studySubjectId", "siteId", "personId", "studySubjectStatus", "group", "numberCRFComplete", "numberOfCRFsSDV", "totalEventCRF", "actions");
resword = ResourceBundleProvider.getWordsBundle(locale);
Row row = tableFacade.getTable().getRow();
SDVUtil sdvUtil = new SDVUtil();
String[] allTitles = new String[] { resword.getString("SDV_status"), resword.getString("study_subject_ID"), resword.getString("site_id"), resword.getString("person_ID"), resword.getString("study_subject_status"), resword.getString("group"), resword.getString("num_CRFs_completed"), resword.getString("num_CRFs_SDV"), resword.getString("total_events_CRF"), resword.getString("actions") };
sdvUtil.setTitles(allTitles, (HtmlTable) tableFacade.getTable());
sdvUtil.turnOffFilters(tableFacade, new String[] { "personId", "studySubjectStatus", "group", "numberCRFComplete", "numberOfCRFsSDV", "totalEventCRF", "actions" });
sdvUtil.turnOffSorts(tableFacade, new String[] { "sdvStatus", "studySubjectId", "siteId", "personId", "studySubjectStatus", "group", "numberCRFComplete", "numberOfCRFsSDV", "totalEventCRF" });
sdvUtil.setHtmlCellEditors(tableFacade, new String[] { "sdvStatus", "actions" }, false);
HtmlColumn sdvStatus = ((HtmlRow) row).getColumn("sdvStatus");
sdvStatus.getFilterRenderer().setFilterEditor(new SdvStatusFilter());
String actionsHeader = resword.getString("rule_actions") + "                            ";
configureColumn(row.getColumn("actions"), actionsHeader, sdvUtil.getCellEditorNoEscapes(), new DefaultActionsEditor(locale), true, false);
}
use of org.akaza.openclinica.control.DefaultActionsEditor in project OpenClinica by OpenClinica.
the class SDVUtil method renderEventCRFTableWithLimit.
/*
* private int getTotalRowCount(FilterSet filterSet, int studyId) {
*
*
* EventCRFDAO eventCRFDAO = new EventCRFDAO(dataSource);
*
* if (filterSet.getFilters().size() == 0) {
* return eventCRFDAO.countEventCRFsByStudy(studyId, studyId);
* }
*
* int count = 0;
* //Filter for study subject label
* StudySubjectDAO studySubjectDAO = new StudySubjectDAO(dataSource);
* StudySubjectBean studySubjectBean = new StudySubjectBean();
* StudyDAO studyDAO = new StudyDAO(dataSource);
* StudyBean studyBean = (StudyBean) studyDAO.findByPK(studyId);
* String subjectValue = "";
* String eventNameValue = "";
* String eventDateValue = "";
* String crfStatus = "";
* String sdvStatus = "";
* String studyIdentifier = "";
* String sdvRequirement = "";
*
* for (Filter filter : filterSet.getFilters()) {
*
* if (filter.getProperty().equalsIgnoreCase("studySubjectId")) {
* subjectValue = filter.getValue();
* continue;
* }
* if (filter.getProperty().equalsIgnoreCase("eventName")) {
* eventNameValue = filter.getValue();
* continue;
* }
*
* if (filter.getProperty().equalsIgnoreCase("eventDate")) {
* eventDateValue = filter.getValue();
* continue;
* }
*
* if (filter.getProperty().equalsIgnoreCase("crfStatus")) {
* crfStatus = filter.getValue();
* continue;
* }
*
* if (filter.getProperty().equalsIgnoreCase("sdvStatus")) {
* sdvStatus = filter.getValue();
* }
*
* if (filter.getProperty().equalsIgnoreCase("studyIdentifier")) {
* studyIdentifier = filter.getValue();
* }
*
* if (filter.getProperty().equalsIgnoreCase("sdvRequirementDefinition")) {
* sdvRequirement = filter.getValue();
* }
* }
*
* SourceDataVerification sourceDataVerification = null;
*
* if (subjectValue.length() > 0) {
* return eventCRFDAO.countEventCRFsByStudySubjectLabel(subjectValue, studyId, studyId);
* }
*
* if (eventNameValue.length() > 0) {
* return eventCRFDAO.countEventCRFsByEventName(eventNameValue);
* }
*
* if (eventDateValue.length() > 0) {
* return eventCRFDAO.countEventCRFsByEventDate(studyId, eventDateValue);
* }
* //SubjectEventStatus.getSubjectEventStatusIdByName(crfStatus)
* if (crfStatus.length() > 0) {
* return eventCRFDAO.countEventCRFsByCRFStatus(studyId, Integer.parseInt(crfStatus));
* }
*
* if (sdvStatus.length() > 0) {
* return eventCRFDAO.countEventCRFsByStudySDV(studyId, ("complete".equalsIgnoreCase(sdvStatus)));
* }
*
* if (studyIdentifier.length() > 0) {
* return eventCRFDAO.countEventCRFsByStudyIdentifier(studyId, studyId, studyIdentifier);
* }
*
* if (sdvRequirement.length() > 0) {
* ArrayList<Integer> reqs = new ArrayList<Integer>();
* if (sdvRequirement.contains("&")) {
* for (String requirement : sdvRequirement.split("&")) {
* reqs.add(SourceDataVerification.getByI18nDescription(requirement.trim()).getCode());
* }
* } else {
* reqs.add(SourceDataVerification.getByI18nDescription(sdvRequirement.trim()).getCode());
* }
* if (reqs.size() > 0) {
* Integer[] a = { 1 };
* return eventCRFDAO.countEventCRFsBySDVRequirement(studyId, studyId, reqs.toArray(a));
* }
* }
*
* return eventCRFDAO.countEventCRFsByStudy(studyId, studyId);
* }
*/
/*
* public String renderAllEventCRFTable(List<EventCRFBean> eventCRFBeans,
* HttpServletRequest request){
*
* Collection<SubjectSDVContainer> items = 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);
* tableFacade.setStateAttr("restore");
*
* String[] allColumns = new String[]{"studySubjectId","personId","secondaryId",
* "eventName", "eventDate","enrollmentDate","studySubjectStatus","crfNameVersion","crfStatus",
* "lastUpdatedDate","lastUpdatedBy","sdvStatusActions"};
*
* tableFacade.setColumnProperties("studySubjectId","personId","secondaryId",
* "eventName",
* "eventDate","enrollmentDate","studySubjectStatus","crfNameVersion","crfStatus",
* "lastUpdatedDate",
* "lastUpdatedBy","sdvStatusActions");
*
* tableFacade.addFilterMatcher(new MatcherKey(String.class, "studySubjectStatus"),
* new SubjectStatusMatcher());
* tableFacade.setItems(items);
*
* HtmlRow row = (HtmlRow) tableFacade.getTable().getRow();
* HtmlColumn studySubjectStatus = row.getColumn("studySubjectStatus");
* studySubjectStatus.getFilterRenderer().setFilterEditor(new SubjectStatusFilter());
*
*
* //fix HTML in columns
* setHtmlCellEditors(tableFacade,allColumns,true);
*
*
* //Create the custom toolbar
* SDVToolbar sDVToolbar = new SDVToolbar();
*
* // if(totalRowCount > 0){
* if(totalRowCount <= 25){
* sDVToolbar.setMaxRowsIncrements(new int[]{10,15,totalRowCount});}
* else if(totalRowCount <= 50){
* sDVToolbar.setMaxRowsIncrements(new int[]{10,25,totalRowCount});
* } else if(totalRowCount > 0) {
* sDVToolbar.setMaxRowsIncrements(new int[]{15,50,100});
* }
* tableFacade.setToolbar(sDVToolbar);
*
* //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 = {"Study Subject Id","Person Id","Secondary Id" ,"Event Name",
* "Event Date","Enrollment Date","Subject Status","CRF Name / Version","CRF Status",
* "Last Updated Date",
* "Last Updated By","SDV Status / Actions"};
*
* setTitles(allTitles,table);
*
* //format column dates
* formatColumns(table,new String[]{"eventDate","enrollmentDate","lastUpdatedDate"},
* request);
*
* table.getTableRenderer().setWidth("800");
* return tableFacade.render();
* }
*/
public String renderEventCRFTableWithLimit(HttpServletRequest request, int studyId, String pathPrefix) {
// boolean showMoreLink = Boolean.parseBoolean(request.getAttribute("showMoreLink").toString());//commented by
// Jamuna, throwing null pointer exception
boolean showMoreLink = Boolean.parseBoolean(request.getAttribute("showMoreLink") == null ? "false" : request.getAttribute("showMoreLink").toString());
TableFacade tableFacade = createTableFacade("sdv", request);
tableFacade.setStateAttr("sdv_restore");
resformat = ResourceBundleProvider.getFormatBundle(LocaleResolver.getLocale(request));
this.pathPrefix = pathPrefix;
String[] allColumns = new String[] { "sdvStatus", "studySubjectId", "studyIdentifier", "personId", "secondaryId", "eventName", "eventDate", "enrollmentDate", "studySubjectStatus", "crfNameVersion", "sdvRequirementDefinition", "crfStatus", "lastUpdatedDate", "lastUpdatedBy", "studyEventStatus", "sdvStatusActions" };
tableFacade.setColumnProperties("sdvStatus", "studySubjectId", "studyIdentifier", "personId", "secondaryId", "eventName", "eventDate", "enrollmentDate", "studySubjectStatus", "crfNameVersion", "sdvRequirementDefinition", "crfStatus", "lastUpdatedDate", "lastUpdatedBy", "studyEventStatus", "sdvStatusActions");
tableFacade.addFilterMatcher(new MatcherKey(String.class, "studySubjectStatus"), new SubjectStatusMatcher());
tableFacade.addFilterMatcher(new MatcherKey(String.class, "crfStatus"), new CrfStatusMatcher());
tableFacade.addFilterMatcher(new MatcherKey(String.class, "sdvStatus"), new SdvStatusMatcher());
tableFacade.addFilterMatcher(new MatcherKey(String.class, "sdvRequirementDefinition"), new SDVRequirementMatcher());
this.setDataAndLimitVariables(tableFacade, studyId, request);
// tableFacade.setItems(items);
HtmlRow row = (HtmlRow) tableFacade.getTable().getRow();
HtmlColumn studySubjectStatus = row.getColumn("studySubjectStatus");
studySubjectStatus.getFilterRenderer().setFilterEditor(new SubjectStatusFilter());
HtmlColumn crfStatus = row.getColumn("crfStatus");
crfStatus.getFilterRenderer().setFilterEditor(new CrfStatusFilter());
HtmlColumn actions = row.getColumn("sdvStatusActions");
actions.getFilterRenderer().setFilterEditor(new DefaultActionsEditor(LocaleResolver.getLocale(request)));
HtmlColumn sdvStatus = row.getColumn("sdvStatus");
sdvStatus.getFilterRenderer().setFilterEditor(new SdvStatusFilter());
HtmlColumn sdvRequirementDefinition = row.getColumn("sdvRequirementDefinition");
sdvRequirementDefinition.getFilterRenderer().setFilterEditor(new SDVRequirementFilter());
// fix HTML in columns
setHtmlCellEditors(tableFacade, allColumns, true);
// temporarily disable some of the filters for now
turnOffFilters(tableFacade, new String[] { "personId", "secondaryId", "enrollmentDate", "studySubjectStatus", "crfNameVersion", "lastUpdatedDate", "lastUpdatedBy", "eventDate", "studyEventStatus" });
turnOffSorts(tableFacade, new String[] { "sdvStatus", "studySubjectId", "studyIdentifier", "personId", "secondaryId", "eventName", "eventDate", "enrollmentDate", "studySubjectStatus", "crfNameVersion", "sdvRequirementDefinition", "crfStatus", "lastUpdatedDate", "lastUpdatedBy", "studyEventStatus", "sdvStatusActions" });
// Create the custom toolbar
SDVToolbar sDVToolbar = new SDVToolbar(showMoreLink);
// if(totalRowCount > 0){
sDVToolbar.setMaxRowsIncrements(new int[] { 15, 25, 50 });
tableFacade.setToolbar(sDVToolbar);
tableFacade.setView(new SDVView(LocaleResolver.getLocale(request), request));
// Fix column titles
HtmlTable table = (HtmlTable) tableFacade.getTable();
// i18n caption; TODO: convert to Spring messages
ResourceBundle resword = ResourceBundle.getBundle("org.akaza.openclinica.i18n.words", LocaleResolver.getLocale(request));
String[] allTitles = { resword.getString("SDV_status"), resword.getString("study_subject_ID"), resword.getString("site_id"), resword.getString("person_ID"), resword.getString("secondary_ID"), resword.getString("event_name"), resword.getString("event_date"), resword.getString("enrollment_date"), resword.getString("subject_status"), resword.getString("CRF_name") + " / " + resword.getString("version"), resword.getString("SDV_requirement"), resword.getString("CRF_status"), resword.getString("last_updated_date"), resword.getString("last_updated_by"), resword.getString("study_event_status"), resword.getString("actions") };
setTitles(allTitles, table);
// format column dates
formatColumns(table, new String[] { "eventDate", "enrollmentDate", "lastUpdatedDate" }, request);
table.getTableRenderer().setWidth("800");
return tableFacade.render();
}
use of org.akaza.openclinica.control.DefaultActionsEditor in project OpenClinica by OpenClinica.
the class ScheduledJobTableFactory method configureColumns.
@Override
protected void configureColumns(TableFacade tableFacade, Locale locale) {
tableFacade.setColumnProperties("datasetId", "fireTime", "exportFileName", "jobStatus", "action");
// TODO the following is throwing null pointer, check later
resword = ResourceBundleProvider.getWordsBundle(locale);
Row row = tableFacade.getTable().getRow();
String[] allTitles = new String[] { "DataSet Name", "Fire Time", "Export File", "Job Status", "Actions" };
// TODO check if this is viable
SDVUtil sdvUtil = new SDVUtil();
sdvUtil.setTitles(allTitles, (HtmlTable) tableFacade.getTable());
// HtmlColumn sdvStatus = ((HtmlRow) row).getColumn("checkbox");
// sdvStatus.getFilterRenderer().setFilterEditor(new SdvStatusFilter());
sdvUtil.setHtmlCellEditors(tableFacade, new String[] { "action" }, false);
configureColumn(row.getColumn("action"), "Actions", sdvUtil.getCellEditorNoEscapes(), new DefaultActionsEditor(locale), true, false);
}
Aggregations