Search in sources :

Example 1 with CellEditor

use of org.jmesa.view.editor.CellEditor in project OpenClinica by OpenClinica.

the class EventStatusView method setCustomCellEditors.

/**
	     * Setting the group cell editor.
	     */
private void setCustomCellEditors() {
    List<Column> columns = getTable().getRow().getColumns();
    for (Column column : columns) {
        CellEditor decoratedCellEditor = column.getCellRenderer().getCellEditor();
        column.getCellRenderer().setCellEditor(new GroupCellEditor(decoratedCellEditor));
    }
}
Also used : Column(org.jmesa.view.component.Column) GroupCellEditor(org.jmesa.view.editor.GroupCellEditor) CellEditor(org.jmesa.view.editor.CellEditor) GroupCellEditor(org.jmesa.view.editor.GroupCellEditor)

Example 2 with CellEditor

use of org.jmesa.view.editor.CellEditor in project OpenClinica by OpenClinica.

the class StudyStatisticsView method setCustomCellEditors.

/**
	     * Setting the group cell editor.
	     */
private void setCustomCellEditors() {
    List<Column> columns = getTable().getRow().getColumns();
    for (Column column : columns) {
        CellEditor decoratedCellEditor = column.getCellRenderer().getCellEditor();
        column.getCellRenderer().setCellEditor(new GroupCellEditor(decoratedCellEditor));
    }
}
Also used : Column(org.jmesa.view.component.Column) GroupCellEditor(org.jmesa.view.editor.GroupCellEditor) CellEditor(org.jmesa.view.editor.CellEditor) GroupCellEditor(org.jmesa.view.editor.GroupCellEditor)

Example 3 with CellEditor

use of org.jmesa.view.editor.CellEditor in project OpenClinica by OpenClinica.

the class ViewCRFServlet method html.

private String html(TableFacade tableFacade) {
    // set the column properties
    tableFacade.setColumnProperties("versionName", "ruleName", "ruleExpression", "executeOnPlaceHolder", "actionTypePlaceHolder", "actionSummaryPlaceHolder", "link");
    HtmlTable table = (HtmlTable) tableFacade.getTable();
    table.setCaption(resword.getString("rule_rules"));
    table.getTableRenderer().setWidth("800px");
    HtmlRow row = table.getRow();
    HtmlColumn versionName = row.getColumn("versionName");
    versionName.setTitle(resword.getString("CRF_version"));
    HtmlColumn ruleName = row.getColumn("ruleName");
    ruleName.setTitle(resword.getString("rule_name"));
    HtmlColumn career = row.getColumn("ruleExpression");
    career.setWidth("100px");
    career.setTitle(resword.getString("rule_expression"));
    HtmlColumn executeOn = row.getColumn("executeOnPlaceHolder");
    executeOn.setSortable(false);
    executeOn.setFilterable(false);
    executeOn.setTitle(resword.getString("rule_execute_on"));
    executeOn.getCellRenderer().setCellEditor(new CellEditor() {

        @SuppressWarnings("unchecked")
        public Object getValue(Object item, String property, int rowcount) {
            String value = "";
            List<RuleActionBean> ruleActions = (List<RuleActionBean>) new BasicCellEditor().getValue(item, "actions", rowcount);
            for (int i = 0; i < ruleActions.size(); i++) {
                value += ruleActions.get(i).getExpressionEvaluatesTo();
                // Do not add horizontal line after last Summary
                if (i != ruleActions.size() - 1) {
                    value += "<hr>";
                }
            }
            return value;
        }
    });
    HtmlColumn actionTypePlaceHolder = row.getColumn("actionTypePlaceHolder");
    actionTypePlaceHolder.setSortable(false);
    actionTypePlaceHolder.setFilterable(false);
    actionTypePlaceHolder.setTitle(resword.getString("rule_action_type"));
    actionTypePlaceHolder.getCellRenderer().setCellEditor(new CellEditor() {

        @SuppressWarnings("unchecked")
        public Object getValue(Object item, String property, int rowcount) {
            String value = "";
            List<RuleActionBean> ruleActions = (List<RuleActionBean>) new BasicCellEditor().getValue(item, "actions", rowcount);
            for (int i = 0; i < ruleActions.size(); i++) {
                value += ruleActions.get(i).getActionType().name();
                // Do not add horizontal line after last Summary
                if (i != ruleActions.size() - 1) {
                    value += "<hr>";
                }
            }
            return value;
        }
    });
    HtmlColumn actionSummaryPlaceHolder = row.getColumn("actionSummaryPlaceHolder");
    actionSummaryPlaceHolder.setSortable(false);
    actionSummaryPlaceHolder.setFilterable(false);
    actionSummaryPlaceHolder.setTitle(resword.getString("rule_action_summary"));
    actionSummaryPlaceHolder.getCellRenderer().setCellEditor(new CellEditor() {

        @SuppressWarnings("unchecked")
        public Object getValue(Object item, String property, int rowcount) {
            String value = "";
            List<RuleActionBean> ruleActions = (List<RuleActionBean>) new BasicCellEditor().getValue(item, "actions", rowcount);
            for (int i = 0; i < ruleActions.size(); i++) {
                value += ruleActions.get(i).getSummary();
                // Do not add horizontal line after last Summary
                if (i != ruleActions.size() - 1) {
                    value += "<hr>";
                }
            }
            return value;
        }
    });
    HtmlColumn link = row.getColumn("link");
    link.setSortable(false);
    link.setFilterable(false);
    link.setTitle(resword.getString("action"));
    link.getCellRenderer().setCellEditor(new CellEditor() {

        @SuppressWarnings("unchecked")
        public Object getValue(Object item, String property, int rowcount) {
            String param1 = (String) new BasicCellEditor().getValue(item, "ruleSetRuleId", rowcount);
            String param2 = (String) new BasicCellEditor().getValue(item, "versionId", rowcount);
            HtmlBuilder html = new HtmlBuilder();
            html.a().href().quote().append(request.getContextPath() + "/RunRule?ruleSetRuleId=" + param1 + "&versionId=" + param2 + "&action=dryRun").quote().close();
            html.img().name("bt_View1").src("images/bt_ExexuteRules.gif").border("0").end();
            html.aEnd();
            return html.toString();
        }
    });
    // Return the Html.
    return tableFacade.render();
}
Also used : RuleActionBean(org.akaza.openclinica.domain.rule.action.RuleActionBean) BasicCellEditor(org.jmesa.view.editor.BasicCellEditor) HtmlTable(org.jmesa.view.html.component.HtmlTable) CellEditor(org.jmesa.view.editor.CellEditor) BasicCellEditor(org.jmesa.view.editor.BasicCellEditor) HtmlBuilder(org.jmesa.view.html.HtmlBuilder) HtmlRow(org.jmesa.view.html.component.HtmlRow) ArrayList(java.util.ArrayList) List(java.util.List) HtmlColumn(org.jmesa.view.html.component.HtmlColumn)

