Drombler / drombler-fx

Drombler FX - the modular application framework for JavaFX.
https://www.drombler.org/drombler-fx
Other
60 stars 8 forks source link

File extension used in AbstractDocumentHandler #176

Closed claudio-rosati closed 7 years ago

claudio-rosati commented 7 years ago

Hello,

in the sample application, then FooHandler uses a file extension set to "foo".

On my mac, when I select Fille > Open ony files named "foo" can be selected when the filter is Foo Document [foo].

To open file whose extension is .foo I have to use "*.foo" instead (displayed as Foo Document [*.foo] filter in the open dialog).

I don't understand if this is a bug or not. In the last case maybe a short description should be provided in the tutorial.

Anyway, once the file is correctly selected, no editor is displayed, no error messages in console.

Configuration:

puce77 commented 7 years ago

I have to investigate this and will come back to you.

puce77 commented 7 years ago

On Linux, everything works as expected (*.foo are shown and can be loaded). I will check it on a Mac as well.

puce77 commented 7 years ago

The class which manages the FileChooser: https://github.com/Drombler/drombler-fx/blob/develop/drombler-fx-core-data/src/main/java/org/drombler/fx/core/data/impl/FXFileChooserProvider.java

claudio-rosati commented 7 years ago

Hello @puce77,

I've done some tests (see file-chooser-test.zip) to understand how the filter mus be built to work on the various platforms. With the test application one should be able to select a sample.foo file somewere in the disk.

I've installed 4 filters:

The results are the following:

On MacOS X "foo" will selects files without extensions whose name ends in 'foo".

That said, my proposal is to change line 88 of FXFileChooserProvider.java to the following:

.map(fileExtension -> WILDCARD + "." + fileExtension.toLowerCase())

(Or include '.' inside WILDCARD).