// This is a simple to use column model that uses OGNL to access
// the data to be displayed in each column. The first string is
// the name of the column, and the second is the OGNL expression.
// We also enable sorting for all columns by setting the second argument to true
ITableColumnModel objColumnModel =
new ExpressionTableColumnModel(
new String[] {
"Locale", "toString()",
"Language", "displayLanguage",
"Country", "displayCountry",
"Variant", "displayVariant",
"ISO Language", "ISO3Language",
"ISO Country", "ISO3Country",
},
true);
// Modify the columns to render headers designed for use in a form.
// These headers ensure that the form is submitted when clicking on them
// and sorting by the column so that current form selections are preserved.
// Skip this if the table is not used in a form or you do not need
// that behaviour.
// This is usually used in conjunction with the TableFormPages and
// the TableFormRows components.
ITableRendererSource objRendererSource = new SimpleTableColumnFormRendererSource();
for (Iterator it = objColumnModel.getColumns(); it.hasNext(); ) {
ExpressionTableColumn objColumn = (ExpressionTableColumn) it.next();
objColumn.setColumnRendererSource(objRendererSource);
}