Search in sources :

Example 6 with HtmlRow

use of org.jmesa.view.html.component.HtmlRow in project OpenClinica by OpenClinica.

the class ViewCRFServlet method renderStudiesTable.

/*
     * Create a JMesa-based table for showing the studies associated with a CRF.
     */
private String renderStudiesTable(List<StudyBean> studyBeans) {
    Collection<StudyRowContainer> items = getStudyRows(studyBeans);
    TableFacade tableFacade = createTableFacade("studies", request);
    tableFacade.setColumnProperties("name", "uniqueProtocolid", "actions");
    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 captionText = resourceBundle.getString("studies_using_crf");
         * if (captionText == null || "".equalsIgnoreCase(captionText)) {
         * captionText = "Studies Using this CRF for Data Entry";
         * }
         * table.setCaption(captionText);
         */
    HtmlRow row = table.getRow();
    SDVUtil sDVUtil = new SDVUtil();
    String[] colNames = new String[] { "name", "uniqueProtocolid", "actions" };
    sDVUtil.setHtmlCellEditors(tableFacade, colNames, true);
    HtmlColumn firstName = row.getColumn("name");
    firstName.setTitle("Study Name");
    HtmlColumn protocol = row.getColumn("uniqueProtocolid");
    protocol.setTitle("Unique Protocol Id");
    HtmlColumn actions = row.getColumn("actions");
    actions.setTitle("Actions");
    return tableFacade.render();
}
Also used : HtmlTable(org.jmesa.view.html.component.HtmlTable) SDVUtil(org.akaza.openclinica.web.table.sdv.SDVUtil) TableFacadeFactory.createTableFacade(org.jmesa.facade.TableFacadeFactory.createTableFacade) TableFacade(org.jmesa.facade.TableFacade) HtmlRow(org.jmesa.view.html.component.HtmlRow) HtmlColumn(org.jmesa.view.html.component.HtmlColumn)

Example 7 with HtmlRow

use of org.jmesa.view.html.component.HtmlRow in project OpenClinica by OpenClinica.

the class SDVUtil method formatColumns.

public void formatColumns(HtmlTable table, String[] columnNames, HttpServletRequest request) {
    Locale locale = ResourceBundleProvider.localeMap.get(Thread.currentThread());
    if (locale == null) {
        ResourceBundleProvider.updateLocale(LocaleResolver.getLocale(request));
    }
    ResourceBundle bundle = ResourceBundleProvider.getFormatBundle();
    String format = bundle.getString("date_time_format_string");
    HtmlRow row = table.getRow();
    HtmlColumn column = null;
    for (String colName : columnNames) {
        column = row.getColumn(colName);
        if (column != null) {
            column.getCellRenderer().setCellEditor(new DateCellEditor(format));
        }
    }
}
Also used : Locale(java.util.Locale) ResourceBundle(java.util.ResourceBundle) HtmlRow(org.jmesa.view.html.component.HtmlRow) DateCellEditor(org.jmesa.view.editor.DateCellEditor) HtmlColumn(org.jmesa.view.html.component.HtmlColumn)

Example 8 with HtmlRow

use of org.jmesa.view.html.component.HtmlRow in project OpenClinica by OpenClinica.

the class SDVUtil method turnOffSorts.

public void turnOffSorts(TableFacade tableFacade, String[] colNames) {
    HtmlRow row = (HtmlRow) tableFacade.getTable().getRow();
    HtmlColumn col = null;
    for (String colName : colNames) {
        col = row.getColumn(colName);
        col.setSortable(false);
    }
}
Also used : HtmlRow(org.jmesa.view.html.component.HtmlRow) HtmlColumn(org.jmesa.view.html.component.HtmlColumn)

Example 9 with HtmlRow

use of org.jmesa.view.html.component.HtmlRow in project OpenClinica by OpenClinica.

the class SDVUtil method turnOffFilters.

public void turnOffFilters(TableFacade tableFacade, String[] colNames) {
    HtmlRow row = (HtmlRow) tableFacade.getTable().getRow();
    HtmlColumn col = null;
    for (String colName : colNames) {
        col = row.getColumn(colName);
        col.setFilterable(false);
    }
}
Also used : HtmlRow(org.jmesa.view.html.component.HtmlRow) HtmlColumn(org.jmesa.view.html.component.HtmlColumn)

Example 10 with HtmlRow

use of org.jmesa.view.html.component.HtmlRow in project OpenClinica by OpenClinica.

the class SDVUtil method setTitles.

/* Create the titles for the HTML table's rows */
public void setTitles(String[] allTitles, HtmlTable table) {
    HtmlRow row = table.getRow();
    HtmlColumn tempColumn = null;
    for (int i = 0; i < allTitles.length; i++) {
        tempColumn = row.getColumn(i);
        tempColumn.setTitle(allTitles[i]);
    }
}
Also used : HtmlRow(org.jmesa.view.html.component.HtmlRow) HtmlColumn(org.jmesa.view.html.component.HtmlColumn)

Aggregations

HtmlColumn (org.jmesa.view.html.component.HtmlColumn)12 HtmlRow (org.jmesa.view.html.component.HtmlRow)12 HtmlTable (org.jmesa.view.html.component.HtmlTable)6 TableFacade (org.jmesa.facade.TableFacade)4 TableFacadeFactory.createTableFacade (org.jmesa.facade.TableFacadeFactory.createTableFacade)4 ResourceBundle (java.util.ResourceBundle)3 DefaultActionsEditor (org.akaza.openclinica.control.DefaultActionsEditor)2 SDVToolbar (org.akaza.openclinica.controller.helper.table.SDVToolbar)2 MatcherKey (org.jmesa.core.filter.MatcherKey)2 DateCellEditor (org.jmesa.view.editor.DateCellEditor)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Locale (java.util.Locale)1 RuleActionBean (org.akaza.openclinica.domain.rule.action.RuleActionBean)1 SDVUtil (org.akaza.openclinica.web.table.sdv.SDVUtil)1 Row (org.jmesa.view.component.Row)1 BasicCellEditor (org.jmesa.view.editor.BasicCellEditor)1 CellEditor (org.jmesa.view.editor.CellEditor)1 HtmlBuilder (org.jmesa.view.html.HtmlBuilder)1