├── .editorconfig ├── .github └── workflows │ ├── verify-linux.yml │ └── verify-windows.yml ├── .gitignore ├── .mvn └── wrapper │ ├── MavenWrapperDownloader.java │ └── maven-wrapper.properties ├── LICENSE ├── NOTICE ├── README.md ├── _config.yml ├── checkstyle.xml ├── demos ├── TestData │ └── SomeFiles │ │ ├── HorrbibleSpreadSheet.xls │ │ ├── JustNumbers.csv │ │ ├── NewerDocument.docx │ │ ├── OldDocument.doc │ │ ├── SupposedToBeXtensible.xml │ │ ├── TestFile1.txt │ │ ├── TestFile2.txt │ │ ├── TestFile3.txt │ │ ├── TestFile4.txt │ │ ├── TestFile5.txt │ │ ├── XtremeHorrbibleSpreadSheet.xlsx │ │ └── anotherDir │ │ └── TestFile2.txt ├── pom.xml └── src │ └── main │ ├── java │ ├── module-info.java │ └── net │ │ └── raumzeitfalle │ │ └── demos │ │ ├── DemoDirectoryChooser.java │ │ ├── DemoFileChooser.java │ │ ├── DemoFxDialog.java │ │ ├── DemoFxStage.java │ │ ├── DemoJavaFxDialog.java │ │ ├── DemoJavaFxStage.java │ │ ├── DemoJavaSwingIntegration.java │ │ ├── DemoSwing.java │ │ └── fxml │ │ ├── ApplicationTemplate.java │ │ ├── Demo1.java │ │ ├── Demo2.java │ │ ├── Demo3.java │ │ ├── DemoApplication.java │ │ └── DemoController.java │ └── resources │ ├── FXMLView.fxml │ └── net │ └── raumzeitfalle │ └── demos │ └── fxml │ ├── Demo1.fxml │ ├── Demo2.fxml │ └── Demo3.fxml ├── eclipse-java-code-formatter-settings.xml ├── filechooser ├── pom.xml └── src │ └── main │ ├── java │ ├── module-info.java │ └── net │ │ └── raumzeitfalle │ │ └── fx │ │ ├── dirchooser │ │ ├── DirectoryChooser.java │ │ ├── DirectoryChooserController.java │ │ ├── DirectoryChooserProperties.java │ │ ├── DirectoryChooserView.java │ │ ├── DirectoryIcons.java │ │ ├── DirectoryTreeItem.java │ │ ├── DirectoryTreeUpdateTask.java │ │ ├── DirectoryWalker.java │ │ └── ProgressIcon.java │ │ └── filechooser │ │ ├── DirectoryChooserOption.java │ │ ├── FXDirectoryChooser.java │ │ ├── FXFileChooserDialog.java │ │ ├── FXFileChooserStage.java │ │ ├── FileChooser.java │ │ ├── FileChooserController.java │ │ ├── FileChooserModel.java │ │ ├── FileChooserProperties.java │ │ ├── FileChooserViewOption.java │ │ ├── FileIcons.java │ │ ├── FileUpdateService.java │ │ ├── FilesListCell.java │ │ ├── FindFilesTask.java │ │ ├── HideableView.java │ │ ├── IndexedPath.java │ │ ├── Invoke.java │ │ ├── LocationMenuItemFactory.java │ │ ├── PathComparator.java │ │ ├── PathFilter.java │ │ ├── PathUpdateHandler.java │ │ ├── RefreshBuffer.java │ │ ├── Skin.java │ │ ├── SwingDialogReturnValues.java │ │ ├── SwingFileChooser.java │ │ ├── SwingFileChooserProperties.java │ │ ├── UpdateService.java │ │ └── locations │ │ ├── Location.java │ │ ├── Locations.java │ │ └── NamedLocation.java │ └── resources │ ├── directorychooser.properties │ ├── filechooser.properties │ ├── net │ └── raumzeitfalle │ │ └── fx │ │ ├── dirchooser │ │ ├── DirectoryChooser.fxml │ │ ├── DirectoryChooserDark.css │ │ ├── DirectoryChooserView.fxml │ │ ├── DirectoryChooserViewDark.css │ │ ├── fireworks │ │ │ ├── folder-closed-32.fw.png │ │ │ ├── folder-closed-plus-32.fw.png │ │ │ ├── folder-closed-unknown-xl-32.fw.png │ │ │ ├── folder-closed-xl-32.fw.png │ │ │ ├── folder-empty-32.fw.png │ │ │ ├── folder-file-open-32.fw.png │ │ │ ├── folder-open-32.fw.png │ │ │ ├── host-computer-32.fw.png │ │ │ ├── windows-drive-32.fw.png │ │ │ ├── windows-drive-empty-32.fw.png │ │ │ ├── windows-drive-plus-32.fw.png │ │ │ └── windows-drive-xl-32.fw.png │ │ └── icons │ │ │ ├── folder-closed-32.png │ │ │ ├── folder-closed-plus-32.png │ │ │ ├── folder-closed-unknown-xl-32.png │ │ │ ├── folder-closed-xl-32.png │ │ │ ├── folder-empty-32.png │ │ │ ├── folder-file-open-32.png │ │ │ ├── folder-open-32.png │ │ │ ├── host-computer-32.png │ │ │ ├── windows-drive-32.png │ │ │ ├── windows-drive-empty-32.png │ │ │ ├── windows-drive-plus-32.png │ │ │ └── windows-drive-xl-32.png │ │ └── filechooser │ │ ├── FXFileChooserDialogDark.css │ │ ├── FileChooser.fxml │ │ ├── FileChooserDark.css │ │ ├── FileChooserModena.css │ │ ├── FileChooserView.fxml │ │ ├── FileChooserViewDark.css │ │ ├── copy-solid.svg │ │ ├── file-alt.svg │ │ ├── filter.svg │ │ ├── fireworks │ │ ├── file-csv.fw.png │ │ ├── file-doc.fw.png │ │ ├── file-docx.fw.png │ │ ├── file-docx2.fw.png │ │ ├── file-docx3.fw.png │ │ ├── file-docx4.fw.png │ │ ├── file-icon-template.fw.png │ │ ├── file-template.png │ │ ├── file-txt.fw.png │ │ ├── file-xls.fw.png │ │ ├── file-xlsx.fw.png │ │ ├── file-xlsx3.fw.png │ │ ├── file-xlsx4.fw.png │ │ ├── file-xml.fw.png │ │ └── template.png │ │ ├── folder-open.svg │ │ ├── icons │ │ ├── file-csv.png │ │ ├── file-doc.png │ │ ├── file-docx.png │ │ ├── file-docx2.png │ │ ├── file-docx3.png │ │ ├── file-docx4.png │ │ ├── file-txt.png │ │ ├── file-unknown.png │ │ ├── file-xls.png │ │ ├── file-xlsx.png │ │ ├── file-xlsx3.png │ │ ├── file-xlsx4.png │ │ └── file-xml.png │ │ ├── paste-solid.svg │ │ ├── sort-alpha-down.svg │ │ ├── sort-alpha-up.svg │ │ ├── sort-calendar-down.svg │ │ ├── sort-calendar-up.svg │ │ ├── sort-time-down.svg │ │ ├── sort-time-up.svg │ │ ├── stop-circle.svg │ │ ├── stop.svg │ │ └── sync-alt.svg │ └── swingfilechooser.properties ├── mvnw ├── mvnw.cmd ├── pages ├── ConvenienceFunctions.png ├── DefaultLocationsExample.png ├── OSX_JavaFX_Dialog.png ├── OSX_JavaFX_Stage.png ├── OSX_Swing_JFXPanel.png ├── PathFilterExample.png ├── SortingMenuExample.png ├── Windows81_JavaFX_Stage.png ├── Windows81_Swing_Dialog_ProcessRunning.png └── filechooser │ ├── FXML_and_ids.afdesign │ └── FXML_and_ids.png ├── pom.xml ├── scenicView.properties └── tests ├── TestData └── SomeFiles │ ├── HorrbibleSpreadSheet.xls │ ├── JustNumbers.csv │ ├── NewerDocument.docx │ ├── OldDocument.doc │ ├── SupposedToBeXtensible.xml │ ├── TestFile1.txt │ ├── TestFile2.txt │ ├── TestFile3.txt │ ├── TestFile4.txt │ ├── TestFile5.txt │ ├── XtremeHorrbibleSpreadSheet.xlsx │ └── anotherDir │ └── TestFile2.txt ├── pom.xml └── src └── test └── java └── net └── raumzeitfalle └── fx └── filechooser ├── FXFileChooserStage1Test.java ├── FXFileChooserStage2Test.java ├── FXFileChooserStage3Test.java ├── FileChooserControllerTest.java ├── FileChooserDarkTest.java ├── FileChooserModelApplicationTest.java ├── FileChooserModelFactoryMethodsFxTest.java ├── FileChooserModelTest.java ├── FileChooserModenaTest.java ├── FileChooserTestBase.java ├── FileUpdateServiceTest.java ├── FilesListCellTest.java ├── FindFilesTaskTest.java ├── FxTestTemplate.java ├── IndexedPathTest.java ├── PathComparatorTest.java ├── PathFilterTest.java ├── RandomFileCreator.java ├── RefreshBufferTest.java ├── ServiceWorkerStateListener.java └── locations ├── LocationsTest.java └── NamedLocationTest.java /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | root = true 3 | 4 | [*.java] 5 | indent_style = space 6 | indent_size = 4 7 | 8 | [*.fxml] 9 | indent_style = space 10 | indent_size = 2 11 | 12 | [*.yml] 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [pom.xml] 17 | indent_style = space 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /.github/workflows/verify-linux.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: Verify on Linux Ubuntu 10 | 11 | on: workflow_dispatch 12 | 13 | jobs: 14 | build: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v3 18 | - name: Set up JDK 17 19 | uses: actions/setup-java@v3 20 | with: 21 | java-version: '17' 22 | distribution: 'zulu' 23 | cache: maven 24 | - name: Setup 25 | run: export DISPLAY=:90 & Xvfb -ac :90 -screen 0 1280x1024x24 > /dev/null 2>&1 26 | - name: Verify 27 | run: mvn -B verify -P github 28 | -------------------------------------------------------------------------------- /.github/workflows/verify-windows.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: Verify on Windows 10 | 11 | on: push 12 | 13 | jobs: 14 | build: 15 | 16 | runs-on: windows-latest 17 | 18 | steps: 19 | - uses: actions/checkout@v3 20 | - name: Set up JDK 17 21 | uses: actions/setup-java@v3 22 | with: 23 | java-version: '17' 24 | distribution: 'zulu' 25 | cache: maven 26 | - name: Verify 27 | run: mvn -B verify -P github 28 | 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .DS_Store 3 | Screenshot*.png 4 | .flattened-pom.xml 5 | .idea/ 6 | .mvn/wrapper/maven-wrapper.jar 7 | .project 8 | .project/ 9 | .settings/ 10 | filechooser.iml 11 | target/ 12 | build/ 13 | bin/ 14 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2017 - 2019 Oliver Loeffler, Raumzeitfalle.net 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | 1. Open Source Attributions 16 | 17 | The icon shapes (SVG) used herein are provided by FontAwesome Free 5.01. 18 | FontAwesome Free 5.01 is licensed under Font Awesome Free License. 19 | 20 | In the Font Awesome Free download, the CC BY 4.0 license applies to all icons 21 | packaged as SVG and JS file types. 22 | 23 | In most cases, the SVG files are not used directly but the included SVG paths 24 | and shapes are embedded into either FXML code or JAVA code. 25 | 26 | 1.1 Font Awesome Free License 27 | https://fontawesome.com/license/free 28 | 29 | 1.2 CC BY 4.0 license 30 | https://creativecommons.org/licenses/by/4.0/ 31 | 32 | 2. Modifications 33 | 34 | The SVG icons provided by FontAwesome Free have been modified using 35 | InkScape https://inkscape.org/. Modifications include (but are not limited to) 36 | aspect ratio and size of the SVG files. -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /demos/TestData/SomeFiles/HorrbibleSpreadSheet.xls: -------------------------------------------------------------------------------- 1 | TestFile1.txt -------------------------------------------------------------------------------- /demos/TestData/SomeFiles/JustNumbers.csv: -------------------------------------------------------------------------------- 1 | TestFile1.txt -------------------------------------------------------------------------------- /demos/TestData/SomeFiles/NewerDocument.docx: -------------------------------------------------------------------------------- 1 | TestFile1.txt -------------------------------------------------------------------------------- /demos/TestData/SomeFiles/OldDocument.doc: -------------------------------------------------------------------------------- 1 | TestFile1.txt -------------------------------------------------------------------------------- /demos/TestData/SomeFiles/SupposedToBeXtensible.xml: -------------------------------------------------------------------------------- 1 | TestFile1.txt -------------------------------------------------------------------------------- /demos/TestData/SomeFiles/TestFile1.txt: -------------------------------------------------------------------------------- 1 | TestFile1.txt -------------------------------------------------------------------------------- /demos/TestData/SomeFiles/TestFile2.txt: -------------------------------------------------------------------------------- 1 | TestFile2.txt -------------------------------------------------------------------------------- /demos/TestData/SomeFiles/TestFile3.txt: -------------------------------------------------------------------------------- 1 | TestFile3.txt -------------------------------------------------------------------------------- /demos/TestData/SomeFiles/TestFile4.txt: -------------------------------------------------------------------------------- 1 | TestFile4.txt -------------------------------------------------------------------------------- /demos/TestData/SomeFiles/TestFile5.txt: -------------------------------------------------------------------------------- 1 | TestFile5.txt -------------------------------------------------------------------------------- /demos/TestData/SomeFiles/XtremeHorrbibleSpreadSheet.xlsx: -------------------------------------------------------------------------------- 1 | TestFile1.txt -------------------------------------------------------------------------------- /demos/TestData/SomeFiles/anotherDir/TestFile2.txt: -------------------------------------------------------------------------------- 1 | TestFile2.txt -------------------------------------------------------------------------------- /demos/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | net.raumzeitfalle.fx 6 | fxfilechooser 7 | 0.0.12-SNAPSHOT 8 | 9 | 4.0.0 10 | demos 11 | jar 12 | 13 | 14 | 15 | net.raumzeitfalle.fx 16 | filechooser 17 | 0.0.12-SNAPSHOT 18 | 19 | 20 | 21 | 22 | 23 | 24 | org.apache.maven.plugins 25 | maven-compiler-plugin 26 | 27 | ${java.version} 28 | ${java.version} 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /demos/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * FXFileChooser 4 | * %% 5 | * Copyright (C) 2017 - 2022 Oliver Loeffler, Raumzeitfalle.net 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | module net.raumzeitfalle.demos { 22 | requires java.logging; 23 | requires javafx.controls; 24 | requires javafx.swing; 25 | requires transitive java.desktop; 26 | requires transitive javafx.graphics; 27 | requires transitive javafx.fxml; 28 | requires net.raumzeitfalle.fxfilechooser; 29 | opens net.raumzeitfalle.demos to javafx.fxml, javafx.graphics; 30 | opens net.raumzeitfalle.demos.fxml to javafx.fxml, javafx.graphics; 31 | } 32 | -------------------------------------------------------------------------------- /demos/src/main/java/net/raumzeitfalle/demos/DemoDirectoryChooser.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * FXFileChooser 4 | * %% 5 | * Copyright (C) 2017 - 2022 Oliver Loeffler, Raumzeitfalle.net 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | package net.raumzeitfalle.demos; 21 | 22 | import java.nio.file.Path; 23 | 24 | import javafx.application.Application; 25 | import javafx.scene.Scene; 26 | import javafx.scene.control.Alert; 27 | import javafx.stage.Stage; 28 | import net.raumzeitfalle.fx.dirchooser.DirectoryChooser; 29 | import net.raumzeitfalle.fx.filechooser.Skin; 30 | 31 | public class DemoDirectoryChooser extends Application { 32 | public static void main(String[] args) { 33 | Application.launch(); 34 | } 35 | 36 | private DirectoryChooser dirChooser; 37 | 38 | private Scene scene; 39 | 40 | @Override 41 | public void start(Stage primaryStage) throws Exception { 42 | dirChooser = new DirectoryChooser(Skin.DARK); 43 | dirChooser.useCancelButtonProperty().setValue(true); 44 | dirChooser.onSelect(() -> { 45 | Path selectedDir = dirChooser.selectedDirectoryProperty().get(); 46 | showMessage("Selected:", selectedDir.normalize().toAbsolutePath().toString()); 47 | }); 48 | dirChooser.onCancel(() -> 49 | showMessage("Cancelled:", "One can hide the cancel button if not needed.") 50 | ); 51 | scene = new Scene(dirChooser); 52 | primaryStage.setScene(scene); 53 | primaryStage.setTitle("Demo"); 54 | primaryStage.show(); 55 | } 56 | 57 | @Override 58 | public void stop() { 59 | dirChooser.shutdown(); 60 | } 61 | 62 | private void showMessage(String action, String message) { 63 | Alert alert = new Alert(Alert.AlertType.INFORMATION); 64 | alert.initOwner(scene.getWindow()); 65 | alert.setTitle("DirectoryChooser"); 66 | alert.setHeaderText(action); 67 | alert.setContentText(message); 68 | alert.show(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /demos/src/main/java/net/raumzeitfalle/demos/DemoFileChooser.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * FXFileChooser 4 | * %% 5 | * Copyright (C) 2017 - 2022 Oliver Loeffler, Raumzeitfalle.net 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | package net.raumzeitfalle.demos; 21 | 22 | import javafx.application.Application; 23 | import javafx.scene.Scene; 24 | import javafx.stage.Stage; 25 | import net.raumzeitfalle.fx.filechooser.DirectoryChooserOption; 26 | import net.raumzeitfalle.fx.filechooser.FileChooser; 27 | import net.raumzeitfalle.fx.filechooser.Skin; 28 | 29 | public class DemoFileChooser extends Application { 30 | 31 | public static void main(String[] args) { 32 | Application.launch(); 33 | } 34 | 35 | private FileChooser fileChooser; 36 | 37 | @Override 38 | public void start(Stage primaryStage) throws Exception { 39 | fileChooser = new FileChooser(Skin.DARK, DirectoryChooserOption.CUSTOM); 40 | Scene scene = new Scene(fileChooser); 41 | primaryStage.setScene(scene); 42 | primaryStage.setTitle("Demo"); 43 | primaryStage.show(); 44 | } 45 | 46 | @Override 47 | public void stop() { 48 | fileChooser.shutdown(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /demos/src/main/java/net/raumzeitfalle/demos/DemoFxDialog.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * FXFileChooser 4 | * %% 5 | * Copyright (C) 2017 - 2020 Oliver Loeffler, Raumzeitfalle.net 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | package net.raumzeitfalle.demos; 21 | 22 | import java.nio.file.Path; 23 | 24 | import javafx.application.Application; 25 | import javafx.scene.Scene; 26 | import javafx.scene.control.Alert; 27 | import javafx.scene.control.Button; 28 | import javafx.stage.Stage; 29 | import net.raumzeitfalle.fx.filechooser.FXFileChooserDialog; 30 | import net.raumzeitfalle.fx.filechooser.Skin; 31 | 32 | public class DemoFxDialog extends Application { 33 | public static void main(String[] args) { 34 | Application.launch(); 35 | } 36 | 37 | @Override 38 | public void start(Stage primaryStage) throws Exception { 39 | Button button = new Button("Show File Chooser"); 40 | FXFileChooserDialog dialog = FXFileChooserDialog.create(Skin.DARK); 41 | button.setOnAction(evt -> dialog.showOpenDialog(primaryStage).ifPresent(this::showSelection)); 42 | 43 | Scene scene = new Scene(button); 44 | primaryStage.setScene(scene); 45 | primaryStage.setTitle("Demo"); 46 | primaryStage.show(); 47 | } 48 | 49 | private void showSelection(Path selectedPath) { 50 | Alert alert = new Alert(Alert.AlertType.INFORMATION); 51 | alert.setHeaderText("File Selection"); 52 | alert.setContentText(selectedPath.toString()); 53 | alert.show(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /demos/src/main/java/net/raumzeitfalle/demos/DemoFxStage.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * FXFileChooser 4 | * %% 5 | * Copyright (C) 2017 - 2020 Oliver Loeffler, Raumzeitfalle.net 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | package net.raumzeitfalle.demos; 21 | 22 | import javafx.application.Application; 23 | import javafx.scene.Scene; 24 | import javafx.scene.control.Alert; 25 | import javafx.scene.control.Button; 26 | import javafx.stage.Stage; 27 | import net.raumzeitfalle.fx.filechooser.FXFileChooserStage; 28 | import net.raumzeitfalle.fx.filechooser.Skin; 29 | 30 | import java.nio.file.Path; 31 | 32 | public class DemoFxStage extends Application { 33 | public static void main(String[] args) { 34 | Application.launch(); 35 | } 36 | 37 | @Override 38 | public void start(Stage primaryStage) throws Exception { 39 | Button button = new Button("Show File Chooser"); 40 | FXFileChooserStage fc = FXFileChooserStage.create(Skin.DARK); 41 | button.setOnAction(evt -> fc.showOpenDialog(primaryStage) 42 | .ifPresent(this::showSelection)); 43 | 44 | Scene scene = new Scene(button); 45 | primaryStage.setScene(scene); 46 | primaryStage.setTitle("Demo"); 47 | primaryStage.show(); 48 | } 49 | 50 | private void showSelection(Path selectedPath) { 51 | Alert alert = new Alert(Alert.AlertType.INFORMATION); 52 | alert.setHeaderText("File Selection"); 53 | alert.setContentText(selectedPath.toString()); 54 | alert.show(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /demos/src/main/java/net/raumzeitfalle/demos/DemoJavaFxDialog.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * FXFileChooser 4 | * %% 5 | * Copyright (C) 2017 - 2019 Oliver Loeffler, Raumzeitfalle.net 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | package net.raumzeitfalle.demos; 21 | 22 | import java.nio.file.Path; 23 | import java.nio.file.Paths; 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | import java.util.Optional; 27 | import java.util.logging.Level; 28 | import java.util.logging.Logger; 29 | 30 | import javafx.application.Application; 31 | import javafx.scene.Scene; 32 | import javafx.scene.control.Button; 33 | import javafx.scene.layout.VBox; 34 | import javafx.stage.Stage; 35 | import net.raumzeitfalle.fx.filechooser.FXFileChooserDialog; 36 | import net.raumzeitfalle.fx.filechooser.PathFilter; 37 | import net.raumzeitfalle.fx.filechooser.Skin; 38 | import net.raumzeitfalle.fx.filechooser.locations.Location; 39 | import net.raumzeitfalle.fx.filechooser.locations.Locations; 40 | 41 | public class DemoJavaFxDialog extends Application { 42 | 43 | @Override 44 | public void start(Stage primaryStage) throws Exception { 45 | 46 | PathFilter all = PathFilter.acceptAllFiles("all files"); 47 | 48 | PathFilter exe = PathFilter.forFileExtension("Program", "exe"); 49 | PathFilter xml = PathFilter.forFileExtension("XML", "xml"); 50 | PathFilter txt = PathFilter.forFileExtension("Text", "txt"); 51 | 52 | PathFilter xls = PathFilter.forFileExtension("Excel 2003", "xls"); 53 | PathFilter xlsx = PathFilter.forFileExtension("Excel 2007+", "xlsx").combine(xls); 54 | 55 | FXFileChooserDialog darkfc = FXFileChooserDialog.create(Skin.DARK, all, exe, xml, txt, xlsx); 56 | 57 | List locations = new ArrayList<>(); 58 | locations.add(Locations.withName("Configs: /etc", Paths.get("/etc"))); 59 | locations.add(Locations.withName("User Homes: /Users", Paths.get("/Users"))); 60 | locations.add(Locations.withName("C-Drive: C:\\", Paths.get("C:/"))); 61 | 62 | darkfc.addLocations(locations); 63 | 64 | Logger logger = Logger.getLogger(DemoJavaFxDialog.class.getSimpleName()); 65 | 66 | Button showDarkDialog = new Button("Show dark JavaFX Dialog (FXFileChooserDialog.class)"); 67 | showDarkDialog.setOnAction(a -> { 68 | 69 | Optional path = darkfc.showOpenDialog(primaryStage); 70 | logger.log(Level.INFO, path.map(String::valueOf).orElse("Nothing selected")); 71 | 72 | }); 73 | 74 | FXFileChooserDialog fc = FXFileChooserDialog.create(Skin.MODENA, all, exe, xml, txt, xlsx); 75 | Button showDialog = new Button("Show default JavaFX Dialog (FXFileChooserDialog.class)"); 76 | showDialog.setOnAction(a -> { 77 | 78 | Optional path = fc.showOpenDialog(primaryStage); 79 | logger.log(Level.INFO, path.map(String::valueOf).orElse("Nothing selected")); 80 | 81 | }); 82 | 83 | VBox vbox = new VBox(showDarkDialog, showDialog); 84 | Scene scene = new Scene(vbox); 85 | primaryStage.setScene(scene); 86 | primaryStage.setWidth(400); 87 | primaryStage.setHeight(200); 88 | primaryStage.show(); 89 | } 90 | 91 | public static void main(String[] args) { 92 | launch(new String[0]); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /demos/src/main/java/net/raumzeitfalle/demos/DemoSwing.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * FXFileChooser 4 | * %% 5 | * Copyright (C) 2017 - 2020 Oliver Loeffler, Raumzeitfalle.net 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | package net.raumzeitfalle.demos; 21 | 22 | import java.awt.FlowLayout; 23 | 24 | import javax.swing.JButton; 25 | import javax.swing.JFrame; 26 | import javax.swing.JOptionPane; 27 | 28 | import net.raumzeitfalle.fx.filechooser.Skin; 29 | import net.raumzeitfalle.fx.filechooser.SwingFileChooser; 30 | 31 | public class DemoSwing { 32 | public static void main(String... args) { 33 | 34 | JFrame frame = new JFrame("Window"); 35 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 36 | frame.setLayout(new FlowLayout(FlowLayout.LEFT)); 37 | JButton showDialogButton = new JButton("show SwingFileChooser"); 38 | frame.getContentPane().add(showDialogButton); 39 | 40 | // SwingFileChooser.setUseJavaFxDirectoryChooser(true); 41 | SwingFileChooser fileChooser = SwingFileChooser.create(Skin.DARK); 42 | showDialogButton.addActionListener(l -> { 43 | int option = fileChooser.showOpenDialog(frame); 44 | if (option == SwingFileChooser.APPROVE_OPTION) { 45 | JOptionPane.showMessageDialog(frame, fileChooser.getSelectedFile().toString()); 46 | } 47 | }); 48 | 49 | frame.pack(); 50 | frame.setVisible(true); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /demos/src/main/java/net/raumzeitfalle/demos/fxml/ApplicationTemplate.java: -------------------------------------------------------------------------------- 1 | package net.raumzeitfalle.demos.fxml; 2 | 3 | import javafx.application.Application; 4 | import javafx.fxml.FXMLLoader; 5 | import javafx.scene.Scene; 6 | import javafx.scene.layout.Pane; 7 | import javafx.stage.Stage; 8 | 9 | import java.net.URL; 10 | 11 | abstract class ApplicationTemplate extends Application { 12 | @Override 13 | public void start(Stage stage) throws Exception { 14 | FXMLLoader loader = new FXMLLoader(); 15 | DemoController controller = new DemoController(); 16 | loader.setController(controller); 17 | 18 | String appName = getClass().getSimpleName(); 19 | URL fxmlUrl = getClass().getResource(appName+".fxml"); 20 | loader.setLocation(fxmlUrl); 21 | 22 | Pane root = loader.load(); 23 | Scene scene = new Scene(root); 24 | 25 | stage.setScene(scene); 26 | stage.setTitle(appName+" Application"); 27 | stage.show(); 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /demos/src/main/java/net/raumzeitfalle/demos/fxml/Demo1.java: -------------------------------------------------------------------------------- 1 | package net.raumzeitfalle.demos.fxml; 2 | 3 | /** 4 | * FXML using constructor arguments 5 | * 7 | */ 8 | public class Demo1 extends ApplicationTemplate { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /demos/src/main/java/net/raumzeitfalle/demos/fxml/Demo2.java: -------------------------------------------------------------------------------- 1 | package net.raumzeitfalle.demos.fxml; 2 | 3 | /** 4 | * FXML using constructor arguments 5 | * 7 | */ 8 | public class Demo2 extends ApplicationTemplate { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /demos/src/main/java/net/raumzeitfalle/demos/fxml/Demo3.java: -------------------------------------------------------------------------------- 1 | package net.raumzeitfalle.demos.fxml; 2 | 3 | /** 4 | * FXML using constructor arguments 5 | * 7 | */ 8 | public class Demo3 extends ApplicationTemplate { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /demos/src/main/java/net/raumzeitfalle/demos/fxml/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package net.raumzeitfalle.demos.fxml; 2 | 3 | import java.net.URL; 4 | 5 | import javafx.application.Application; 6 | import javafx.fxml.FXMLLoader; 7 | import javafx.scene.Scene; 8 | import javafx.scene.layout.Pane; 9 | import javafx.stage.Stage; 10 | 11 | public class DemoApplication extends Application { 12 | 13 | public static void main(String[] args) { 14 | launch(DemoApplication.class); 15 | } 16 | 17 | @Override 18 | public void start(Stage stage) throws Exception { 19 | FXMLLoader loader = new FXMLLoader(); 20 | DemoController controller = new DemoController(); 21 | loader.setController(controller); 22 | 23 | URL fxmlUrl = getClass().getResource("/FXMLView.fxml"); 24 | loader.setLocation(fxmlUrl); 25 | 26 | Pane root = loader.load(); 27 | Scene scene = new Scene(root); 28 | 29 | stage.setScene(scene); 30 | stage.setTitle("Demo Application"); 31 | stage.show(); 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /demos/src/main/java/net/raumzeitfalle/demos/fxml/DemoController.java: -------------------------------------------------------------------------------- 1 | package net.raumzeitfalle.demos.fxml; 2 | 3 | import java.net.URL; 4 | import java.util.ResourceBundle; 5 | 6 | import javafx.fxml.FXML; 7 | import javafx.fxml.Initializable; 8 | import javafx.scene.control.Button; 9 | 10 | public class DemoController implements Initializable { 11 | 12 | @FXML 13 | public net.raumzeitfalle.fx.filechooser.FileChooser fileChooser; 14 | 15 | @FXML 16 | public Button actionButton; 17 | 18 | @Override 19 | public void initialize(URL url, ResourceBundle resourceBundle) { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /demos/src/main/resources/FXMLView.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |