package com.toomasr.sgf4j.filetree;

import java.io.File;

import javafx.scene.control.TreeCell;

public class FileFormatCell extends TreeCell<File> {
  public FileFormatCell() {
    super();
  }

  protected void updateItem(File item, boolean empty) {
    super.updateItem(item, empty);
    if (empty || item == null) {
      setText(null);
      setGraphic(null);
    }
    else {
      /*
       * For a root device on a Mac getName will return an empty string
       * but actually I'd like to show a slash designating the root device
       *
       */
      if ("".equals(item.getName()))
        setText(item.getAbsolutePath());
      else
        setText(item.getName());
    }
  }
}

@@ -63,92 +63,559 @@
 ort 
-javafx.scene.control.TreeCell;%0A%0Apublic class FileFormatCell extends TreeCell%3CFile%3E %7B
+com.toomasr.sgf4j.metasystem.MetaSystem;%0Aimport com.toomasr.sgf4j.metasystem.ProblemStatus;%0A%0Aimport javafx.scene.control.TreeCell;%0Aimport javafx.scene.image.Image;%0Aimport javafx.scene.image.ImageView;%0A%0Apublic class FileFormatCell extends TreeCell%3CFile%3E %7B%0A  private Image noneImage = new Image(getClass().getResourceAsStream(%22/icons/none_16x16.png%22));%0A  private Image failedImage = new Image(getClass().getResourceAsStream(%22/icons/failed_16x16.png%22));%0A  private Image solvedImage = new Image(getClass().getResourceAsStream(%22/icons/solved_16x16.png%22));%0A
 %0A  p
@@ -690,20 +690,20 @@
 em(File 
-item
+file
 , boolea
@@ -734,20 +734,20 @@
 ateItem(
-item
+file
 , empty)
@@ -765,20 +765,20 @@
 mpty %7C%7C 
-item
+file
  == null
@@ -1038,20 +1038,20 @@
 .equals(
-item
+file
 .getName
@@ -1067,28 +1067,28 @@
     setText(
-item
+file
 .getAbsolute
@@ -1106,45 +1106,746 @@
     
-else%0A        setText(item.getName());
+/*%0A       * For SGF files we want to show some custom icons.%0A       */%0A      else if (file != null && file.isFile() && file.toString().toLowerCase().endsWith(%22sgf%22)) %7B%0A        setText(file.getName());%0A        if (MetaSystem.systemExists(file.toPath())) %7B%0A          ProblemStatus status = MetaSystem.getStatus(file.toPath());%0A%0A          if (status == ProblemStatus.NONE)%0A            setGraphic(new ImageView(noneImage));%0A          else if (status == ProblemStatus.FAIL)%0A            setGraphic(new ImageView(failedImage));%0A          else%0A            setGraphic(new ImageView(solvedImage));%0A        %7D%0A        else %7B%0A          setGraphic(null);%0A        %7D%0A      %7D%0A      else %7B%0A        setText(file.getName());%0A        setGraphic(null);%0A      %7D
 %0A   

Use new icons in the tree