├── .gradle ├── 6.1 │ ├── gc.properties │ ├── fileChanges │ │ └── last-build.bin │ ├── fileHashes │ │ ├── fileHashes.bin │ │ ├── fileHashes.lock │ │ └── resourceHashesCache.bin │ ├── fileContent │ │ └── fileContent.lock │ ├── javaCompile │ │ └── javaCompile.lock │ └── executionHistory │ │ ├── executionHistory.bin │ │ └── executionHistory.lock ├── vcs-1 │ └── gc.properties ├── 2.10 │ └── taskArtifacts │ │ ├── cache.properties │ │ ├── fileHashes.bin │ │ ├── fileSnapshots.bin │ │ ├── taskArtifacts.bin │ │ ├── outputFileStates.bin │ │ └── cache.properties.lock ├── buildOutputCleanup │ ├── cache.properties │ ├── outputFiles.bin │ └── buildOutputCleanup.lock └── checksums │ ├── checksums.lock │ ├── md5-checksums.bin │ └── sha1-checksums.bin ├── .gitignore ├── images ├── Logo.png ├── indeterminate.gif ├── areo-progressbar.jpg ├── error-progress.jpg ├── normal-progress.jpg ├── paused-progress.jpg └── full-error-progress.jpg ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .nb-gradle ├── private │ └── cache │ │ └── FXTaskbar-d41d8cd98f00b204e9800998ecf8427e └── profiles │ └── private │ └── aux-config ├── src ├── main │ └── java │ │ └── com │ │ └── nativejavafx │ │ └── taskbar │ │ ├── exception │ │ ├── StageNotShownException.java │ │ └── UnsupportedSystemException.java │ │ ├── util │ │ └── OS.java │ │ ├── strategy │ │ ├── StageIndexer.java │ │ ├── DefaultStageIndexer.java │ │ ├── HWNDStrategy.java │ │ └── GlassApiHWNDStrategy.java │ │ ├── NullTaskbarProgressbar.java │ │ ├── TaskbarProgressbarFactory.java │ │ ├── TaskbarProgressbarImpl.java │ │ └── TaskbarProgressbar.java └── test │ └── java │ ├── DemoWStaticMethods.java │ └── Demo.java ├── settings.gradle ├── common.gradle ├── gradlew.bat ├── gradlew ├── README.md └── LICENSE /.gradle/6.1/gc.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/vcs-1/gc.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/6.1/fileChanges/last-build.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/2.10/taskArtifacts/cache.properties: -------------------------------------------------------------------------------- 1 | #Fri Oct 18 18:07:25 CEST 2019 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | .idea 3 | .gradle 4 | .nb-gradle 5 | out 6 | lgcr.pptx 7 | ~$lgcr.pptx 8 | builds -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/cache.properties: -------------------------------------------------------------------------------- 1 | #Wed May 13 09:10:59 CEST 2020 2 | gradle.version=6.1 3 | -------------------------------------------------------------------------------- /images/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/images/Logo.png -------------------------------------------------------------------------------- /images/indeterminate.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/images/indeterminate.gif -------------------------------------------------------------------------------- /images/areo-progressbar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/images/areo-progressbar.jpg -------------------------------------------------------------------------------- /images/error-progress.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/images/error-progress.jpg -------------------------------------------------------------------------------- /images/normal-progress.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/images/normal-progress.jpg -------------------------------------------------------------------------------- /images/paused-progress.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/images/paused-progress.jpg -------------------------------------------------------------------------------- /.gradle/checksums/checksums.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/checksums/checksums.lock -------------------------------------------------------------------------------- /images/full-error-progress.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/images/full-error-progress.jpg -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gradle/6.1/fileHashes/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/6.1/fileHashes/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/checksums/md5-checksums.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/checksums/md5-checksums.bin -------------------------------------------------------------------------------- /.gradle/checksums/sha1-checksums.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/checksums/sha1-checksums.bin -------------------------------------------------------------------------------- /.gradle/6.1/fileHashes/fileHashes.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/6.1/fileHashes/fileHashes.lock -------------------------------------------------------------------------------- /.gradle/2.10/taskArtifacts/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/2.10/taskArtifacts/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/6.1/fileContent/fileContent.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/6.1/fileContent/fileContent.lock -------------------------------------------------------------------------------- /.gradle/6.1/javaCompile/javaCompile.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/6.1/javaCompile/javaCompile.lock -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/outputFiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/buildOutputCleanup/outputFiles.bin -------------------------------------------------------------------------------- /.gradle/2.10/taskArtifacts/fileSnapshots.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/2.10/taskArtifacts/fileSnapshots.bin -------------------------------------------------------------------------------- /.gradle/2.10/taskArtifacts/taskArtifacts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/2.10/taskArtifacts/taskArtifacts.bin -------------------------------------------------------------------------------- /.gradle/2.10/taskArtifacts/outputFileStates.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/2.10/taskArtifacts/outputFileStates.bin -------------------------------------------------------------------------------- /.gradle/6.1/fileHashes/resourceHashesCache.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/6.1/fileHashes/resourceHashesCache.bin -------------------------------------------------------------------------------- /.gradle/2.10/taskArtifacts/cache.properties.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/2.10/taskArtifacts/cache.properties.lock -------------------------------------------------------------------------------- /.gradle/6.1/executionHistory/executionHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/6.1/executionHistory/executionHistory.bin -------------------------------------------------------------------------------- /.gradle/6.1/executionHistory/executionHistory.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/6.1/executionHistory/executionHistory.lock -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/buildOutputCleanup.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.gradle/buildOutputCleanup/buildOutputCleanup.lock -------------------------------------------------------------------------------- /.nb-gradle/private/cache/FXTaskbar-d41d8cd98f00b204e9800998ecf8427e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dansoftowner/FXTaskbarProgressBar/HEAD/.nb-gradle/private/cache/FXTaskbar-d41d8cd98f00b204e9800998ecf8427e -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /src/main/java/com/nativejavafx/taskbar/exception/StageNotShownException.java: -------------------------------------------------------------------------------- 1 | package com.nativejavafx.taskbar.exception; 2 | 3 | public class StageNotShownException extends RuntimeException { 4 | public StageNotShownException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/nativejavafx/taskbar/exception/UnsupportedSystemException.java: -------------------------------------------------------------------------------- 1 | package com.nativejavafx.taskbar.exception; 2 | 3 | public class UnsupportedSystemException extends RuntimeException { 4 | public UnsupportedSystemException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'FXTaskbar' 2 | 3 | // Find the directories containing a "build.gradle" file in the root directory 4 | // of the project. That is, every directory containing a "build.gradle" will 5 | // be automatically the subproject of this project. 6 | def subDirs = rootDir.listFiles(new FileFilter() { 7 | public boolean accept(File file) { 8 | if (!file.isDirectory()) { 9 | return false 10 | } 11 | if (file.name == 'buildSrc') { 12 | return false 13 | } 14 | return new File(file, 'build.gradle').isFile() 15 | } 16 | }); 17 | 18 | subDirs.each { File dir -> 19 | include dir.name 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/nativejavafx/taskbar/util/OS.java: -------------------------------------------------------------------------------- 1 | package com.nativejavafx.taskbar.util; 2 | 3 | /** 4 | * Utility class is for checking the 5 | * type of the current platform that the 6 | * application runs on. 7 | */ 8 | public class OS { 9 | 10 | private static final String OS = System.getProperty("os.name"); 11 | private static final String VERSION = System.getProperty("os.version"); 12 | 13 | private static final boolean WINDOWS = OS.startsWith("Windows"); 14 | private static final boolean WINDOWS_7_OR_LATER = WINDOWS && versionGreaterThanOrEqualTo(6.1F); 15 | 16 | private OS() { 17 | } 18 | 19 | /** 20 | * Checks that the OS is Windows 7 or later 21 | * 22 | * @return true if the Os is windows 7 or later; 23 | * false otherwise 24 | */ 25 | public static boolean isWindows7OrLater() { 26 | return WINDOWS_7_OR_LATER; 27 | } 28 | 29 | public static boolean versionGreaterThanOrEqualTo(float value) { 30 | try { 31 | return Float.parseFloat(VERSION) >= value; 32 | } catch (Exception e) { 33 | return false; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/java/com/nativejavafx/taskbar/strategy/StageIndexer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package com.nativejavafx.taskbar.strategy; 16 | 17 | import javafx.stage.Stage; 18 | 19 | /** 20 | * A StageIndexer is used for get the index of a javaFX Stage 21 | * in the WindowHierarchy 22 | */ 23 | public interface StageIndexer { 24 | 25 | /** 26 | * Gets the index of a javaFX Stage in the Window-hierarchy. 27 | * 28 | * @param stage the stage to get the index of; mustn't be null 29 | * @return the index of the Stage 30 | * @throws NullPointerException if the stage is null 31 | */ 32 | int indexOf(Stage stage); 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/nativejavafx/taskbar/strategy/DefaultStageIndexer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package com.nativejavafx.taskbar.strategy; 16 | 17 | import com.sun.javafx.stage.StageHelper; 18 | import javafx.stage.Stage; 19 | 20 | /** 21 | * A {@link DefaultStageIndexer} is a {@link StageIndexer} 22 | * that calculates the index of the stage through the 23 | * {@link StageHelper#getStages()} API. 24 | * 25 | * Works on java 8 only 26 | */ 27 | public class DefaultStageIndexer implements StageIndexer { 28 | @Override 29 | public int indexOf(Stage stage) { 30 | return StageHelper.getStages().indexOf(stage); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/nativejavafx/taskbar/strategy/HWNDStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package com.nativejavafx.taskbar.strategy; 16 | 17 | import javafx.stage.Stage; 18 | 19 | /** 20 | * A HWNDStrategy used for getting the HWND 21 | * ("lowest-level" native window handle on Windows systems) 22 | */ 23 | public interface HWNDStrategy { 24 | 25 | /** 26 | * Returns the native handle (on Windows: HWND) 27 | * of the javaFX Stage 28 | * 29 | * @param stage the stage to get the HWND of; mustn't be null 30 | * @return the HWND value 31 | * @throws NullPointerException if the stage is null 32 | */ 33 | long getHWND(Stage stage); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/nativejavafx/taskbar/NullTaskbarProgressbar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package com.nativejavafx.taskbar; 16 | 17 | import org.jetbrains.annotations.NotNull; 18 | 19 | /** 20 | * A NullTaskbarProgressbar is a {@link TaskbarProgressbar} which 21 | * actually doesn't do everything 22 | */ 23 | class NullTaskbarProgressbar extends TaskbarProgressbar { 24 | @Override 25 | public void stopProgress() { 26 | } 27 | 28 | @Override 29 | public void showIndeterminateProgress() { 30 | } 31 | 32 | @Override 33 | public void showCustomProgress(long done, long max, @NotNull Type type) { 34 | } 35 | 36 | @Override 37 | public void setProgressType(@NotNull Type type) { 38 | } 39 | 40 | @Override 41 | public void closeOperations() { 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /.nb-gradle/profiles/private/aux-config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | file:/C:/Users/judal/OneDrive/Documents/NetBeansProjects/ToPackageNative/FXTaskbar/src/main/java/com/nativejavafx/taskbar/Demo.java 9 | file:/C:/Users/judal/OneDrive/Documents/NetBeansProjects/ToPackageNative/FXTaskbar/build.gradle 10 | file:/C:/Users/judal/OneDrive/Documents/NetBeansProjects/ToPackageNative/FXTaskbar/src/main/java/com/nativejavafx/taskbar/TaskbarProgressbar.java 11 | 12 | 13 | 14 | 15 | 16 | file:/C:/Users/judal/OneDrive/Documents/NetBeansProjects/ToPackageNative/FXTaskbar/src/main/java/com/nativejavafx/taskbar/Demo.java 17 | file:/C:/Users/judal/OneDrive/Documents/NetBeansProjects/ToPackageNative/FXTaskbar/build.gradle 18 | file:/C:/Users/judal/OneDrive/Documents/NetBeansProjects/ToPackageNative/FXTaskbar/src/main/java/com/nativejavafx/taskbar/TaskbarProgressbar.java 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /common.gradle: -------------------------------------------------------------------------------- 1 | // 2 | // This file is to be applied to every subproject. 3 | // 4 | 5 | apply plugin: 'java' 6 | apply plugin: 'maven' 7 | 8 | String mavenGroupId = '10' 9 | String mavenVersion = 'S' 10 | 11 | sourceCompatibility = '1.8' 12 | [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' 13 | 14 | repositories { 15 | mavenCentral(); 16 | // You may define additional repositories, or even remove "mavenCentral()". 17 | // Read more about repositories here: 18 | // http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:repositories 19 | } 20 | 21 | dependencies { 22 | // Adding dependencies here will add the dependencies to each subproject. 23 | testCompile group: 'junit', name: 'junit', version: '4.10' 24 | } 25 | 26 | String mavenArtifactId = name 27 | 28 | group = mavenGroupId 29 | version = mavenVersion 30 | 31 | task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') { 32 | classifier = 'sources' 33 | from sourceSets.main.allSource 34 | } 35 | 36 | artifacts { 37 | archives jar 38 | archives sourcesJar 39 | } 40 | 41 | configure(install.repositories.mavenInstaller) { 42 | pom.project { 43 | groupId = mavenGroupId 44 | artifactId = mavenArtifactId 45 | version = mavenVersion 46 | } 47 | } 48 | 49 | task createFolders(description: 'Creates the source folders if they do not exist.') doLast { 50 | sourceSets*.allSource*.srcDirs*.each { File srcDir -> 51 | if (!srcDir.isDirectory()) { 52 | println "Creating source folder: ${srcDir}" 53 | srcDir.mkdirs() 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/nativejavafx/taskbar/strategy/GlassApiHWNDStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package com.nativejavafx.taskbar.strategy; 16 | 17 | import javafx.stage.Stage; 18 | 19 | import java.util.Objects; 20 | 21 | /** 22 | * A GlassApiHWNDStrategy calculates the HWND value of 23 | * a {@link Stage} through the {@link com.sun.glass.ui.Window#getWindows()} 24 | * API. 25 | * 26 | *

