home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / plaf / basic / BasicFileChooserUI$BasicFileView.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.1 KB  |  81 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.io.File;
  4. import java.util.Hashtable;
  5. import javax.swing.Icon;
  6. import javax.swing.filechooser.FileView;
  7.  
  8. public class BasicFileChooserUI$BasicFileView extends FileView {
  9.    protected Hashtable iconCache;
  10.    // $FF: synthetic field
  11.    private final BasicFileChooserUI this$0;
  12.  
  13.    public BasicFileChooserUI$BasicFileView(BasicFileChooserUI var1) {
  14.       this.this$0 = var1;
  15.       this.iconCache = new Hashtable();
  16.    }
  17.  
  18.    public void clearIconCache() {
  19.       this.iconCache = new Hashtable();
  20.    }
  21.  
  22.    public String getName(File var1) {
  23.       String var2 = null;
  24.       if (var1 != null) {
  25.          var2 = var1.getName();
  26.          if (var2.equals("")) {
  27.             var2 = var1.getPath();
  28.          }
  29.       }
  30.  
  31.       return var2;
  32.    }
  33.  
  34.    public String getDescription(File var1) {
  35.       return var1.getName();
  36.    }
  37.  
  38.    public String getTypeDescription(File var1) {
  39.       return var1.isDirectory() ? BasicFileChooserUI.access$200(this.this$0) : BasicFileChooserUI.access$300(this.this$0);
  40.    }
  41.  
  42.    public Icon getCachedIcon(File var1) {
  43.       return (Icon)this.iconCache.get(var1);
  44.    }
  45.  
  46.    public void cacheIcon(File var1, Icon var2) {
  47.       if (var1 != null && var2 != null) {
  48.          this.iconCache.put(var1, var2);
  49.       }
  50.    }
  51.  
  52.    public Icon getIcon(File var1) {
  53.       Icon var2 = this.getCachedIcon(var1);
  54.       if (var2 != null) {
  55.          return var2;
  56.       } else {
  57.          if (var1 != null && var1.isDirectory()) {
  58.             if (this.this$0.getFileChooser().getFileSystemView().isRoot(var1)) {
  59.                var2 = this.this$0.hardDriveIcon;
  60.             } else {
  61.                var2 = this.this$0.directoryIcon;
  62.             }
  63.          } else {
  64.             var2 = this.this$0.fileIcon;
  65.          }
  66.  
  67.          this.cacheIcon(var1, var2);
  68.          return var2;
  69.       }
  70.    }
  71.  
  72.    public Boolean isTraversable(File var1) {
  73.       return var1.isDirectory() ? Boolean.TRUE : Boolean.FALSE;
  74.    }
  75.  
  76.    public Boolean isHidden(File var1) {
  77.       String var2 = var1.getName();
  78.       return var2 != null && var2.charAt(0) == '.' ? Boolean.TRUE : Boolean.FALSE;
  79.    }
  80. }
  81.