@Override
  public Image getImage(Object element) {
    /* Only return images in column 0 */
    if (column != 0) return null;

    if (!(element instanceof File)) return null;

    File file = (File) element;

    if (file.isDirectory()) return directoryImage;

    String extension = file.getName().substring(file.getName().lastIndexOf(".") + 1);
    extension = extension.toLowerCase(Locale.ENGLISH);

    if (extension.matches("htm.*")) return htmlImage;
    if (extension.matches("sh|py|pl|rb|js|vb|bat")) return scriptImage;
    if (extension.matches("xml")) return xmlImage;
    /*		if (extension.matches("text|txt|me|faq|info|notes"))
     			return textImage;
    */ if (extension.matches("jpg|jpeg|gif|bmp|tif|tiff|png|ico|icon")) return imageImage;
    if (extension.matches("mp3|wav|ra")) return audioImage;
    if (extension.matches("mpg|mpeg|mov|rm|divx|xvid|avi")) return videoImage;
    if (extension.matches("arj|.?zip|jar|lha|lhz|rar|rpm|deb|sit|tar|gz|gz2")) return archiveImage;
    if (extension.matches("exe")) return executableImage;
    if (extension.matches("swf|flv|fla")) return flashImage;
    if (extension.matches("pdf")) return pdfImage;
    if (extension.matches("doc")) return mswordImage;
    if (extension.matches("dll|so|lib|o|obj")) return binaryImage;
    if (extension.matches("init|rc|cfg|conf.*")) return configImage;
    if (extension.matches("log")) return logImage;

    //		System.err.println("Unknown file type \""+extension+"\"");

    return textImage;
  }
  @Override
  public String getText(Object element) {
    if (!(element instanceof File)) return column == 0 ? element.toString() : null;

    File file = (File) element;
    switch (column) {
      case 0:
        return file.getName();
      case 1:
        return file.isFile() ? getLengthText(file.length()) : null;
      case 2:
        if (file.lastModified() == 0) {
          return null;
        }
        /*
         * KLUDGE: thread-safe DateFormat
         *
         * creates a new instance of a Format object for each invocation
         * (performance hit)
         */
        return DateFormat.getInstance().format(file.lastModified());
    }
    return null;
  }