private void copyRowGroups(JRCrosstab crosstab, JRBaseObjectFactory factory) { JRCrosstabRowGroup[] crossRowGroups = crosstab.getRowGroups(); if (crossRowGroups != null) { this.rowGroups = new JRCrosstabRowGroup[crossRowGroups.length]; for (int i = 0; i < crossRowGroups.length; ++i) { this.rowGroups[i] = factory.getCrosstabRowGroup(crossRowGroups[i]); } } }
public static JRElement getElementByKey(JRCrosstab crosstab, String key) { JRElement element = null; if (crosstab.getHeaderCell() != null) { element = crosstab.getHeaderCell().getElementByKey(key); } if (element == null) { element = getHeadersElement(crosstab.getRowGroups(), key); } if (element == null) { element = getHeadersElement(crosstab.getColumnGroups(), key); } if (element == null) { if (crosstab instanceof JRDesignCrosstab) { List cellsList = ((JRDesignCrosstab) crosstab).getCellsList(); for (Iterator it = cellsList.iterator(); element == null && it.hasNext(); ) { JRCrosstabCell cell = (JRCrosstabCell) it.next(); element = cell.getContents().getElementByKey(key); } } else { JRCrosstabCell[][] cells = crosstab.getCells(); for (int i = cells.length - 1; element == null && i >= 0; --i) { for (int j = cells[i].length - 1; element == null && j >= 0; --j) { JRCrosstabCell cell = cells[i][j]; if (cell != null) { element = cell.getContents().getElementByKey(key); } } } } } if (element == null && crosstab.getWhenNoDataCell() != null) { element = crosstab.getWhenNoDataCell().getElementByKey(key); } return element; }