mgarin / weblaf

WebLaF is a fully open-source Look & Feel and component library written in pure Java for cross-platform desktop Swing applications.
http://weblookandfeel.com
GNU General Public License v3.0
1.13k stars 234 forks source link

File chooser improvements #677

Open mgarin opened 2 years ago

mgarin commented 2 years ago

Current JFileChooser implementation has a set of issues that need to be resolved.

Bugs

Initialization speed improvements

Other improvements

New features

My original plan was to rework file chooser once project is moved to Java 8+ (or even later one) to incorporate all the NIO improvements, but this might take a long while to get to. So it would be more reasonable to simply rework it at the current project stage and then improve it a bit further after the minimum supported Java version is increased.

Currently I'm planning to work on this in v1.2.15 update, so before the major changes in v1.3.0.

Sciss commented 2 years ago

If I may add another tiny improvement: If the dialog is set to select directories - FileSelectionMode.directoriesOnly - I think it's useful to select a directory dropped from the desktop manager, instead of branching into that directory. I have implemented it this way: https://github.com/Sciss/Submin/blob/main/src/main/java/de/sciss/submin/SubminFileChooserPanel.java#L138 (additional check getFileSelectionMode)

mgarin commented 2 years ago

@Sciss That's a good point, I'll throw it onto the list.

mgarin commented 2 years ago

I've already done some sketches of the rework locally before so I have the general idea how it should be done, just never really got far into the implementation.

The general goal was and still is to make no compromises - file chooser needs to have clean code, be fully styleable, asynchronous, configurable and easily modifiable in the future. Something akin to the JTabbedPane rework I've finished a while ago. That will ensure that future fixes and improvements can easily be added on top of existing implementation without breaking random things.

So if you have any other ideas on possible improvements (even any crazy ones) - feel free to throw them in here. Current chooser was written years ago and library features were way more limited back at the time, there are definitely a lot of things that can be improved now, even with Java 6 support.