use of org.jmesa.view.editor.BasicCellEditor 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();
}
use of org.jmesa.view.editor.BasicCellEditor in project OpenClinica by OpenClinica.
the class ViewCRFServlet method export.
private void export(TableFacade tableFacade) {
// set the column properties
tableFacade.setColumnProperties("versionName", "ruleName", "ruleExpression", "executeOnPlaceHolder", "actionTypePlaceHolder", "actionSummaryPlaceHolder");
Table table = tableFacade.getTable();
table.setCaption("Rules");
Row row = table.getRow();
Column executeOn = row.getColumn("executeOnPlaceHolder");
executeOn.setTitle("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 += " | ";
}
}
return value;
}
});
Column actionTypePlaceHolder = row.getColumn("actionTypePlaceHolder");
actionTypePlaceHolder.setTitle("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 += " | ";
}
}
return value;
}
});
Column actionSummaryPlaceHolder = row.getColumn("actionSummaryPlaceHolder");
actionSummaryPlaceHolder.setTitle("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 += " | ";
}
}
return value;
}
});
tableFacade.render();
}
Aggregations