View Javadoc

1   /*
2   	StatCvs - CVS statistics generation 
3   	Copyright (C) 2002  Lukasz Pekacki <lukasz@pekacki.de>
4   	http://statcvs.sf.net/
5       
6   	This library is free software; you can redistribute it and/or
7   	modify it under the terms of the GNU Lesser General Public
8   	License as published by the Free Software Foundation; either
9   	version 2.1 of the License, or (at your option) any later version.
10  
11  	This library is distributed in the hope that it will be useful,
12  	but WITHOUT ANY WARRANTY; without even the implied warranty of
13  	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  	Lesser General Public License for more details.
15  
16  	You should have received a copy of the GNU Lesser General Public
17  	License along with this library; if not, write to the Free Software
18  	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19      
20  	$RCSfile: FileColumn.java,v $
21  	$Date: 2008/04/02 11:22:14 $
22  */
23  package net.sf.statcvs.reportmodel;
24  
25  import net.sf.statcvs.Messages;
26  import net.sf.statcvs.model.VersionedFile;
27  import net.sf.statcvs.output.WebRepositoryIntegration;
28  import net.sf.statcvs.renderer.TableCellRenderer;
29  
30  /**
31   * A table column containing files
32   * 
33   * @author Richard Cyganiak <rcyg@gmx.de>
34   * @version $Id: FileColumn.java,v 1.5 2008/04/02 11:22:14 benoitx Exp $
35   */
36  public class FileColumn extends GenericColumn {
37      private WebRepositoryIntegration webRepository;
38      private boolean withIcon = false;
39  
40      /**
41       * Creates a new directory column
42       */
43      public FileColumn() {
44          super(Messages.getString("COLUMN_FILE"));
45      }
46  
47      /**
48       * @see net.sf.statcvs.reportmodel.Column#renderCell
49       */
50      public void renderCell(final int rowIndex, final TableCellRenderer renderer) {
51          renderer.renderFileCell((VersionedFile) getValue(rowIndex), this.withIcon, this.webRepository);
52      }
53  
54      /**
55       * Specifies if each cell should be rendered with an icon representing
56       * the file
57       * @param withIcon render with icon? 
58       */
59      public void setWithIcon(final boolean withIcon) {
60          this.withIcon = withIcon;
61      }
62  
63      /**
64       * Setting a WebRepository turns filenames into links to that file. 
65       */
66      public void setWebRepository(final WebRepositoryIntegration webRepository) {
67          this.webRepository = webRepository;
68      }
69  }