private RowModel mapsXmlRowToRowModel( List<ColumnMetadata> columnMetaData, Row xmlRow, ComparatorType keyType, GenericTypeEnum[] typesBelongingCompositeTypeForKeyType, ComparatorType comparatorType, GenericTypeEnum[] typesBelongingCompositeTypeForComparatorType, ComparatorType subComparatorType, ComparatorType defaultColumnValueType) { RowModel row = new RowModel(); row.setKey( TypeExtractor.constructGenericType( xmlRow.getKey(), keyType, typesBelongingCompositeTypeForKeyType)); row.setColumns( mapXmlColumnsToColumnsModel( columnMetaData, xmlRow.getColumn(), comparatorType, typesBelongingCompositeTypeForComparatorType, defaultColumnValueType)); row.setSuperColumns( mapXmlSuperColumnsToSuperColumnsModel( columnMetaData, xmlRow.getSuperColumn(), comparatorType, subComparatorType, defaultColumnValueType)); return row; }
@Override public void updateContent(int colIndex, int rowIndex, ExceptionResult exceptionResult) { Row row = rows.get(rowIndex); Cell cell = row.getColumn(colIndex); if (exceptionResult.hasMessage()) { cell.setExceptionResult(exceptionResult); } else { Row childRow = makeChildRow( row, new TextNode("<pre>" + Utils.escapeHTML(exceptionResult.getException()) + "</pre>"), "exception"); insertRowAfter(row, childRow); row.setExecutionResult(exceptionResult.getExecutionResult()); } }
public void testParser() throws Exception { Table table = TableTagParser.getInstance() .parser( ClasspathResource.getURI( "org/mifos/framework/util/resources/customTableTag/example.xml") .toString()); Assert.assertNotNull(table); HeaderDetails details = table.getHeaderDetails(); Assert.assertEquals("drawtablerowbold", details.getHeaderStyle()); StringBuilder builder = new StringBuilder(); details.getHeaderInfo(builder); assertContains("drawtablerowbold", builder.toString()); Row row = table.getRow(); Assert.assertEquals("true", row.getBottomLineRequired()); Assert.assertEquals("100", row.getTotWidth()); Column[] columns = row.getColumn(); for (int i = 0; i < columns.length; i++) { if (i == 0) { Assert.assertEquals("text", columns[i].getColumnType()); Assert.assertEquals("Name", columns[i].getLabel()); Assert.assertEquals("Name", columns[i].getValue()); Assert.assertEquals("method", columns[i].getValueType()); StringBuilder builder2 = new StringBuilder(); Locale locale = new Locale("en", "GB"); OfficeView officeView = new OfficeView( Short.valueOf("1"), "abcd", Short.valueOf("1"), "branch", Integer.valueOf("1")); ColumnDetails columnDetails = new ColumnDetails(); columnDetails.setRowStyle("drawtablerowbold"); columnDetails.setAlign("Down"); columns[i].setColumnDetials(columnDetails); columns[i].generateTableColumn(builder2, officeView, locale, locale, locale); Assert.assertEquals( "<td class=\"drawtablerowbold\" align=\"Down\" > </td>", builder2.toString()); } } }