details:   /erp/devel/pi/rev/c3208eb7eb11
changeset: 7608:c3208eb7eb11
user:      Iván Perdomo <ivan.perdomo <at> openbravo.com>
date:      Tue Jun 15 10:38:16 2010 +0200
summary:   Updated license, reformatted text. Related to issue 13588

details:   /erp/devel/pi/rev/0e44f440ef71
changeset: 7609:0e44f440ef71
user:      Iván Perdomo <ivan.perdomo <at> openbravo.com>
date:      Tue Jun 15 10:57:17 2010 +0200
summary:   Fixes issue 13588: Increased character width for column length 
calculation
Since we are not defining any style in plantilla.jrxml, to calculate the
column width we use the text of the column name multiplied by a factor
(character width). It seems that is a font configuration issue, is only
reproducible in some GNU/Linux environments with not all 'expected' ttf fonts
installed, e.g. rPath on the community appliance.

diffstat:

 src/org/openbravo/erpCommon/utility/ExportGrid.java |  19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diffs (54 lines):

diff -r 3ad7992e914a -r 0e44f440ef71 
src/org/openbravo/erpCommon/utility/ExportGrid.java
--- a/src/org/openbravo/erpCommon/utility/ExportGrid.java       Tue Jun 15 
12:30:22 2010 +0530
+++ b/src/org/openbravo/erpCommon/utility/ExportGrid.java       Tue Jun 15 
10:57:17 2010 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2007-2009 Openbravo SLU
+ * All portions are Copyright (C) 2007-2010 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -39,6 +39,9 @@
 
 public class ExportGrid extends HttpSecureAppServlet {
   private static final long serialVersionUID = 1L;
+  // Since we don't use any style in the JRXML template, the column's width is 
based on the header
+  // text length multiplied by a factor (character width)
+  private static final int CHAR_WIDTH = 10;
 
   public void doPost(HttpServletRequest request, HttpServletResponse response) 
throws IOException,
       ServletException {
@@ -100,13 +103,13 @@
     }
   }
 
-  private GridReportVO createGridReport(VariablesSecureApp vars, String 
strTabId, String strWindowId,
-      String strAccessLevel) throws ServletException {
+  private GridReportVO createGridReport(VariablesSecureApp vars, String 
strTabId,
+      String strWindowId, String strAccessLevel) throws ServletException {
     return createGridReport(vars, strTabId, strWindowId, strAccessLevel, 
false);
   }
 
-  private GridReportVO createGridReport(VariablesSecureApp vars, String 
strTabId, String strWindowId,
-      String strAccessLevel, boolean useFieldLength) throws ServletException {
+  private GridReportVO createGridReport(VariablesSecureApp vars, String 
strTabId,
+      String strWindowId, String strAccessLevel, boolean useFieldLength) 
throws ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("Create Grid Report, tabID: " + strTabId);
     LinkedList<GridColumnVO> columns = new LinkedList<GridColumnVO>();
@@ -152,10 +155,10 @@
           log4j.debug("Add column: " + columnname + " width: " + 
headers[i].getField("width")
               + " reference: " + headers[i].getField("adReferenceId"));
         int intColumnWidth = Integer.valueOf(headers[i].getField("width"));
-        if (headers[i].getField("name").length() * 5 > intColumnWidth) {
-          intColumnWidth = headers[i].getField("name").length() * 5;
+        if (headers[i].getField("name").length() * CHAR_WIDTH > 
intColumnWidth) {
+          intColumnWidth = headers[i].getField("name").length() * CHAR_WIDTH;
           if (log4j.isDebugEnabled())
-            log4j.debug("            New width: " + intColumnWidth);
+            log4j.debug("New width: " + intColumnWidth);
         }
         totalWidth += intColumnWidth;
         Class<?> fieldClass = String.class;

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to