Exemplo n.º 1
0
    @Override
    public Component getTreeCellRendererComponent(
        JTree tree,
        Object value,
        boolean sel,
        boolean expanded,
        boolean leaf,
        int row,
        boolean hasFocus) {
      super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);

      if (value instanceof FileSystemEntry) {
        FileSystemEntry fse = (FileSystemEntry) value;
        if (fse.isLoadingNode) {
          setIcon(spinner.getSpinner());
        } else {
          if (fse.isSearch()) {
            setSearch(fse);
          } else {
            if (expanded) {
              setIcon(openIcon);
            } else setIcon(closedIcon);
          }
        }
      } else if (value instanceof FileSystemRoot.SearchesRoot) {
        setSearch((ListableEntry) value);
      } else {
        setIcon(openIcon);
      }
      return this;
    }
Exemplo n.º 2
0
    @Override
    public Component getTableCellRendererComponent(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

      FileSystemEntry fse = fs.getEntryForRow(filesTable.convertRowIndexToModel(row));
      if (fse.isLoadingNode) {
        setIcon(spinner.getSpinner());
      } else {
        if (fse.isDirectory()) {
          if (fse.isSearch()) {
            setIcon(search);
          } else {
            setIcon(dir);
          }
        } else {
          setIcon(frame.gui.util.getIconForType(frame.gui.util.guessType(value.toString())));
        }
      }
      return this;
    }