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; }
public JRBaseCrosstab(JRCrosstab crosstab, JRBaseObjectFactory factory, int id) { super(crosstab, factory); this.id = id; this.columnBreakOffset = crosstab.getColumnBreakOffset(); this.repeatColumnHeaders = crosstab.isRepeatColumnHeaders(); this.repeatRowHeaders = crosstab.isRepeatRowHeaders(); this.runDirectionValue = crosstab.getRunDirectionValue(); this.ignoreWidth = crosstab.getIgnoreWidth(); this.dataset = factory.getCrosstabDataset(crosstab.getDataset()); copyParameters(crosstab, factory); copyVariables(crosstab, factory); headerCell = factory.getCell(crosstab.getHeaderCell()); copyRowGroups(crosstab, factory); copyColumnGroups(crosstab, factory); copyMeasures(crosstab, factory); copyCells(crosstab, factory); whenNoDataCell = factory.getCell(crosstab.getWhenNoDataCell()); }