TableConfig config = cfg.getTable(tableName);
Application app = FacesContext.getCurrentInstance().getApplication();
for (ColumnConfig col : config.getColumns()) {
Column cl = (Column) app.createComponent(Column.COMPONENT_TYPE);
if (col.getFilter() != null && !col.getFilter().isEmpty())
cl.setValueExpression("filterBy", JsfUtil.getExpression(col.getFilter()));
if (col.getSort() != null && !col.getSort().isEmpty())
cl.setValueExpression("sortBy", JsfUtil.getExpression(col.getSort()));
if (col.getFilterEvent() != null && !col.getFilterEvent().isEmpty())
cl.setValueExpression("filterEvent", JsfUtil.getExpression(col.getFilterEvent()));
if (col.getFilterOptions() != null && !col.getFilterOptions().isEmpty())
cl.setValueExpression("filterOptions", JsfUtil.getExpression(col.getFilterOptions()));
if (col.getSortFunction() != null && !col.getSortFunction().isEmpty())
cl.setSortFunction(col.getSortFunctionExp());
if (col.getColspan() != null && !col.getColspan().isEmpty())
cl.setValueExpression("colspan", JsfUtil.getExpression(col.getColspan()));
if (col.getFilterStyle() != null && !col.getFilterStyle().isEmpty())
cl.setValueExpression("filterStyle", JsfUtil.getExpression(col.getFilterStyle()));
if (col.getStyle() != null && !col.getStyle().isEmpty())
cl.setValueExpression("style", JsfUtil.getExpression(col.getStyle()));
if (col.getName() != null && !col.getName().isEmpty())
cl.setValueExpression("headerText", JsfUtil.getExpression(col.getName()));
/*
* Output text
*/
HtmlOutputText text = (HtmlOutputText)FacesContext.getCurrentInstance().getApplication().createComponent(HtmlOutputText.COMPONENT_TYPE);
text.setValueExpression("value", JsfUtil.getExpression (col.getValue()));
text.setValueExpression("style", JsfUtil.getExpression (col.getTextStyle()));
if (col.getConverter() != null && !col.getConverter().isEmpty()) {
try {
text.setConverter((Converter)Class.forName(col.getConverter()).newInstance());
}
catch (Exception ex) {
Logger.getLogger(JsfUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
cl.getChildren().add(text);
table.getChildren().add(cl);
// table.getColumns().add(cl);
}
}