27 | * This kind of process needs the index of the window in the window- 28 | * hierarchy to get the HWND value. 29 | * For the indexing, this strategy-object needs a {@link StageIndexer} 30 | */ 31 | public class GlassApiHWNDStrategy implements HWNDStrategy { 32 | 33 | private final StageIndexer indexer; 34 | 35 | /** 36 | * Creates a basic {@link GlassApiHWNDStrategy} that 37 | * needs a {@link StageIndexer}. 38 | * 39 | * @param indexer the stage-indexer; mustn't be null 40 | */ 41 | public GlassApiHWNDStrategy(StageIndexer indexer) { 42 | this.indexer = Objects.requireNonNull(indexer, "The indexer mustn't be null"); 43 | } 44 | 45 | @Override 46 | public long getHWND(Stage stage) { 47 | return com.sun.glass.ui.Window.getWindows() 48 | .get(indexer.indexOf(stage)) 49 | .getNativeWindow(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/nativejavafx/taskbar/TaskbarProgressbarFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package com.nativejavafx.taskbar; 16 | 17 | import com.nativejavafx.taskbar.strategy.GlassApiHWNDStrategy; 18 | import com.nativejavafx.taskbar.strategy.DefaultStageIndexer; 19 | import javafx.stage.Stage; 20 | 21 | import static com.nativejavafx.taskbar.TaskbarProgressbar.isNotSupported; 22 | import static com.nativejavafx.taskbar.TaskbarProgressbar.isSupported; 23 | 24 | /** 25 | * The TaskbarProgressbarFactory class is responsible for 26 | * creating the right {@link TaskbarProgressbar} object. 27 | */ 28 | public class TaskbarProgressbarFactory { 29 | 30 | static TaskbarProgressbar getTaskbarProgressbarImpl(Stage stage) { 31 | return new TaskbarProgressbarImpl(stage, new GlassApiHWNDStrategy(new DefaultStageIndexer())); 32 | } 33 | 34 | /** 35 | * Creates a {@link TaskbarProgressbar} object. 36 | * 37 | *

38 | * At first it checks that the taskbar progressbar functionality 39 | * is supported on the current system: if it is then it will 40 | * return a fully featured TaskbarProgressbar; otherwise 41 | * it will return a taskbar-progressbar object that actually 42 | * doesn't do anything. 43 | * 44 | * @param stage the stage to get the progressbar on the taskbar to 45 | * @return the taskbar-progressbar object 46 | */ 47 | public static TaskbarProgressbar getTaskbarProgressbar(Stage stage) { 48 | if (TaskbarProgressbar.isNotSupported()) 49 | return new NullTaskbarProgressbar(); 50 | return getTaskbarProgressbarImpl(stage); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /src/test/java/DemoWStaticMethods.java: -------------------------------------------------------------------------------- 1 | import com.nativejavafx.taskbar.TaskbarProgressbar; 2 | import com.nativejavafx.taskbar.TaskbarProgressbarFactory; 3 | import javafx.application.Application; 4 | import javafx.beans.property.ObjectProperty; 5 | import javafx.beans.property.SimpleObjectProperty; 6 | import javafx.geometry.Insets; 7 | import javafx.scene.Scene; 8 | import javafx.scene.control.Button; 9 | import javafx.scene.control.RadioButton; 10 | import javafx.scene.control.Slider; 11 | import javafx.scene.control.ToggleGroup; 12 | import javafx.scene.layout.VBox; 13 | import javafx.stage.Stage; 14 | 15 | public class DemoWStaticMethods extends Application { 16 | 17 | private Stage stage; 18 | private final ObjectProperty actualSelectedType = 19 | new SimpleObjectProperty(TaskbarProgressbar.Type.NORMAL) { 20 | @Override 21 | protected void invalidated() { 22 | final TaskbarProgressbar.Type type = get(); 23 | if (type != null) 24 | TaskbarProgressbar.setProgressType(stage, type); 25 | } 26 | }; 27 | 28 | @Override 29 | public void start(Stage primaryStage) { 30 | stage = primaryStage; 31 | 32 | primaryStage.setTitle("FXTaskbarProgressbar Demo"); 33 | primaryStage.setScene(new Scene(buildRoot())); 34 | primaryStage.show(); 35 | 36 | if (TaskbarProgressbar.isSupported()) 37 | TaskbarProgressbar.showIndeterminateProgress(stage); 38 | } 39 | 40 | private VBox buildRoot() { 41 | Slider slider = buildSlider(); 42 | VBox vBox = new VBox(10, slider, getToggleGroup(), buildBottom(slider)); 43 | vBox.setPadding(new Insets(10)); 44 | return vBox; 45 | } 46 | 47 | private Slider buildSlider() { 48 | Slider slider = new Slider(0, 1, 0); 49 | 50 | slider.valueProperty().addListener((observable, oldValue, newValue) -> { 51 | System.out.println(newValue); 52 | TaskbarProgressbar.showCustomProgress(stage, newValue.doubleValue(), actualSelectedType.get()); 53 | }); 54 | 55 | return slider; 56 | } 57 | 58 | private VBox getToggleGroup() { 59 | RadioButton normal = buildProgressTypeRadio(TaskbarProgressbar.Type.NORMAL); 60 | RadioButton error = buildProgressTypeRadio(TaskbarProgressbar.Type.ERROR); 61 | RadioButton paused = buildProgressTypeRadio(TaskbarProgressbar.Type.PAUSED); 62 | 63 | ToggleGroup group = new ToggleGroup(); 64 | group.getToggles().addAll(paused, error, normal); 65 | 66 | normal.setSelected(true); 67 | 68 | return new VBox(paused, normal, error); 69 | } 70 | 71 | private VBox buildBottom(Slider slider) { 72 | Button stopperBtn = new Button("Stop"); 73 | stopperBtn.setOnAction((event) -> { 74 | slider.setValue(0); 75 | TaskbarProgressbar.stopProgress(stage); 76 | }); 77 | 78 | Button indeterminateBtn = new Button("Indeterminate"); 79 | indeterminateBtn.setOnAction(event -> { 80 | slider.setValue(0); 81 | TaskbarProgressbar.showIndeterminateProgress(stage); 82 | }); 83 | 84 | return new VBox(10, stopperBtn, indeterminateBtn); 85 | } 86 | 87 | private RadioButton buildProgressTypeRadio(TaskbarProgressbar.Type type) { 88 | RadioButton btn = new RadioButton(type.name()); 89 | btn.selectedProperty().addListener((observable, oldValue, newValue) -> { 90 | if (newValue) actualSelectedType.set(type); 91 | }); 92 | return btn; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/test/java/Demo.java: -------------------------------------------------------------------------------- 1 | import com.nativejavafx.taskbar.TaskbarProgressbar; 2 | import com.nativejavafx.taskbar.TaskbarProgressbarFactory; 3 | import javafx.application.Application; 4 | import javafx.beans.property.ObjectProperty; 5 | import javafx.beans.property.SimpleObjectProperty; 6 | import javafx.geometry.Insets; 7 | import javafx.scene.Scene; 8 | import javafx.scene.control.Button; 9 | import javafx.scene.control.RadioButton; 10 | import javafx.scene.control.Slider; 11 | import javafx.scene.control.ToggleGroup; 12 | import javafx.scene.layout.VBox; 13 | import javafx.stage.Stage; 14 | 15 | public class Demo extends Application { 16 | 17 | private TaskbarProgressbar taskbarProgressbar; 18 | private final ObjectProperty actualSelectedType = 19 | new SimpleObjectProperty(TaskbarProgressbar.Type.NORMAL) { 20 | @Override 21 | protected void invalidated() { 22 | final TaskbarProgressbar.Type type = get(); 23 | if (type != null) 24 | taskbarProgressbar.setProgressType(type); 25 | } 26 | }; 27 | 28 | @Override 29 | public void start(Stage primaryStage) { 30 | taskbarProgressbar = TaskbarProgressbarFactory.getTaskbarProgressbar(primaryStage); 31 | 32 | primaryStage.setTitle("FXTaskbarProgressbar Demo"); 33 | primaryStage.setScene(new Scene(buildRoot())); 34 | primaryStage.show(); 35 | 36 | taskbarProgressbar.showIndeterminateProgress(); 37 | } 38 | 39 | private VBox buildRoot() { 40 | Slider slider = buildSlider(); 41 | VBox vBox = new VBox(10, slider, getToggleGroup(), buildBottom(slider)); 42 | vBox.setPadding(new Insets(10)); 43 | return vBox; 44 | } 45 | 46 | private Slider buildSlider() { 47 | Slider slider = new Slider(0, 1, 0); 48 | 49 | slider.valueProperty().addListener((observable, oldValue, newValue) -> { 50 | taskbarProgressbar.showCustomProgress(newValue.doubleValue(), actualSelectedType.get()); 51 | }); 52 | 53 | return slider; 54 | } 55 | 56 | private VBox getToggleGroup() { 57 | RadioButton normal = buildProgressTypeRadio(TaskbarProgressbar.Type.NORMAL); 58 | RadioButton error = buildProgressTypeRadio(TaskbarProgressbar.Type.ERROR); 59 | RadioButton paused = buildProgressTypeRadio(TaskbarProgressbar.Type.PAUSED); 60 | 61 | ToggleGroup group = new ToggleGroup(); 62 | group.getToggles().addAll(paused, error, normal); 63 | 64 | normal.setSelected(true); 65 | 66 | return new VBox(paused, normal, error); 67 | } 68 | 69 | private VBox buildBottom(Slider slider) { 70 | Button stopperBtn = new Button("Stop"); 71 | stopperBtn.setOnAction((event) -> { 72 | slider.setValue(0); 73 | taskbarProgressbar.stopProgress(); 74 | }); 75 | 76 | Button indeterminateBtn = new Button("Indeterminate"); 77 | indeterminateBtn.setOnAction(event -> { 78 | slider.setValue(0); 79 | taskbarProgressbar.showIndeterminateProgress(); 80 | }); 81 | 82 | return new VBox(10, stopperBtn, indeterminateBtn); 83 | } 84 | 85 | private RadioButton buildProgressTypeRadio(TaskbarProgressbar.Type type) { 86 | RadioButton btn = new RadioButton(type.name()); 87 | btn.selectedProperty().addListener((observable, oldValue, newValue) -> { 88 | if (newValue) actualSelectedType.set(type); 89 | }); 90 | return btn; 91 | } 92 | 93 | public static void main(String[] args) { 94 | launch(args); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/nativejavafx/taskbar/TaskbarProgressbarImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package com.nativejavafx.taskbar; 16 | 17 | import com.nativejavafx.taskbar.exception.StageNotShownException; 18 | import com.nativejavafx.taskbar.exception.UnsupportedSystemException; 19 | import com.nativejavafx.taskbar.strategy.HWNDStrategy; 20 | import javafx.stage.Stage; 21 | import org.bridj.Pointer; 22 | import org.bridj.cpp.com.COMRuntime; 23 | import org.bridj.cpp.com.shell.ITaskbarList3; 24 | import org.jetbrains.annotations.NotNull; 25 | import org.slf4j.Logger; 26 | import org.slf4j.LoggerFactory; 27 | 28 | import java.util.Objects; 29 | import java.util.concurrent.ExecutorService; 30 | import java.util.concurrent.Executors; 31 | import java.util.concurrent.atomic.AtomicReference; 32 | 33 | /** 34 | * A TaskbarProgressbarImpl is a concrete TaskbarProgressbar 35 | * implementation. 36 | * 37 | * @author Daniel Gyorffy 38 | */ 39 | class TaskbarProgressbarImpl extends TaskbarProgressbar { 40 | 41 | private static final Logger logger = LoggerFactory.getLogger(TaskbarProgressbarImpl.class); 42 | 43 | private final ExecutorService executor = Executors.newSingleThreadExecutor(DaemonThread::new); 44 | private final AtomicReference iTaskbarList3 = new AtomicReference<>(); 45 | private final AtomicReference stage = new AtomicReference<>(); 46 | private final HWNDStrategy hwndStrategy; 47 | 48 | TaskbarProgressbarImpl(HWNDStrategy hwndStrategy) { 49 | this.hwndStrategy = Objects.requireNonNull(hwndStrategy, "The HWNDStrategy mustn't be null"); 50 | this.instantiateITaskbarList(); 51 | } 52 | 53 | TaskbarProgressbarImpl(Stage stage, HWNDStrategy hwndStrategy) { 54 | this(hwndStrategy); 55 | this.setStage(stage); 56 | } 57 | 58 | synchronized void setStage(@NotNull Stage stage) { 59 | this.stage.set(stage); 60 | } 61 | 62 | private void instantiateITaskbarList() { 63 | executor.execute(() -> { 64 | try { 65 | iTaskbarList3.set(COMRuntime.newInstance(ITaskbarList3.class)); 66 | } catch (ClassNotFoundException | RuntimeException e) { 67 | logger.error("Couldn't instantiate ITaskbarList3", e); 68 | } 69 | }); 70 | } 71 | 72 | @SuppressWarnings({"unchecked", "deprecation"}) 73 | private Pointer getPointer(Stage stage) { 74 | long windowHandle = hwndStrategy.getHWND(stage); 75 | return (Pointer) Pointer.pointerToAddress(windowHandle); 76 | } 77 | 78 | private void setProgressState(Stage stage, Type type) { 79 | if (stage != null) { 80 | final Pointer pointer = getPointer(stage); 81 | executor.execute(() -> iTaskbarList3.get().SetProgressState(pointer, type.getBridjPair())); 82 | } 83 | } 84 | 85 | @Override 86 | public void stopProgress() { 87 | validate(stage.get()); 88 | if (this.stage.get() != null) { 89 | setProgressState(stage.get(), Type.NO_PROGRESS); 90 | } 91 | } 92 | 93 | @Override 94 | public void showIndeterminateProgress() { 95 | validate(stage.get()); 96 | if (this.stage.get() != null) { 97 | setProgressState(stage.get(), Type.INDETERMINATE); 98 | } 99 | } 100 | 101 | @Override 102 | public void showCustomProgress(long startValue, long endValue, @NotNull Type type) { 103 | validate(stage.get()); 104 | if (this.stage.get() != null) { 105 | final Pointer pointer = getPointer(stage.get()); 106 | executor.execute(() -> { 107 | iTaskbarList3.get().SetProgressValue(pointer, startValue, endValue); 108 | iTaskbarList3.get().SetProgressState(pointer, type.getBridjPair()); 109 | }); 110 | } 111 | } 112 | 113 | @Override 114 | public void setProgressType(@NotNull Type type) { 115 | validate(stage.get()); 116 | setProgressState(stage.get(), type); 117 | } 118 | 119 | @Override 120 | public void closeOperations() { 121 | executor.submit(() -> iTaskbarList3.get().Release()); 122 | } 123 | 124 | private void validate(Stage stage) { 125 | checkSystemSupported(); 126 | checkStageShown(stage); 127 | } 128 | 129 | private void checkStageShown(Stage stage) { 130 | if (!stage.isShowing()) throw new StageNotShownException( 131 | "The given Stage is not showing and therefore taskbar-progressbar can't be created" 132 | ); 133 | } 134 | 135 | private void checkSystemSupported() { 136 | if (isNotSupported()) throw new UnsupportedSystemException( 137 | String.format( 138 | "%s (system: %s, version: %s)", 139 | "Your system does not support taskbar-progressbar!", 140 | System.getProperty("os.name"), 141 | System.getProperty("os.version") 142 | ) 143 | ); 144 | } 145 | 146 | private static final class DaemonThread extends Thread { 147 | DaemonThread(Runnable runnable) { 148 | super(runnable); 149 | setDaemon(true); 150 | } 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=`expr $i + 1` 158 | done 159 | case $i in 160 | 0) set -- ;; 161 | 1) set -- "$args0" ;; 162 | 2) set -- "$args0" "$args1" ;; 163 | 3) set -- "$args0" "$args1" "$args2" ;; 164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=`save "$@"` 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | exec "$JAVACMD" "$@" 184 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ![JavaFXTaskbarProgressbar](images/Logo.png) 2 |

A clean and easy way to implement this amazing native Windows taskbar-progressbar functionality in javaFX

3 |

4 | 5 | GitHub last commit 6 | GitHub issues 7 | GitHub 8 |

9 | 10 | ## Background 11 | Since Windows 7 there is a taskbar-progressbar feature in Windows systems 12 | that basically means that you can see progress on the program's taskbar icon. 13 | A good example for this when you copy something using the file explorer:
14 | ![Taskbar progressbar in windows 7](images/areo-progressbar.jpg)
15 | This is very useful because you don't have to open the window to see the progress! 16 | The problem is that javaFX doesn't provide this functionality by default... however you 17 | can easily implement it with this library! 18 | 19 | ## Compatibility 20 | This library has support for java 8 and java 11 too.
21 | The 'v11.x' versions are for java11 users and the 'v8.x' versions are for java 8 users. 22 | 23 | ### Using with java 11 24 | If you use java 11 you have to pass this VM argument: `--add-exports javafx.graphics/com.sun.glass.ui=nativejavafx.taskbar`. 25 | Also, you have to mention the `nativejavafx.taskbar` module in your `module-info.java` file: 26 | ```java 27 | module YourModule { 28 | ... 29 | requires nativejavafx.taskbar; 30 | } 31 | ``` 32 | 33 | ## How to include it to your project 34 | 35 | ### Maven example: 36 | 37 | Add JitPack.io to your repositories : 38 | ```xml 39 | 40 | 41 | jitpack.io 42 | https://jitpack.io 43 | 44 | 45 | ``` 46 | Add the dependency: 47 | ```xml 48 | 49 | com.github.Dansoftowner 50 | FXTaskbarProgressBar 51 | v11.4 52 | 53 | ``` 54 | 55 | ### Gradle example 56 | 57 | Add the repository: 58 | ```groovy 59 | repositories { 60 | //... 61 | maven { url 'https://jitpack.io' } 62 | } 63 | ``` 64 | 65 | Add the dependency: 66 | ```groovy 67 | dependencies { 68 | //... 69 | implementation 'com.github.Dansoftowner:FXTaskbarProgressBar:v11.4' 70 | } 71 | ``` 72 | 73 | ## Projects using `FXTaskbarProgressBar` 74 | If this library is used by your project, let me know in the `Discussions` and I will mention that in this section. 75 | 76 | [Boomega](https://github.com/Dansoftowner/Boomega) - A modern book explorer & catalog application 77 | 78 | ## How to use it Tutorial 79 | 80 | ### 0. Types of progressbar 81 | Before we jump in, we have to know the 4 types of a taskbar-progressbar:
82 | * `NORMAL` - a progressbar with normal green color 83 | * `PAUSED` - a progressbar with a yellow color 84 | * `ERROR` - a progressbar with a red color 85 | * `INDETERMINATE` - a progressbar that doesn't show any fix progress 86 | * `NO_PROGRESS` - a progressbar that doesn't show anything 87 |

88 | All these types are represented by the enum called `com.nativejavafx.taskbar.TaskbarProgressbar.Type`. 89 | 90 | Now let's see how can we actually use this through code.
91 | There are multiple ways to create taskbar progressbars with this library: 92 | 93 | #### 1.Through static methods: 94 | Firstly you have to import the necessary class: 95 | ```java 96 | import com.nativejavafx.taskbar.TaskbarProgressbar; 97 | ``` 98 | ...and you have to show the javafx Stage before any operation: 99 | ``` 100 | primaryStage.show(); 101 | ``` 102 | Then call the static method: 103 | ```java 104 | TaskbarProgressbar.showCustomProgress(primaryStage, 0.5, TaskbarProgressbar.Type.NORMAL); 105 | ``` 106 | 107 | Well, the code above looks okay, but it's not safe. This functionality isn't supported by every OS. 108 | For example on a Linux system it will definitely throw an `UnsupportedSystemException` because it's only available on Windows 7+ 109 | systems.
110 | If you use static methods to create taskbar-progressbars you always have to check that the current OS 111 | supports this functionality! 112 | 113 | So let's correct the code: 114 | ```java 115 | if (TaskbarProgressbar.isSupported()) { 116 | TaskbarProgressbar.showCustomProgress(primaryStage, 0.5, TaskbarProgressbar.Type.NORMAL); 117 | } 118 | ``` 119 | ...now it is safe! 120 | 121 | Result:
122 | ![Normal Taskbar progressbar](images/normal-progress.jpg) 123 | 124 | You have to do a similar thing if you want to show an indeterminate progress: 125 | ```java 126 | if (TaskbarProgressbar.isSupported()) { 127 | TaskbarProgressbar.showIndeterminateProgress(primaryStage); 128 | } 129 | ``` 130 | Result:
131 | ![Indeterminate Taskbar progressbar](images/indeterminate.gif) 132 | 133 | To stop the progress: 134 | ```java 135 | TaskbarProgressbar.stopProgress(primaryStage); 136 | ``` 137 | #### 2. Through instantiation *(the recommended way)* 138 | Firstly (after you imported the necessary class) create a `TaskbarProgressbar` instance with the help of 139 | `TaskbarProgressbarFactory`: 140 | ```java 141 | TaskbarProgressbar progressbar = TaskbarProgressbarFactory.getTaskbarProgressbar(primaryStage); 142 | ``` 143 | Before any operation you have to show the Stage: 144 | ```java 145 | primaryStage.show(); 146 | ``` 147 | After that just use the created instance for the operations: 148 | ```java 149 | progressbar.showCustomProgress(0.5, TaskbarProgressbar.Type.NORMAL); 150 | ``` 151 | Note: in this case to check that the OS supports this functionality is unnecessary 152 | because the object checks it automatically! 153 | 154 | The result is the same:
155 | ![Normal Taskbar progressbar](images/normal-progress.jpg) 156 | 157 | If you want an indeterminate process: 158 | ```java 159 | progressbar.showIndeterminateProgress(); 160 | ``` 161 | To stop the progress: 162 | ```java 163 | progressbar.stopProgress(); 164 | ``` 165 | 166 | #### Bonus features 167 | 168 | A simple method for showing a fully loaded error progressbar 169 | ```java 170 | progressbar.showFullErrorProgress(); 171 | //equivalent to progressbar.showCustomProgress(100, 100, TaskbarProgressbar.Type.ERROR) 172 | ``` 173 | Result:
174 | ![Full errror taskbar progress](images/full-error-progress.jpg) 175 | 176 | Also: 177 | ```java 178 | progressbar.showFullNormalProgress(); 179 | ``` 180 | 181 | ```java 182 | progressbar.showFullPausedProgress(); 183 | ``` 184 | 185 | ## More screenshots 186 | Some more screenshots about what can you do with this library 187 | * A paused progress example:
188 | Code: `progressbar.showCustomProgress(0.7, TaskbarProgressbar.Type.PAUSED);`
189 | ![Paused progress](images/paused-progress.jpg) 190 | * An error progress example:
191 | Code: `progressbar.showCustomProgress(0.4, TaskbarProgressbar.Type.ERROR);`
192 | ![Paused progress](images/error-progress.jpg) 193 | 194 | ## Full demo 195 | A full demo-example class is available [here](src/test/java/Demo.java). 196 | 197 | ## Source code 198 | This project has two important branches: 199 | * "master" - for java 8 builds 200 | * "11" - for java 11 builds 201 | 202 | ## Used libraries 203 | * [bridj](https://github.com/nativelibs4java/BridJ) - blazing fast Java / C / C++ interop 204 | * [SLF4J](http://www.slf4j.org/) - Simple Logging Facade for Java 205 | * [Jetbrains Annotations](https://github.com/JetBrains/java-annotations) - Annotations for JVM-based languages 206 | 207 | ## Support 208 | If you like this library give it a star! 209 | -------------------------------------------------------------------------------- /src/main/java/com/nativejavafx/taskbar/TaskbarProgressbar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package com.nativejavafx.taskbar; 16 | 17 | import com.nativejavafx.taskbar.util.OS; 18 | import javafx.stage.Stage; 19 | import org.bridj.cpp.com.shell.ITaskbarList3; 20 | import org.jetbrains.annotations.NotNull; 21 | 22 | import java.util.Objects; 23 | 24 | /** 25 | * A TaskbarProgressbar object can add native (Windows 7+) taskbar 26 | * progressbar functionality to {@link Stage} objects. 27 | * 28 | *

29 | * Can be used by instantiation and by static methods as well. 30 | */ 31 | public abstract class TaskbarProgressbar { 32 | 33 | /** 34 | * Defines the types of the taskbar progressbars 35 | * that can be used on a Windows 7+ system. 36 | */ 37 | public enum Type { 38 | ERROR(ITaskbarList3.TbpFlag.TBPF_ERROR), 39 | INDETERMINATE(ITaskbarList3.TbpFlag.TBPF_INDETERMINATE), 40 | NO_PROGRESS(ITaskbarList3.TbpFlag.TBPF_NOPROGRESS), 41 | NORMAL(ITaskbarList3.TbpFlag.TBPF_NORMAL), 42 | PAUSED(ITaskbarList3.TbpFlag.TBPF_PAUSED); 43 | 44 | private final ITaskbarList3.TbpFlag bridjPair; 45 | 46 | Type(ITaskbarList3.TbpFlag bridjPair) { 47 | this.bridjPair = bridjPair; 48 | } 49 | 50 | public ITaskbarList3.TbpFlag getBridjPair() { 51 | return this.bridjPair; 52 | } 53 | } 54 | 55 | /** 56 | * A {@link TaskbarProgressbar} object-cache that used 57 | * for static operations. 58 | */ 59 | private static TaskbarProgressbar cache; 60 | 61 | 62 | protected TaskbarProgressbar() { 63 | } 64 | 65 | /** 66 | * Stops the progress on the taskbar 67 | */ 68 | public abstract void stopProgress(); 69 | 70 | /** 71 | * Shows an indeterminate progress on the taskbar 72 | */ 73 | public abstract void showIndeterminateProgress(); 74 | 75 | /** 76 | * Shows a custom progress on the taskbar 77 | * 78 | * @param done the done value of the max value 79 | * @param max the max "100%" value 80 | * @param type the type of the progress; mustn't be null 81 | * @throws NullPointerException if the type is null 82 | */ 83 | public abstract void showCustomProgress(long done, long max, @NotNull Type type); 84 | 85 | /** 86 | * Shows custom progress on the taskbar 87 | * 88 | * @param progress A positive value between 0 and 1 indicates the percentage of progress where 0 is 0% and 1 is 100%. 89 | * @param type the type of the progress; mustn't be null 90 | * @throws NullPointerException if type is null 91 | * @throws IllegalArgumentException if progress is less than 0 92 | */ 93 | public void showCustomProgress(double progress, @NotNull Type type) { 94 | if (progress < 0) throw new IllegalArgumentException("Progress can't be less than 0!"); 95 | showCustomProgress((long) Math.min(progress * 100, 100), 100, type); 96 | } 97 | 98 | /** 99 | * Sets the type of the progress 100 | * 101 | * @param type the type; mustn't be null 102 | * @throws NullPointerException if type is null 103 | */ 104 | public abstract void setProgressType(@NotNull Type type); 105 | 106 | /** 107 | * Shows a 100% error progress 108 | */ 109 | public void showFullErrorProgress() { 110 | this.showCustomProgress(100, 100, Type.ERROR); 111 | } 112 | 113 | /** 114 | * Shows a 100% paused progress 115 | */ 116 | public void showFullPausedProgress() { 117 | this.showCustomProgress(100, 100, Type.PAUSED); 118 | } 119 | 120 | /** 121 | * Shows a 100% normal progress 122 | */ 123 | public void showFullNormalProgress() { 124 | this.showCustomProgress(100, 100, Type.NORMAL); 125 | } 126 | 127 | /** 128 | * Closes all background-thread tasks 129 | */ 130 | public abstract void closeOperations(); 131 | 132 | private synchronized static void createCache() { 133 | if (cache == null) cache = TaskbarProgressbarFactory.getTaskbarProgressbarImpl(null); 134 | } 135 | 136 | private synchronized static TaskbarProgressbarImpl getTaskbarProgressbarImpl(@NotNull Stage stage) { 137 | Objects.requireNonNull(stage); 138 | createCache(); 139 | TaskbarProgressbarImpl impl = (TaskbarProgressbarImpl) cache; 140 | impl.setStage(stage); 141 | return impl; 142 | } 143 | 144 | /** 145 | * Stops the taskbar-progress on the given stage. 146 | * 147 | * @param stage the javaFX stage to stop the progress on; mustn't be null 148 | * @throws NullPointerException if the stage is null 149 | */ 150 | public static void stopProgress(@NotNull Stage stage) { 151 | getTaskbarProgressbarImpl(stage).stopProgress(); 152 | } 153 | 154 | /** 155 | * Shows an indeterminate taskbar-progress on the given stage. 156 | * 157 | * @param stage the javaFX stage to show the progress on; mustn't be null 158 | * @throws NullPointerException if the stage is null 159 | */ 160 | public static void showIndeterminateProgress(@NotNull Stage stage) { 161 | getTaskbarProgressbarImpl(stage).showIndeterminateProgress(); 162 | } 163 | 164 | /** 165 | * Shows a custom progress on the taskbar. 166 | * 167 | * @param stage the javaFX stage to show the progress on; mustn't be null 168 | * @param done specifies the actual "done" value of the max value 169 | * @param max specifies the max, 100% value of the loading 170 | * @param type the type of the progress; mustn't be null 171 | * @throws NullPointerException if the stage or the type is null 172 | */ 173 | public static void showCustomProgress(@NotNull Stage stage, long done, long max, @NotNull Type type) { 174 | getTaskbarProgressbarImpl(stage).showCustomProgress(done, max, type); 175 | } 176 | 177 | /** 178 | * Shows a custom progress on the taskbar. 179 | * 180 | * @param stage the javaFX stage to show the progress on; mustn't be null 181 | * @param progress A positive value between 0 and 1 indicates the percentage of progress where 0 is 0% and 1 is 100%. 182 | * @param type the type of the progress; mustn't be null 183 | * @throws NullPointerException if the stage or the type is null 184 | */ 185 | public static void showCustomProgress(@NotNull Stage stage, double progress, @NotNull Type type) { 186 | getTaskbarProgressbarImpl(stage).showCustomProgress(progress, type); 187 | } 188 | 189 | /** 190 | * Sets the type of the progress on the given stage. 191 | * 192 | * @param type the type; mustn't be null 193 | * @throws NullPointerException if type is null 194 | */ 195 | public static void setProgressType(@NotNull Stage stage, @NotNull Type type) { 196 | getTaskbarProgressbarImpl(stage).setProgressType(type); 197 | } 198 | 199 | /** 200 | * Shows a full error progress on the taskbar. 201 | * 202 | * @param stage the javaFX stage to show the progress on; mustn't be null 203 | */ 204 | public static void showFullErrorProgress(@NotNull Stage stage) { 205 | showCustomProgress(stage, 100, 100, Type.ERROR); 206 | } 207 | 208 | /** 209 | * Shows a full paused progress on the taskbar. 210 | * 211 | * @param stage the javaFX stage to show the progress on; mustn't be null 212 | */ 213 | public static void showFullPausedProgress(@NotNull Stage stage) { 214 | showCustomProgress(stage, 100, 100, Type.PAUSED); 215 | } 216 | 217 | /** 218 | * Shows a full normal progress on the taskbar. 219 | * 220 | * @param stage the javaFX stage to show the progress on; mustn't be null 221 | */ 222 | public static void showFullNormalProgress(@NotNull Stage stage) { 223 | showCustomProgress(stage, 100, 100, Type.NORMAL); 224 | } 225 | 226 | /** 227 | * Checks that the current system is supported or not. 228 | * 229 | *


230 | * Actually checks that the OS is Windows and the Windows version 231 | * is greater than Windows 7: 232 | * the taskbar progressbar functionality is working since Windows 7 233 | * 234 | * @return true if the OS is supported for taskbar progressbar functionality 235 | * false otherwise. 236 | */ 237 | public static boolean isSupported() { 238 | return OS.isWindows7OrLater(); 239 | } 240 | 241 | 242 | public static boolean isNotSupported() { 243 | return !isSupported(); 244 | } 245 | } 246 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Dansoftware 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------