2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
Copyright @ 1999-2003, The Institute for Genomic Research (TIGR). |
2 |
26 Feb 07 |
jari |
All rights reserved. |
2 |
26 Feb 07 |
jari |
4 |
*/ |
2 |
26 Feb 07 |
jari |
5 |
/* |
2 |
26 Feb 07 |
jari |
* $RCSfile: SequenceFileView.java,v $ |
2 |
26 Feb 07 |
jari |
* $Revision: 1.4 $ |
2 |
26 Feb 07 |
jari |
* $Date: 2006/02/23 21:00:04 $ |
2 |
26 Feb 07 |
jari |
* $Author: caliente $ |
2 |
26 Feb 07 |
jari |
* $State: Exp $ |
2 |
26 Feb 07 |
jari |
11 |
*/ |
2 |
26 Feb 07 |
jari |
12 |
package org.tigr.util.swing; |
2 |
26 Feb 07 |
jari |
13 |
|
2 |
26 Feb 07 |
jari |
14 |
import java.io.File; |
2 |
26 Feb 07 |
jari |
15 |
|
2 |
26 Feb 07 |
jari |
16 |
import javax.swing.Icon; |
2 |
26 Feb 07 |
jari |
17 |
import javax.swing.ImageIcon; |
2 |
26 Feb 07 |
jari |
18 |
import javax.swing.filechooser.FileView; |
2 |
26 Feb 07 |
jari |
19 |
|
2 |
26 Feb 07 |
jari |
20 |
public class SequenceFileView extends FileView { |
2 |
26 Feb 07 |
jari |
21 |
Icon ExpressionIcon = new ImageIcon(SequenceFileView.class.getResource("/org/tigr/images/Sequence216.gif")); |
2 |
26 Feb 07 |
jari |
22 |
Icon DirectoryIcon = new ImageIcon(SequenceFileView.class.getResource("/org/tigr/images/Directory.gif")); |
2 |
26 Feb 07 |
jari |
23 |
|
2 |
26 Feb 07 |
jari |
24 |
public String getName(File f) { |
2 |
26 Feb 07 |
jari |
25 |
return null; // let the L&F FileView figure this out |
2 |
26 Feb 07 |
jari |
26 |
} |
2 |
26 Feb 07 |
jari |
27 |
|
2 |
26 Feb 07 |
jari |
28 |
public String getDescription(File f) { |
2 |
26 Feb 07 |
jari |
29 |
return null; // let the L&F FileView figure this out |
2 |
26 Feb 07 |
jari |
30 |
} |
2 |
26 Feb 07 |
jari |
31 |
|
2 |
26 Feb 07 |
jari |
32 |
public Boolean isTraversable(File f) { |
2 |
26 Feb 07 |
jari |
33 |
return null; // let the L&F FileView figure this out |
2 |
26 Feb 07 |
jari |
34 |
} |
2 |
26 Feb 07 |
jari |
35 |
|
2 |
26 Feb 07 |
jari |
36 |
public String getTypeDescription(File f) { |
2 |
26 Feb 07 |
jari |
37 |
String extension = Utils.getExtension(f); |
2 |
26 Feb 07 |
jari |
38 |
String type = null; |
2 |
26 Feb 07 |
jari |
39 |
|
2 |
26 Feb 07 |
jari |
40 |
if (extension != null) { |
2 |
26 Feb 07 |
jari |
41 |
if (extension.equals(Utils.seq) || extension.equals(Utils.fna)) { |
2 |
26 Feb 07 |
jari |
42 |
type = "Sequence file"; |
2 |
26 Feb 07 |
jari |
43 |
} |
2 |
26 Feb 07 |
jari |
44 |
} |
2 |
26 Feb 07 |
jari |
45 |
return type; |
2 |
26 Feb 07 |
jari |
46 |
} |
2 |
26 Feb 07 |
jari |
47 |
|
2 |
26 Feb 07 |
jari |
48 |
public Icon getIcon(File f) { |
2 |
26 Feb 07 |
jari |
49 |
String extension = Utils.getExtension(f); |
2 |
26 Feb 07 |
jari |
50 |
Icon icon = null; |
2 |
26 Feb 07 |
jari |
51 |
|
2 |
26 Feb 07 |
jari |
52 |
if (f.isDirectory()) { |
2 |
26 Feb 07 |
jari |
53 |
icon = DirectoryIcon; |
2 |
26 Feb 07 |
jari |
54 |
} |
2 |
26 Feb 07 |
jari |
55 |
|
2 |
26 Feb 07 |
jari |
56 |
if (extension != null) { |
2 |
26 Feb 07 |
jari |
57 |
if (extension.equals(Utils.seq) || extension.equals(Utils.fna)) { |
2 |
26 Feb 07 |
jari |
58 |
icon = ExpressionIcon; |
2 |
26 Feb 07 |
jari |
59 |
} |
2 |
26 Feb 07 |
jari |
60 |
} |
2 |
26 Feb 07 |
jari |
61 |
return icon; |
2 |
26 Feb 07 |
jari |
62 |
} |
2 |
26 Feb 07 |
jari |
63 |
} |