[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-3879) e:cell formatting of date or number colum fails, if first value is a null value

Alexander Schwartz (JIRA) jira-events at lists.jboss.org
Tue Jan 6 04:37:03 EST 2009


     [ https://jira.jboss.org/jira/browse/JBSEAM-3879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Schwartz updated JBSEAM-3879:
---------------------------------------

    Attachment: jxlhelper.java.patch


code change as patch

> e:cell formatting of date or number colum fails, if first value is a null value
> -------------------------------------------------------------------------------
>
>                 Key: JBSEAM-3879
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3879
>             Project: Seam
>          Issue Type: Sub-task
>          Components: Excel
>    Affects Versions: 2.1.1.GA
>         Environment: Seam 2.1.1.GA, Windows, Jetty
>            Reporter: Alexander Schwartz
>         Attachments: jxlhelper.java.patch
>
>
> The cell style of a e:cell is cached (for the specific id) when it is accessed for the first time. When the first value is a null value, uiCell.getDataType() is unable to automatically detect the data type of the column and returns 'general'. This is then cached. 
> All other columns are then treated as 'general' in createCell(), and all data is converted using data.toString() leading to ugly results.
> Our solution is to add "xls-force-type: date" to all e:cell of type number or date. We added this to the evaluation (see below). 
> Another idea would have been to defer caching until the first non-null value has been met. But this might cause troubles in createCell() when there is a handing depending on the type. 
> from JXLHelper.java:
>    /**
>     * Gets the cell type for a cell. Tries to look it up in a cache based on the
>     * component id of the cell. If it's not found, it's created and cached.
>     * 
>     * @param uiCell The cell to look up
>     * @return The data type of a cell
>     */
>    private CellType getCellDataType(UICell uiCell)
>    {
>       if (log.isTraceEnabled())
>       {
>          log.trace("Getting cell data type from cache for #0", uiCell.getId());
>       }
>       CellType cellDataType = cellInfoCache.getCachedCellType(uiCell.getId());
>       if (cellDataType == null)
>       {
>          /* old code: 
>          cellDataType = uiCell.getDataType();
>          */
>          /* new code start */
>          CellStyle cellStyle = new CellStyle(parser.getCascadedStyleMap(uiCell));
>          cellDataType = cellStyle.forceType != null ? CellType
>              .valueOf(cellStyle.forceType) : uiCell.getDataType();
>          /* new code end */
>          cellInfoCache.setCachedCellType(uiCell.getId(), cellDataType);
>       }
>       return cellDataType;
>    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list