-
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
Generalize TreeItem used in root and children of a TreeView #7
Generalize TreeItem used in root and children of a TreeView #7
Conversation
…eeding to directly implement them and duplicate code.
…egular TreeItem class for its root and children.
- Now that "T" generic is used in class, update `wrap()`'s generic to "U" - Return lambda back to method reference (this was accidentally and erroneously reverted in previous commit)
Looks reasonable. I would probably try to look if there is a way to avoid these type castings: PathItem<T> pathCh = (PathItem<T>) ch; Seems the only reason why you cast it to Another thing is, I'm not sure whether having NormalLiveDirs<I> simpler enough for the user than LiveDirs<I, Path> ? |
That's smarter and cleaner.
Would a user subclass Initially, I was trying to better distinguish |
|
But I want it to work well! 😆 Good point! |
I've tried out your idea but come across a couple of places where I will have to cast the |
I've actually been meaning to ask you about that. Much of what you've written already implements the Directory-watching code I'd need. (I only looked here first because I wasn't familiar with that how to write the necessary code and you'd already done a good job of writing it). However, in terms of composition, there will be a lot of work I'll have to do if I use your code (specifically, I'm thinking about #2). In some ways, I feel like my need is a bit outside the scope of this project only because So, if I wanted to use part of your code in JGitFX directly (so I wouldn't need to add a dependency somewhere), how do I copy your code into that project's files while still adhering to the BSD License, especially once I start modifying the code according to my needs? Can I even do that? |
The license requires you to only redistribute the original copyright and license terms somewhere along the source and binary distributions (alongside whatever additional copyright and license terms you wish to add). But between us, don't worry if you don't 😉 |
Sweet! I'll use that as a last-resort. Thanks :-) Edit: Besides the two issues I've opened up here, there's also the text coloring that needs to be done for each file's state
|
I've updated this with my CheckBoxTreeCell implementation. It works for the most part. However, the recursive forced check/uncheck downwards doesn't work past the 1st children level. I'm not entirely sure why, but the |
- Checking/Unchecking a directory wouldn't update all of its children recursively to the same state - Checking/Unchecking a directory would sometimes make its parent's state UNDEFINED when it should be CHECKED or UNCHECKED
Alright! That was hard, but it works! |
Well, I don't think the checkbox stuff belongs to this library. It is OK to provide a demo that shows this stuff is possible, but the core library itself is not concerned with UI stuff. It provides a model of a (changing) directory tree. |
Ok, I can move it to a demo package like the one you have in RichTextFX |
That would be nice. But in order to not include the demos in the core library jar, it would first need a little reorganization of the directory tree and the build script (as in RichTextFX). |
Lol... when I said "package", I meant "module." Might help if I used the right terminology... Yes, that's exactly what I had in mind. |
👍 |
…related files (since it's GUI related) from core library and putting them into their own 'demo' module
…its previous `build.gradle` content to that module's `build.gradle` file.
…they were CheckBoxTreeItems
How's that? |
Looks good. So can we eliminate those type casts ( I would call |
Smart.
Did you see my previous comment:
|
…X into treeItemGeneral
Eliminate some type casts and warnings.
With the code and examples I've used, shouldn't that be dedicated to the public domain? Otherwise, doesn't your BSD license apply to it? |
Strictly speaking, yes. Otherwise, anyone who copies the code from the demo source would be required to carry on the copyright and license of this project. At least that is my understanding of the license. But I will not sue anyone for stealing code of the demos. Feel free to add a header to the demo files saying they are public domain. |
Ok. That should suffice. |
👍 |
Generalize the content of TreeItems from Path to arbitrary T, given functions T -> Path and Path -> T.
I named the two functions,
projector
andinjector
. However, I wonder if it might be better to name themvalToPath
andpathToVal
. Seems to be more consistent....