From: Jorg J. <jj...@us...> - 2002-08-28 04:24:34
|
Update of /cvsroot/compiere/print/src/org/compiere/print/layout In directory usw-pr-cvs1:/tmp/cvs-serv17676/src/org/compiere/print/layout Modified Files: HeaderFooter.java LayoutEngine.java Page.java StringElement.java TableElement.java Log Message: . Index: HeaderFooter.java =================================================================== RCS file: /cvsroot/compiere/print/src/org/compiere/print/layout/HeaderFooter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HeaderFooter.java 19 Aug 2002 05:02:02 -0000 1.5 --- HeaderFooter.java 28 Aug 2002 04:24:32 -0000 1.6 *************** *** 17,20 **** --- 17,22 ---- import java.util.*; + import org.compiere.model.*; + /** * Header Footer *************** *** 67,70 **** --- 69,88 ---- } } // paint + + /** + * Get DrillDown value + * @param relativePoint relative Point + * @return if found NamePait or null + */ + public MQuery getDrillDown (Point relativePoint) + { + MQuery retValue = null; + for (int i = 0; i < m_elements.size() && retValue == null; i++) + { + PrintElement element = (PrintElement)m_elements.get(i); + retValue = element.getDrillDown (relativePoint, 1); + } + return retValue; + } // getDrillDown } // HeaderFooter Index: LayoutEngine.java =================================================================== RCS file: /cvsroot/compiere/print/src/org/compiere/print/layout/LayoutEngine.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** LayoutEngine.java 26 Aug 2002 05:24:20 -0000 1.25 --- LayoutEngine.java 28 Aug 2002 04:24:32 -0000 1.26 *************** *** 1053,1060 **** } // We know Position and Size ! Log.trace(Log.l6_Database, "LayoutEngine.layoutForm", ! "Page=" + m_pageNo + " [" + m_area + "] " ! + m_position[m_area].x + "/" + m_position[m_area].y ! + " w=" + lastWidth[m_area] + ",h=" + lastHeight[m_area] + " " + item); if (element != null) element.setLocation(m_position[m_area]); --- 1053,1059 ---- } // We know Position and Size ! // Log.trace(Log.l6_Database, "LayoutEngine.layoutForm", ! // "Page=" + m_pageNo + " [" + m_area + "] " + m_position[m_area].x + "/" + m_position[m_area].y ! // + " w=" + lastWidth[m_area] + ",h=" + lastHeight[m_area] + " " + item); if (element != null) element.setLocation(m_position[m_area]); *************** *** 1258,1262 **** if (item.isNextLine() && item.getBelowColumn() != 0) { ! additionalLines.put(new Integer(col), new Integer(item.getBelowColumn())); item.setSuppressNull(true); // display size will be set to 0 in TableElement } --- 1257,1261 ---- if (item.isNextLine() && item.getBelowColumn() != 0) { ! additionalLines.put(new Integer(col), new Integer(item.getBelowColumn()-1)); item.setSuppressNull(true); // display size will be set to 0 in TableElement } Index: Page.java =================================================================== RCS file: /cvsroot/compiere/print/src/org/compiere/print/layout/Page.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Page.java 23 Aug 2002 04:04:53 -0000 1.8 --- Page.java 28 Aug 2002 04:24:32 -0000 1.9 *************** *** 30,34 **** /** * Layout for Page ! * @param page page info * @param ctx context */ --- 30,35 ---- /** * Layout for Page ! * @param pageNo page ! * @param pageInfo page info (enhanced page no) * @param ctx context */ *************** *** 137,141 **** return sb.toString(); } // toString - } // Page --- 138,141 ---- Index: StringElement.java =================================================================== RCS file: /cvsroot/compiere/print/src/org/compiere/print/layout/StringElement.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** StringElement.java 21 Aug 2002 04:07:49 -0000 1.11 --- StringElement.java 28 Aug 2002 04:24:32 -0000 1.12 *************** *** 40,44 **** * @param translateText if true, check for optional text translation */ ! public StringElement(String text, Font font, Paint paint, NamePair ID, boolean translateText) { if (translateText) --- 40,44 ---- * @param translateText if true, check for optional text translation */ ! public StringElement (String text, Font font, Paint paint, NamePair ID, boolean translateText) { if (translateText) *************** *** 56,60 **** m_string.addAttribute(TextAttribute.FONT, font); m_ID = ID; ! if (ID != null) { m_string.addAttribute(TextAttribute.FOREGROUND, LINK_COLOR); --- 56,60 ---- m_string.addAttribute(TextAttribute.FONT, font); m_ID = ID; ! if (m_ID != null) { m_string.addAttribute(TextAttribute.FOREGROUND, LINK_COLOR); *************** *** 104,108 **** m_string.addAttribute(TextAttribute.FONT, font); m_string.addAttribute(TextAttribute.FOREGROUND, paint); ! if (ID != null) { int endIndex = finalText.length(); --- 104,109 ---- m_string.addAttribute(TextAttribute.FONT, font); m_string.addAttribute(TextAttribute.FOREGROUND, paint); ! m_ID = ID; ! if (m_ID != null) { int endIndex = finalText.length(); *************** *** 169,172 **** --- 170,182 ---- AttributedCharacterIterator iter = m_string.getIterator(); FontRenderContext frc = new FontRenderContext(null, true, true); + + // Check for Tab (just first) + int tabPos = -1; + for (char c = iter.first(); c != iter.DONE && tabPos == -1; c = iter.next()) + { + if (c == '\t') + tabPos = iter.getIndex(); + } + TextLayout layout = null; *************** *** 174,193 **** if (p_maxWidth == 0f && p_maxHeight == 0f) { ! layout = new TextLayout (iter, frc); ! p_height = layout.getAscent() + layout.getDescent() + layout.getLeading(); ! p_width = layout.getAdvance(); ! if (m_check != null) { ! p_width += LayoutEngine.IMAGE_SIZE.width; ! if (p_height < LayoutEngine.IMAGE_SIZE.height) ! p_height = LayoutEngine.IMAGE_SIZE.height; } ! } ! // One Line // -> truncate! ! else if (p_maxWidth == 0f) ! { ! layout = new TextLayout (iter, frc); ! p_height = layout.getAscent() + layout.getDescent() + layout.getLeading(); ! p_width = layout.getAdvance(); if (m_check != null) { --- 184,204 ---- if (p_maxWidth == 0f && p_maxHeight == 0f) { ! if (tabPos == -1) { ! layout = new TextLayout (iter, frc); ! p_height = layout.getAscent() + layout.getDescent() + layout.getLeading(); ! p_width = layout.getAdvance(); } ! else // with tab ! { ! LineBreakMeasurer measurer = new LineBreakMeasurer(iter, frc); ! layout = measurer.nextLayout(9999, tabPos, false); ! p_height = layout.getAscent() + layout.getDescent() + layout.getLeading(); ! p_width = getTabPos (0, layout.getAdvance()); ! layout = measurer.nextLayout(9999, iter.getEndIndex(), true); ! p_width += layout.getAdvance(); ! ! } ! // Add CheckBox Size if (m_check != null) { *************** *** 205,208 **** --- 216,220 ---- while (measurer.getPosition() < iter.getEndIndex()) { + // no need to expand tab space for limited space layout = measurer.nextLayout(p_maxWidth); float lineHeight = layout.getAscent() + layout.getDescent() + layout.getLeading(); *************** *** 214,217 **** --- 226,230 ---- } p_width = p_maxWidth; + // Add CheckBox Size if (m_check != null) { *************** *** 243,251 **** public MQuery getDrillDown (Point relativePoint, int pageNo) { - Log.trace(Log.l5_DData, "StringElement.getDrillDown", m_ID); if (m_ID != null && getBounds().contains(relativePoint)) { ! Log.trace(Log.l5_DData, "StringElement.getDrillDown", m_ID); ! return null; } return null; --- 256,274 ---- public MQuery getDrillDown (Point relativePoint, int pageNo) { if (m_ID != null && getBounds().contains(relativePoint)) { ! Log.trace(Log.l5_DData, "StringElement.getDrillDown", toString()); ! String columnName = m_ID.getName(); ! String tableName = columnName; ! int index = tableName.lastIndexOf("_ID"); ! if (index != -1) ! tableName = tableName.substring(0, index); ! Object code = m_ID.getID(); ! if (m_ID instanceof KeyNamePair) ! code = new Integer(((KeyNamePair)m_ID).getKey()); ! // ! MQuery query = new MQuery(tableName); ! query.addRestriction(columnName, MQuery.EQUAL, code); ! return query; } return null; *************** *** 289,317 **** translate(ctx); ! AttributedCharacterIterator iter = m_string.getIterator(); ! if (!isView) iter = m_string.getIterator(s_paperAttributes); TextLayout layout = null; // No Limit ! if (p_maxWidth == 0f && p_maxHeight == 0f) { ! layout = new TextLayout (iter, g2D.getFontRenderContext()); ! float yPos = (float)location.y + layout.getAscent(); ! float lineHeight = layout.getAscent() + layout.getDescent() + layout.getLeading(); ! layout.draw(g2D, (float)location.x, yPos); // Log.trace(9, "StringElement.paint - No Limit - " + location.x + "/" + yPos // + " w=" + layout.getAdvance() + ",h=" + lineHeight + ", Bounds=" + layout.getBounds()); } - // One Line // -> truncate! - else if (p_maxWidth == 0f) - { - layout = new TextLayout (iter, g2D.getFontRenderContext()); - float yPos = (float)location.y + layout.getAscent(); - float lineHeight = layout.getAscent() + layout.getDescent() + layout.getLeading(); - layout.draw(g2D, (float)location.x, yPos); - // Log.trace(9, "StringElement.paint - OneLine - " + location.x + "/" + yPos - // + " w=" + layout.getAdvance() + ",h=" + lineHeight + ", Bounds=" + layout.getBounds()); - } // Size Limits else --- 312,358 ---- translate(ctx); ! // Get Text ! AttributedCharacterIterator iter = null; ! if (isView) ! iter = m_string.getIterator(); ! else iter = m_string.getIterator(s_paperAttributes); + + // Check for Tab (just first) + int tabPos = -1; + for (char c = iter.first(); c != iter.DONE && tabPos == -1; c = iter.next()) + { + if (c == '\t') + tabPos = iter.getIndex(); + } + TextLayout layout = null; + float xPos = (float)location.getX(); // No Limit ! if (p_maxWidth == 0f) { ! if (tabPos == -1) ! { ! layout = new TextLayout (iter, g2D.getFontRenderContext()); ! float yPen = (float)location.y + layout.getAscent(); ! float lineHeight = layout.getAscent() + layout.getDescent() + layout.getLeading(); ! layout.draw(g2D, xPos, yPen); ! } ! else ! { ! LineBreakMeasurer measurer = new LineBreakMeasurer(iter, g2D.getFontRenderContext()); ! layout = measurer.nextLayout(9999, tabPos, false); ! float lineHeight = layout.getAscent() + layout.getDescent() + layout.getLeading(); ! float xPen = xPos; ! float yPen = (float)location.y + layout.getAscent(); ! layout.draw(g2D, xPen, yPen); // first part ! xPen = getTabPos (xPos, layout.getAdvance()); ! layout = measurer.nextLayout(9999, iter.getEndIndex(), true); ! layout.draw(g2D, xPen, yPen); ! } // Log.trace(9, "StringElement.paint - No Limit - " + location.x + "/" + yPos // + " w=" + layout.getAdvance() + ",h=" + lineHeight + ", Bounds=" + layout.getBounds()); } // Size Limits else *************** *** 321,346 **** while (measurer.getPosition() < iter.getEndIndex()) { ! layout = measurer.nextLayout(p_maxWidth); float lineHeight = layout.getAscent() + layout.getDescent() + layout.getLeading(); if (p_maxHeight == -1f) // one line only p_maxHeight = lineHeight; if (p_maxHeight == 0f || (height + lineHeight) <= p_maxHeight) { ! float xPos = (float)location.getX(); ! if ((MPrintFormatItem.FIELD_ALIGN_TRAILING.equals(p_FieldAlignmentType) && layout.isLeftToRight()) || (MPrintFormatItem.FIELD_ALIGN_LEADING.equals(p_FieldAlignmentType) && !layout.isLeftToRight())) ! xPos += p_maxWidth - layout.getAdvance(); else if (MPrintFormatItem.FIELD_ALIGN_CENTER.equals(p_FieldAlignmentType)) ! xPos += (p_maxWidth - layout.getAdvance()) / 2; else if (MPrintFormatItem.FIELD_ALIGN_BLOCK.equals(p_FieldAlignmentType) && measurer.getPosition() < iter.getEndIndex()) layout = layout.getJustifiedLayout(p_maxWidth); ! float yPos = (float)location.y + height + layout.getAscent(); ! layout.draw(g2D, xPos, yPos); height += lineHeight; ! // Log.trace(9, "StringElement.paint - Limit - " + xPos + "/" + yPos ! // + " w=" + layout.getAdvance() + ",h=" + lineHeight ! // + ", Align=" + p_FieldAlignmentType ! // + ", Max w=" + p_maxWidth + ",h=" + p_maxHeight ! // + ", Bounds=" + layout.getBounds()); } } --- 362,397 ---- while (measurer.getPosition() < iter.getEndIndex()) { ! if (tabPos == -1) ! layout = measurer.nextLayout(p_maxWidth); ! else ! layout = measurer.nextLayout(p_maxWidth, tabPos, false); ! // Line Height float lineHeight = layout.getAscent() + layout.getDescent() + layout.getLeading(); if (p_maxHeight == -1f) // one line only p_maxHeight = lineHeight; + // If we have hight left over if (p_maxHeight == 0f || (height + lineHeight) <= p_maxHeight) { ! float xPen = xPos; ! float yPen = (float)location.y + height + layout.getAscent(); ! // Tab in Text ! if (tabPos != -1) ! { ! layout.draw(g2D, xPen, yPen); // first part ! xPen = getTabPos (xPos, layout.getAdvance()); ! layout = measurer.nextLayout(p_width, iter.getEndIndex(), true); ! tabPos = -1; // reset (just one tab) ! } ! else if ((MPrintFormatItem.FIELD_ALIGN_TRAILING.equals(p_FieldAlignmentType) && layout.isLeftToRight()) || (MPrintFormatItem.FIELD_ALIGN_LEADING.equals(p_FieldAlignmentType) && !layout.isLeftToRight())) ! xPen += p_maxWidth - layout.getAdvance(); else if (MPrintFormatItem.FIELD_ALIGN_CENTER.equals(p_FieldAlignmentType)) ! xPen += (p_maxWidth - layout.getAdvance()) / 2; else if (MPrintFormatItem.FIELD_ALIGN_BLOCK.equals(p_FieldAlignmentType) && measurer.getPosition() < iter.getEndIndex()) layout = layout.getJustifiedLayout(p_maxWidth); ! layout.draw(g2D, xPen, yPen); height += lineHeight; ! // Log.trace(9, "StringElement.paint - Limit - " + xPen + "/" + yPen ! // + " w=" + layout.getAdvance() + ",h=" + lineHeight + ", Align=" + p_FieldAlignmentType + ", Max w=" + p_maxWidth + ",h=" + p_maxHeight + ", Bounds=" + layout.getBounds()); } } *************** *** 353,356 **** --- 404,442 ---- } } // paint + + /** + * Get Tab Position. + * The Tab position is relative to the string itself, not the absolute + * position; i.e. to have the same tab position on a page, strings need + * to start at the same position. + * The Tab is rounded up to the next 30 dividable position. + * @param xPos starting x position + * @param length length of segment + * @return new x Position (xPos + length + tabSpace) + */ + private float getTabPos (float xPos, float length) + { + float retValue = xPos + length; + int iLength = (int)Math.ceil(length); + int tabSpace = iLength % 30; + retValue += (30 - tabSpace); + return retValue; + } // getTabPos + + /** + * String Representation + * @return info + */ + public String toString() + { + StringBuffer sb = new StringBuffer("StringElement["); + AttributedCharacterIterator iter = m_string.getIterator(); + for (char c = iter.first(); c != iter.DONE; c = iter.next()) + sb.append(c); + if (m_ID != null) + sb.append(",ID=(").append(m_ID.toStringX()).append(")"); + sb.append("]"); + return sb.toString(); + } // toString } // StringElement Index: TableElement.java =================================================================== RCS file: /cvsroot/compiere/print/src/org/compiere/print/layout/TableElement.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TableElement.java 26 Aug 2002 05:24:20 -0000 1.14 --- TableElement.java 28 Aug 2002 04:24:32 -0000 1.15 *************** *** 261,265 **** { col = ((Integer)m_additionalLines.get(new Integer(dataCol))).intValue(); ! addAdditionalLines(row, dataCol, dataItem); dataSizes[row][dataCol] = new Dimension2DImpl(); // don't print } --- 261,266 ---- { col = ((Integer)m_additionalLines.get(new Integer(dataCol))).intValue(); ! Log.trace(9, "DataColumn=" + dataCol + ", BelowColumn=" + col); ! addAdditionalLines(row, col, dataItem); dataSizes[row][dataCol] = new Dimension2DImpl(); // don't print } *************** *** 316,333 **** // Column Width for Header String string = ""; ! int col = dataCol; ! if (m_columnHeader[col] != null) ! string = m_columnHeader[col].toString(); ! if (colWidth == 0 && m_columnMaxWidth[col] < 0) // suppressNull ! headerSizes[col] = new Dimension2DImpl(); ! else if (string.length() == 0) ! headerSizes[col] = new Dimension2DImpl(); else { ! Font font = getFont(HEADER_ROW, col); if (!font.isBold()) font = new Font(font.getName(), Font.BOLD, font.getSize()); // No Width Limitations ! if (m_columnMaxWidth[col] == 0 || m_columnMaxWidth[col] == -1 || !m_multiLineHeader) { TextLayout layout = new TextLayout (string, font, frc); --- 317,338 ---- // Column Width for Header String string = ""; ! if (m_columnHeader[dataCol] != null) ! string = m_columnHeader[dataCol].toString(); ! ! if (m_additionalLines.containsKey(new Integer(dataCol))) // Print Below another line ! { ! headerSizes[dataCol] = new Dimension2DImpl(); ! colWidth = 0; ! } ! else if (colWidth == 0 && m_columnMaxWidth[dataCol] < 0 // suppress Null ! || string.length() == 0) ! headerSizes[dataCol] = new Dimension2DImpl(); else { ! Font font = getFont(HEADER_ROW, dataCol); if (!font.isBold()) font = new Font(font.getName(), Font.BOLD, font.getSize()); // No Width Limitations ! if (m_columnMaxWidth[dataCol] == 0 || m_columnMaxWidth[dataCol] == -1 || !m_multiLineHeader) { TextLayout layout = new TextLayout (string, font, frc); *************** *** 335,345 **** float height = layout.getAscent() + layout.getDescent() + layout.getLeading(); if (width > dynMxColumnWidth) ! m_columnMaxWidth[col] = (int)Math.ceil(dynMxColumnWidth); else if (colWidth < width) colWidth = width; ! headerSizes[col] = new Dimension2DImpl(width, height); } // Width limitations ! if (m_columnMaxWidth[col] != 0 && m_columnMaxWidth[col] != -1) { AttributedString aString = new AttributedString(string); --- 340,350 ---- float height = layout.getAscent() + layout.getDescent() + layout.getLeading(); if (width > dynMxColumnWidth) ! m_columnMaxWidth[dataCol] = (int)Math.ceil(dynMxColumnWidth); else if (colWidth < width) colWidth = width; ! headerSizes[dataCol] = new Dimension2DImpl(width, height); } // Width limitations ! if (m_columnMaxWidth[dataCol] != 0 && m_columnMaxWidth[dataCol] != -1) { AttributedString aString = new AttributedString(string); *************** *** 348,352 **** LineBreakMeasurer measurer = new LineBreakMeasurer(iter, frc); float height = 0; ! colWidth = Math.abs(m_columnMaxWidth[col]); while (measurer.getPosition() < iter.getEndIndex()) { --- 353,357 ---- LineBreakMeasurer measurer = new LineBreakMeasurer(iter, frc); float height = 0; ! colWidth = Math.abs(m_columnMaxWidth[dataCol]); while (measurer.getPosition() < iter.getEndIndex()) { *************** *** 355,371 **** if (!m_multiLineHeader) // one line only height = lineHeight; ! else if (m_columnMaxHeight[col] == 0 || (height + lineHeight) <= m_columnMaxHeight[col]) height += lineHeight; } ! headerSizes[col] = new Dimension2DImpl(colWidth, height); } } // headerSize ! headerSizes[col].roundUp(); colWidth = (float)Math.ceil(colWidth); // System.out.println("Col=" + col + " => " + headerSizes[col]); // Set Column Width ! if (col == 0) colWidth += V_LINE; if (colWidth != 0) --- 360,377 ---- if (!m_multiLineHeader) // one line only height = lineHeight; ! else if (m_columnMaxHeight[dataCol] == 0 ! || (height + lineHeight) <= m_columnMaxHeight[dataCol]) height += lineHeight; } ! headerSizes[dataCol] = new Dimension2DImpl(colWidth, height); } } // headerSize ! headerSizes[dataCol].roundUp(); colWidth = (float)Math.ceil(colWidth); // System.out.println("Col=" + col + " => " + headerSizes[col]); // Set Column Width ! if (dataCol == 0) colWidth += V_LINE; if (colWidth != 0) *************** *** 375,379 **** // Log.trace(Log.l6_Database, "TableElement.calculateSize - Width", ! "Col=" + col + " - Width=" + colWidth + " - Total=" + p_width); } // for all columns --- 381,385 ---- // Log.trace(Log.l6_Database, "TableElement.calculateSize - Width", ! "Col=" + dataCol + " - Width=" + colWidth + " - Total=" + p_width); } // for all columns *************** *** 451,454 **** --- 457,462 ---- "Page X=1 - PageWidth=" + m_firstPage.width + " - TableWidth=" + p_width); m_firstColumnOnPage.add(new Integer(0)); // X + // + distributeColumns (m_firstPage.width-(int)p_width, 0, m_columnWidths.size()); } // multiple pages on - X Axis *************** *** 505,515 **** private void distributeColumns (int availableWidth, int fromCol, int toCol) { ! // if less than 5 add to last column ! if (availableWidth < 5) ! { ! int columnWidth = ((Float)m_columnWidths.get(toCol-1)).intValue(); ! m_columnWidths.set(toCol-1, new Float(columnWidth+availableWidth)); ! return; ! } int start = fromCol; if (fromCol == 0 && m_repeatedColumns > 0) --- 513,517 ---- private void distributeColumns (int availableWidth, int fromCol, int toCol) { ! Log.trace(8, "TableElement.distributeColumns", "Available=" + availableWidth + ", Colums=" + fromCol + " up to " + toCol); int start = fromCol; if (fromCol == 0 && m_repeatedColumns > 0) *************** *** 519,542 **** for (int col = start; col < toCol; col++) totalWidth += ((Float)m_columnWidths.get(col)).floatValue(); - // distribute (does not increase zero width columns) int remainingWidth = availableWidth; ! for (int col = start; col < toCol; col++) { ! int columnWidth = ((Float)m_columnWidths.get(col)).intValue(); ! int additionalPart = columnWidth / totalWidth * availableWidth; ! if (remainingWidth < additionalPart) ! m_columnWidths.set(col, new Float(columnWidth+remainingWidth)); ! else ! m_columnWidths.set(col, new Float(columnWidth+additionalPart)); ! remainingWidth -= additionalPart; } // add remainder to last non 0 width column ! for (int c=toCol-1; availableWidth != 0 && c >=0; c--) { int columnWidth = ((Float)m_columnWidths.get(c)).intValue(); if (columnWidth > 0) { ! m_columnWidths.set(c, new Float(columnWidth+availableWidth)); ! availableWidth = 0; } } --- 521,558 ---- for (int col = start; col < toCol; col++) totalWidth += ((Float)m_columnWidths.get(col)).floatValue(); int remainingWidth = availableWidth; ! // distribute proportionally (does not increase zero width columns) ! for (int x = 0; remainingWidth > 0 && x < 5; x++) // max 4 iterations { ! Log.trace(9, "TotalWidth=" + totalWidth + ", Remaining=" + remainingWidth); ! for (int col = start; col < toCol && remainingWidth != 0; col++) ! { ! int columnWidth = ((Float)m_columnWidths.get(col)).intValue(); ! if (columnWidth != 0) ! { ! int additionalPart = columnWidth * availableWidth / totalWidth; ! if (remainingWidth < additionalPart) ! { ! m_columnWidths.set(col, new Float(columnWidth+remainingWidth)); ! remainingWidth = 0; ! } ! else ! { ! m_columnWidths.set(col, new Float(columnWidth+additionalPart)); ! remainingWidth -= additionalPart; ! } ! Log.trace(9, "Column " + col, "From " + columnWidth + " to " + m_columnWidths.get(col)); ! } ! } } // add remainder to last non 0 width column ! for (int c = toCol-1; remainingWidth != 0 && c >=0; c--) { int columnWidth = ((Float)m_columnWidths.get(c)).intValue(); if (columnWidth > 0) { ! m_columnWidths.set(c, new Float(columnWidth+remainingWidth)); ! Log.trace(9, "Final Column " + c, "From " + columnWidth + " to " + m_columnWidths.get(c)); ! remainingWidth = 0; } } *************** *** 1210,1214 **** * @return non null array of print objects (may be empty) */ ! private Object[] getPrintItems(int row, int col) { Point key = new Point (row,col); --- 1226,1230 ---- * @return non null array of print objects (may be empty) */ ! private Object[] getPrintItems (int row, int col) { Point key = new Point (row,col); |