Open JordanMartinez opened 8 years ago
It would be nice to have.
By overriding the cell factory, you can at least use the short names:
some/
package/
name/
firstName/
text.java
code.java
secondName/
subPackage/
someClass.java
writer.java
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 flatMap
on ObservableList
first. It would also live completely outside of LiveDirs.
It would also live completely outside of LiveDirs.
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 flatMap
would be implemented in ReactFX?
It doesn't really matter where it is implemented, but yes, ReactFX would be a natural place for that flatMap
. In fact, it is the only big feature left to be implemented before I want to release ReactFX 2.0.
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.
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: