public static View asSize(Node node) {
if (node.isContainer()) {
long items = node.getChildren().length;
String text = String.format(" %s %s", items,
items == 1 ? I18N.get("Item") : I18N.get("Items"));
return new View(text, new Label(text));
} else {
long size = node.getSize();
String text = FileUtils.byteCountToDisplaySize(size);
return new View(size, new Label(text));
}
}