2
* Copyright (C) 2004, 2005, 2006 Aelitis SAS, All rights Reserved
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details ( see the LICENSE file ).
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
* AELITIS, SAS au capital de 46,603.30 euros,
18
* 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
21
package org.gudy.azureus2.ui.swt.views.tableitems.files;
23
import org.gudy.azureus2.plugins.ui.tables.*;
24
import org.gudy.azureus2.core3.disk.DiskManagerFileInfo;
25
import org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn;
27
public class FileExtensionItem
28
extends CoreTableColumn
29
implements TableCellRefreshListener
32
/** Default Constructor */
33
public FileExtensionItem() {
34
super("fileext", ALIGN_LEAD, POSITION_INVISIBLE, 50, TableManager.TABLE_TORRENT_FILES);
37
public void refresh(TableCell cell) {
38
DiskManagerFileInfo fileInfo = (DiskManagerFileInfo)cell.getDataSource();
39
cell.setText(determineFileExt(fileInfo));
42
private static String determineFileExt(DiskManagerFileInfo fileInfo) {
43
String name = (fileInfo == null) ? "" : fileInfo.getFile(true).getName();
44
int dot_position = name.lastIndexOf(".");
45
if (dot_position == -1) {return "";}
46
return name.substring(dot_position+1);
2
* Copyright (C) 2004, 2005, 2006 Aelitis SAS, All rights Reserved
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details ( see the LICENSE file ).
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
* AELITIS, SAS au capital de 46,603.30 euros,
18
* 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
21
package org.gudy.azureus2.ui.swt.views.tableitems.files;
23
import org.gudy.azureus2.plugins.ui.tables.*;
24
import org.gudy.azureus2.core3.disk.DiskManagerFileInfo;
25
import org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn;
27
public class FileExtensionItem
28
extends CoreTableColumn
29
implements TableCellRefreshListener
32
/** Default Constructor */
33
public FileExtensionItem() {
34
super("fileext", ALIGN_LEAD, POSITION_INVISIBLE, 50, TableManager.TABLE_TORRENT_FILES);
35
setMinWidthAuto(true);
38
public void refresh(TableCell cell) {
39
DiskManagerFileInfo fileInfo = (DiskManagerFileInfo)cell.getDataSource();
40
cell.setText(determineFileExt(fileInfo));
43
private static String determineFileExt(DiskManagerFileInfo fileInfo) {
44
String name = (fileInfo == null) ? "" : fileInfo.getFile(true).getName();
45
int dot_position = name.lastIndexOf(".");
46
if (dot_position == -1) {return "";}
47
return name.substring(dot_position+1);