/** * Sets the widths of the different columns (percentages). * <P> * You can give up relative values of borderwidths. * The sum of these values will be considered 100%. * The values will be recalculated as percentages of this sum. * * @param widths an array with values * @throws DocumentException */ public void setWidths(int[] widths) throws DocumentException { float tb[] = new float[widths.length]; for (int k = 0; k < widths.length; ++k) tb[k] = widths[k]; setWidths(tb); }
/** * Sets the widths of the different columns (percentages). * <P> * You can give up relative values of borderwidths. * The sum of these values will be considered 100%. * The values will be recalculated as percentages of this sum. * * @param widths an array with values * @throws DocumentException */ public void setWidths(int[] widths) throws DocumentException { float[] tb = new float[widths.length]; for (int k = 0; k < widths.length; ++k) tb[k] = widths[k]; setWidths(tb); }
/** * Sets the widths of the different columns (percentages). * <P> * You can give up relative values of borderwidths. * The sum of these values will be considered 100%. * The values will be recalculated as percentages of this sum. * * @param widths an array with values * @throws DocumentException */ public void setWidths(int[] widths) throws DocumentException { float tb[] = new float[widths.length]; for (int k = 0; k < widths.length; ++k) tb[k] = widths[k]; setWidths(tb); }
/** * Deletes a column in this table. * * @param column the number of the column that has to be deleted * @throws BadElementException */ public void deleteColumn(int column) throws BadElementException { float[] newWidths = new float[--columns]; System.arraycopy(widths, 0, newWidths, 0, column); System.arraycopy(widths, column + 1, newWidths, column, columns - column); setWidths(newWidths); System.arraycopy(widths, 0, newWidths, 0, columns); widths = newWidths; Row row; int size = rows.size(); for (int i = 0; i < size; i++) { row = (Row) rows.get(i); row.deleteColumn(column); rows.set(i, row); } if (column == columns) { curPosition.setLocation(curPosition.x+1, 0); } }
/** * Deletes a column in this table. * * @param column the number of the column that has to be deleted * @throws BadElementException */ public void deleteColumn(int column) throws BadElementException { float newWidths[] = new float[--columns]; System.arraycopy(widths, 0, newWidths, 0, column); System.arraycopy(widths, column + 1, newWidths, column, columns - column); setWidths(newWidths); System.arraycopy(widths, 0, newWidths, 0, columns); widths = newWidths; Row row; int size = rows.size(); for (int i = 0; i < size; i++) { row = (Row) rows.get(i); row.deleteColumn(column); rows.set(i, row); } if (column == columns) { curPosition.setLocation(curPosition.x+1, 0); } }
/** * Deletes a column in this table. * * @param column the number of the column that has to be deleted * @throws BadElementException */ public void deleteColumn(int column) throws BadElementException { float newWidths[] = new float[--columns]; System.arraycopy(widths, 0, newWidths, 0, column); System.arraycopy(widths, column + 1, newWidths, column, columns - column); setWidths(newWidths); System.arraycopy(widths, 0, newWidths, 0, columns); widths = newWidths; Row row; int size = rows.size(); for (int i = 0; i < size; i++) { row = (Row) rows.get(i); row.deleteColumn(column); rows.set(i, row); } if (column == columns) { curPosition.setLocation(curPosition.x+1, 0); } }
/** * Write the table's header columns to an iText document. * @see org.displaytag.render.TableWriterTemplate#writeTableHeader(org.displaytag.model.TableModel) * @throws BadElementException if an error occurs while writing header. */ protected void writeTableHeader(TableModel model) throws BadElementException { Iterator iterator = model.getHeaderCellList().iterator(); float[] widths = new float[model.getNumberOfColumns()]; for (int i = 0; iterator.hasNext(); i++) { HeaderCell headerCell = (HeaderCell) iterator.next(); widths[i] = this.getCellWidth(headerCell); String columnHeader = headerCell.getTitle(); if (columnHeader == null) { columnHeader = StringUtils.capitalize(headerCell.getBeanPropertyName()); } Cell hdrCell = this.getHeaderCell(columnHeader); this.table.addCell(hdrCell); } this.table.setWidths(widths); this.table.endHeaders(); }
widths[i] = Float.parseFloat(value + "f"); table.setWidths(widths); } else { value = attributes.getProperty(ElementTags.COLUMNS);
widths[i] = Float.parseFloat(value + "f"); table.setWidths(widths); } else { value = attributes.getProperty(ElementTags.COLUMNS);
widths[i] = Float.parseFloat(value + "f"); table.setWidths(widths); } else { value = attributes.getProperty(ElementTags.COLUMNS);
/** * This method creates a report group for the error message on the report * * @throws DocumentException */ private void generateErrorColumnHeaders() throws DocumentException { try { int headerwidths[] = { 60 }; Table aTable = new Table(1, 1); // 2 columns, 1 rows. aTable.setAutoFillEmptyCells(true); aTable.setPadding(3); aTable.setWidths(headerwidths); aTable.setWidth(100); Cell cell; Font font = FontFactory.getFont(FontFactory.HELVETICA, 9, Font.NORMAL); cell = new Cell(new Phrase("Error(s)", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setGrayFill(0.9f); aTable.addCell(cell); this.document.add(aTable); } catch (Exception e) { throw new RuntimeException("DepreciationReport.generateErrorColumnHeaders() - Error: " + e.getMessage()); } }
widths[2] = 0f; table.setWidths(widths); Cell tmp; if (arrayList.isEmpty()) {
widths[2] = 0f; table.setWidths(widths); Cell tmp; if (arrayList.isEmpty()) {
widths[2] = 0f; table.setWidths(widths); Cell tmp; if (arrayList.isEmpty()) {
/** * This method creates the headers for the report statistics */ private void generateColumnHeaders() { try { int headerwidths[] = { 40, 15 }; Table aTable = new Table(2, 1); // 2 columns, 1 rows. aTable.setAutoFillEmptyCells(true); aTable.setPadding(3); aTable.setWidths(headerwidths); aTable.setWidth(100); Cell cell; Font font = FontFactory.getFont(FontFactory.HELVETICA, 9, Font.NORMAL); cell = new Cell(new Phrase(SpringContext.getBean(KualiConfigurationService.class).getPropertyString(CamsKeyConstants.Depreciation.MSG_REPORT_DEPRECIATION_HEADING1), font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setGrayFill(0.9f); aTable.addCell(cell); cell = new Cell(new Phrase(SpringContext.getBean(KualiConfigurationService.class).getPropertyString(CamsKeyConstants.Depreciation.MSG_REPORT_DEPRECIATION_HEADING2), font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setGrayFill(0.9f); aTable.addCell(cell); this.document.add(aTable); } catch (Exception e) { throw new RuntimeException("DepreciationReport.generateColumnHeaders() - Error: " + e.getMessage()); } }
aTable.setWidths(columnwidths); aTable.setWidth(100); aTable.setBorder(Rectangle.NO_BORDER);
cellWidths[i] = (float) StrictGeomUtility.toExternalValue( sheetLayout.getCellWidth( i, i + 1 ) ); table.setWidths( cellWidths );