001/* 002 * (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Anahide Tchertchian 016 */ 017package org.nuxeo.ecm.platform.ui.web.component.seam; 018 019import java.util.Date; 020 021import javax.faces.component.UIComponent; 022 023import org.jboss.seam.excel.WorksheetItem; 024 025/** 026 * Overrides default JXL workbook to avoid dumb cache on component id 027 * 028 * @since 5.6 029 */ 030public class JXLExcelWorkbook extends org.jboss.seam.excel.jxl.JXLExcelWorkbook { 031 032 @Override 033 public void addItem(WorksheetItem item) { 034 // cheat by changing the component id before calling addItem to avoid 035 // going through the cache... 036 UIComponent comp = (UIComponent) item; 037 String oldId = comp.getId(); 038 long timestamp = new Date().getTime(); 039 comp.setId(String.valueOf("NX_MARKER_" + timestamp)); 040 try { 041 super.addItem(item); 042 } finally { 043 comp.setId(oldId); 044 } 045 } 046 047}