Example 4 with CellEditor

use of org.jmesa.view.editor.CellEditor in project OpenClinica by OpenClinica.

the class StatisticsView method setCustomCellEditors.

/**
	     * Setting the group cell editor.
	     */
private void setCustomCellEditors() {
    List<Column> columns = getTable().getRow().getColumns();
    for (Column column : columns) {
        CellEditor decoratedCellEditor = column.getCellRenderer().getCellEditor();
        column.getCellRenderer().setCellEditor(new GroupCellEditor(decoratedCellEditor));
    }
}
Also used : Column(org.jmesa.view.component.Column) GroupCellEditor(org.jmesa.view.editor.GroupCellEditor) CellEditor(org.jmesa.view.editor.CellEditor) GroupCellEditor(org.jmesa.view.editor.GroupCellEditor)

Example 5 with CellEditor

use of org.jmesa.view.editor.CellEditor in project OpenClinica by OpenClinica.

the class StudySubjectStatusView method setCustomCellEditors.

/**
	     * Setting the group cell editor.
	     */
private void setCustomCellEditors() {
    List<Column> columns = getTable().getRow().getColumns();
    for (Column column : columns) {
        CellEditor decoratedCellEditor = column.getCellRenderer().getCellEditor();
        column.getCellRenderer().setCellEditor(new GroupCellEditor(decoratedCellEditor));
    }
}
Also used : Column(org.jmesa.view.component.Column) GroupCellEditor(org.jmesa.view.editor.GroupCellEditor) CellEditor(org.jmesa.view.editor.CellEditor) GroupCellEditor(org.jmesa.view.editor.GroupCellEditor)

Aggregations

CellEditor (org.jmesa.view.editor.CellEditor)6 Column (org.jmesa.view.component.Column)5 GroupCellEditor (org.jmesa.view.editor.GroupCellEditor)4 ArrayList (java.util.ArrayList)2 List (java.util.List)2 RuleActionBean (org.akaza.openclinica.domain.rule.action.RuleActionBean)2 BasicCellEditor (org.jmesa.view.editor.BasicCellEditor)2 HtmlColumn (org.jmesa.view.html.component.HtmlColumn)2 HtmlRow (org.jmesa.view.html.component.HtmlRow)2 HtmlTable (org.jmesa.view.html.component.HtmlTable)2 Row (org.jmesa.view.component.Row)1 Table (org.jmesa.view.component.Table)1 HtmlBuilder (org.jmesa.view.html.HtmlBuilder)1