-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate shared directories into one row in TreeView #2
Comments
It would be nice to have. By overriding the cell factory, you can at least use the short names:
class MyTreeCell extends TreeCell<Path> {
@Override
public void updateItem(Path p, boolean empty) {
super.updateItem(p, empty);
if(!empty) {
setText(p.getFileName().toString());
} else {
setText(null);
}
}
} |
Hmm... I think that will work for the short term. Thanks! |
I think I can think of a nice way to implement this, but it would require implementation of |
Meaning it would be an entirely separate project? |
I'm not sure it would be worth a separate project. static <T> TreeItem<T> transform(TreeItem<T> item, Function<TreeItem<T>, Val<TreeItem<T>>> f) {
return new TreeItem<T>() {
public ObservableList<TreeItem<T>> getChildren() {
return item.getChildren().flatMap(child -> f.apply(child).asList()); // THIS flatMap DOES NOT EXIST
}
// ...
}
}
static Val<TreeItem<T>> eliminateSingleChildDirs(TreeItem<T> item) {
LiveList.sizeOf(item.getChildren()).flatMap(n -> {
switch(n) {
case 0: return Val.constant(item);
case 1: return eliminateSingleChildDirs(item.getChildren().get(0));
default: return Val.constant(transform(item, Foo::eliminateSingleChildDirs));
}
});
}
TreeItem<Path> root = liveDirs.model().getRoot();
TreeItem<Path> root1 = transform(root, Foo::eliminateSingleChildDirs);
// Use root1 to create a TreeView |
I thought so.... You mean "outside" as in |
It doesn't really matter where it is implemented, but yes, ReactFX would be a natural place for that |
Is that why it's been in a continual "2.0M4u1" release? |
Yes, that's a big part of the reason. I didn't get to implementing it when I was implementing LiveList. It is trickier than it seems at the first sight. And then my priorities changed (I'm currently not working on any UI stuff as part of my day job), so I have less time for altruistic work. |
I was wondering why you've been less responsive when it comes to RichTextFX-related things (as compared to October through December) |
In Intellij Idea, the TreeView displays their files like so:
Currently, LiveDirsFX does not support this option to consolidate directories into one row. So, the above files would be displayed as:
The text was updated successfully, but these errors were encountered: