├── settings.gradle ├── libs ├── cvescanner-21.0.25.jar └── discoclient-21.0.1.jar ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src └── main │ ├── resources │ └── eu │ │ └── hansolo │ │ └── fx │ │ └── jdkmon │ │ ├── duke.png │ │ ├── icon.icns │ │ ├── icon.ico │ │ ├── tck.png │ │ ├── aqavit.png │ │ ├── sdkman.png │ │ ├── duke_blk.png │ │ ├── duke_linux.png │ │ ├── icon16x16.png │ │ ├── icon32x32.png │ │ ├── icon48x48.png │ │ ├── icon128x128.png │ │ ├── icon256x256.png │ │ ├── tools │ │ ├── SF-Pro.ttf │ │ ├── segoeui.ttf │ │ ├── segoeuib.ttf │ │ ├── segoeuil.ttf │ │ ├── seguisb.ttf │ │ ├── SF-Pro-Text-Bold.otf │ │ ├── SF-Pro-Text-Light.otf │ │ ├── SF-Pro-Text-Medium.otf │ │ └── SF-Pro-Text-Regular.otf │ │ ├── duke_notification.png │ │ ├── notification │ │ ├── info.png │ │ ├── error.png │ │ ├── success.png │ │ ├── warning.png │ │ └── notification.css │ │ ├── controls │ │ ├── macos-checkmark-black.png │ │ ├── macos-checkmark-empty.png │ │ ├── macos-checkmark-white.png │ │ ├── mac-progress.css │ │ ├── win-progress.css │ │ ├── macos-window-button.css │ │ └── win-window-button.css │ │ ├── prepareJava.sh │ │ └── version.properties │ └── java │ ├── eu │ └── hansolo │ │ └── fx │ │ └── jdkmon │ │ ├── tools │ │ ├── UpdateType.java │ │ ├── Searchable.java │ │ ├── package-info.java │ │ ├── Project.java │ │ ├── JSR.java │ │ ├── FileEvent.java │ │ ├── JEP.java │ │ ├── ProcessInfo.java │ │ ├── LibCTypeCell.java │ │ ├── SearchableCell.java │ │ ├── ArchiveTypeCell.java │ │ ├── UpdateLevelCell.java │ │ ├── ArchitectureCell.java │ │ ├── DistributionCell.java │ │ ├── MajorVersionCell.java │ │ ├── Records.java │ │ ├── OperatingSystemCell.java │ │ ├── MacosLibCTypeCell.java │ │ ├── MacosSearchableCell.java │ │ ├── MacosArchiveTypeCell.java │ │ ├── MacosUpdateLevelCell.java │ │ ├── MacosArchitectureCell.java │ │ ├── MacosDistributionCell.java │ │ ├── MacosMajorVersionCell.java │ │ ├── MacosOperatingSystemCell.java │ │ ├── MajorVersion.java │ │ ├── FolderWatcher.java │ │ ├── ProcessMonitor.java │ │ ├── Fonts.java │ │ ├── ResizeHelper.java │ │ ├── Distro.java │ │ ├── MinimizedPkg.java │ │ └── PropertyManager.java │ │ ├── controls │ │ ├── WindowButtonType.java │ │ ├── package-info.java │ │ ├── WindowButtonSize.java │ │ ├── SearchTextField.java │ │ ├── WindowButton.java │ │ ├── SearchTextFieldSkin.java │ │ ├── MacosComboBoxCell.java │ │ ├── AttentionIndicator.java │ │ ├── MacosWindowButton.java │ │ └── WinWindowButton.java │ │ ├── Launcher.java │ │ └── notification │ │ ├── package-info.java │ │ ├── NotificationEvent.java │ │ ├── NotificationBuilder.java │ │ └── NotifierBuilder.java │ └── module-info.java ├── .vscode └── settings.json ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── .github └── workflows │ └── ci.yaml ├── gradlew ├── README.md └── LICENSE /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'JDKMon' 2 | -------------------------------------------------------------------------------- /libs/cvescanner-21.0.25.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/libs/cvescanner-21.0.25.jar -------------------------------------------------------------------------------- /libs/discoclient-21.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/libs/discoclient-21.0.1.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/duke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/duke.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/icon.icns -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/icon.ico -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/tck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/tck.png -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.compile.nullAnalysis.mode": "disabled", 3 | "java.configuration.updateBuildConfiguration": "automatic" 4 | } -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/aqavit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/aqavit.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/sdkman.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/sdkman.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/duke_blk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/duke_blk.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/duke_linux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/duke_linux.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/icon16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/icon16x16.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/icon32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/icon32x32.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/icon48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/icon48x48.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/icon128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/icon128x128.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/icon256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/icon256x256.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/tools/SF-Pro.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/tools/SF-Pro.ttf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/tools/segoeui.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/tools/segoeui.ttf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/tools/segoeuib.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/tools/segoeuib.ttf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/tools/segoeuil.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/tools/segoeuil.ttf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/tools/seguisb.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/tools/seguisb.ttf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/duke_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/duke_notification.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/notification/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/notification/info.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/notification/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/notification/error.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/notification/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/notification/success.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/notification/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/notification/warning.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/tools/SF-Pro-Text-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/tools/SF-Pro-Text-Bold.otf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/tools/SF-Pro-Text-Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/tools/SF-Pro-Text-Light.otf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/tools/SF-Pro-Text-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/tools/SF-Pro-Text-Medium.otf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/tools/SF-Pro-Text-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/tools/SF-Pro-Text-Regular.otf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/controls/macos-checkmark-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/controls/macos-checkmark-black.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/controls/macos-checkmark-empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/controls/macos-checkmark-empty.png -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/controls/macos-checkmark-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/JDKMon/HEAD/src/main/resources/eu/hansolo/fx/jdkmon/controls/macos-checkmark-white.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /.gradle 3 | .DS_Store 4 | /build 5 | /out 6 | /classes 7 | /JDKMon.iml 8 | /entitlement.plist 9 | /sign.sh 10 | /notarize.sh 11 | /jdkmon.properties 12 | /discoclient.properties 13 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/prepareJava.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # execute only if 1. parameter exists 4 | if [ "$1" ]; then 5 | # remove $JAVA_HOME from $PATH 6 | export PATH=$(echo $PATH | sed -E -e "s;:$JAVA_HOME;;" -e "s;$JAVA_HOME:?;;") 7 | 8 | # set $JAVA_HOME to 1. parameter 9 | export JAVA_HOME=$1 10 | 11 | # set $JDK_HOME to $JAVA_HOME 12 | export JDK_HOME=$JAVA_HOME 13 | fi 14 | 15 | # execute only if 2. parameter exists 16 | if [ "$2" ]; then 17 | # set $PATH_TO_FX to 2. parameter 18 | export PATH_TO_FX=$2 19 | fi 20 | 21 | if [ "$1" ]; then 22 | # export new $PATH 23 | export PATH=$JAVA_HOME/bin:$PATH 24 | fi -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/version.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2021 by Gerrit Grunwald 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | version=0 -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2021 by Gerrit Grunwald 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | sourceCompatibility = 25 18 | targetCompatibility = 25 19 | 20 | group = eu.hansolo 21 | version = 25.0.0 22 | javafxVersion = 25 -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/UpdateType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | public enum UpdateType { 20 | UPDATE, RELEASE 21 | } 22 | -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/controls/mac-progress.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .progress { 18 | -progress-fill : rgb(119, 119, 119); 19 | -progress-stroke: rgb(119, 119, 119); 20 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/controls/WindowButtonType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.controls; 18 | 19 | public enum WindowButtonType { 20 | CLOSE, MINIMIZE, ZOOM 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/Launcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon; 18 | 19 | 20 | public class Launcher { 21 | public static void main(String[] args) { Main.main(args); } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/Searchable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | public interface Searchable { 20 | String url(); 21 | 22 | String dscr(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/notification/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * All classes that are used to create the notification popups 19 | * @author hansolo 20 | */ 21 | package eu.hansolo.fx.jdkmon.notification; -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/controls/win-progress.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .progress { 18 | -progress-fill : black; 19 | -progress-stroke: black; 20 | } 21 | 22 | .progress:dark { 23 | -progress-fill : white; 24 | -progress-stroke: white; 25 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/controls/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Custom control classes like operating system specific buttons for close windows, 19 | * progress bars and others 20 | * @author hansolo 21 | */ 22 | package eu.hansolo.fx.jdkmon.controls; -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * All kinds of helper classes like different operating system related 19 | * list cells, classes for detecting the operating system and for finding 20 | * installed JDK distributions etc. 21 | * @author hansolo 22 | */ 23 | package eu.hansolo.fx.jdkmon.tools; -------------------------------------------------------------------------------- /src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module eu.hansolo.fx.jdkmon { 2 | // 3 | // Java 4 | requires java.net.http; 5 | requires java.desktop; 6 | 7 | // Java-FX 8 | requires javafx.base; 9 | requires javafx.graphics; 10 | requires javafx.controls; 11 | 12 | // 3rd Party 13 | requires transitive com.google.gson; 14 | requires transitive eu.hansolo.jdktools; 15 | requires transitive ch.qos.logback.classic; 16 | requires transitive ch.qos.logback.core; 17 | requires transitive org.slf4j; 18 | requires io.foojay.api.discoclient; 19 | requires eu.hansolo.cvescanner; 20 | requires com.dustinredmond.fxtrayicon; 21 | //requires FXTrayIcon; 22 | requires org.apache.commons.compress; 23 | requires org.tukaani.xz; 24 | requires eu.hansolo.toolbox; 25 | 26 | exports eu.hansolo.fx.jdkmon; 27 | exports eu.hansolo.fx.jdkmon.tools; 28 | exports eu.hansolo.fx.jdkmon.controls; 29 | exports eu.hansolo.fx.jdkmon.notification; 30 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/controls/WindowButtonSize.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.controls; 18 | 19 | public enum WindowButtonSize { 20 | LARGE(16), 21 | NORMAL(12), 22 | SMALL(9); 23 | 24 | public final double px; 25 | 26 | WindowButtonSize(final double px) { 27 | this.px = px; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/Project.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | public record Project(String description, String url) implements Searchable { 20 | public String dscr() { 21 | return description; 22 | } 23 | 24 | @Override public String toString() { return String.join(" ", "Project", description); } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/JSR.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | public record JSR(int id, String description, String url) implements Searchable { 20 | public String dscr() { 21 | return description; 22 | } 23 | 24 | @Override public String toString() { return String.join(" ", "JSR", Integer.toString(id), description); } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/FileEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import java.io.File; 20 | import java.util.EventObject; 21 | 22 | 23 | public class FileEvent extends EventObject { 24 | 25 | public FileEvent(File file) { 26 | super(file); 27 | } 28 | 29 | public File getFile() { 30 | return (File) getSource(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/JEP.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | public record JEP(int id, String description, String url, boolean draft) implements Searchable { 20 | public String dscr() { 21 | return description; 22 | } 23 | 24 | @Override public String toString() { return String.join(" ", "JEP", Integer.toString(id), description); } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/ProcessInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import java.util.Objects; 20 | 21 | 22 | public record ProcessInfo(long pid, String cmd, String cmdLine) { 23 | @Override public boolean equals(final Object o) { 24 | if (this == o) { return true; } 25 | if (o == null || getClass() != o.getClass()) { return false; } 26 | ProcessInfo that = (ProcessInfo) o; 27 | return Objects.equals(cmd, that.cmd); 28 | } 29 | @Override public int hashCode() { 30 | return Objects.hash(cmd); 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/controls/SearchTextField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.controls; 18 | 19 | import javafx.application.Platform; 20 | import javafx.scene.control.TextField; 21 | 22 | 23 | public class SearchTextField extends TextField { 24 | 25 | public SearchTextField() { 26 | super(); 27 | if (Platform.isFxApplicationThread()) { 28 | setSkin(new SearchTextFieldSkin(this)); 29 | } else { 30 | Platform.runLater(() -> setSkin(new SearchTextFieldSkin(this))); 31 | } 32 | } 33 | public SearchTextField(final String text) { 34 | this(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/LibCTypeCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.jdktools.LibCType; 20 | import javafx.scene.control.ListCell; 21 | 22 | 23 | public class LibCTypeCell extends ListCell { 24 | 25 | @Override protected void updateItem(final LibCType libCType, final boolean empty) { 26 | super.updateItem(libCType, empty); 27 | 28 | if (empty || null == libCType) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(libCType.getUiString()); 33 | } 34 | } 35 | 36 | @Override public String toString() { 37 | return getItem().getUiString(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/SearchableCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import javafx.scene.control.Hyperlink; 20 | import javafx.scene.control.ListCell; 21 | 22 | 23 | public class SearchableCell extends ListCell { 24 | 25 | @Override protected void updateItem(final Searchable searchable, final boolean empty) { 26 | super.updateItem(searchable, empty); 27 | 28 | if (empty || null == searchable) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(searchable.toString()); 33 | } 34 | } 35 | 36 | @Override public String toString() { 37 | return getItem().toString(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/ArchiveTypeCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.jdktools.ArchiveType; 20 | import javafx.scene.control.ListCell; 21 | 22 | 23 | public class ArchiveTypeCell extends ListCell { 24 | 25 | @Override protected void updateItem(final ArchiveType archiveType, final boolean empty) { 26 | super.updateItem(archiveType, empty); 27 | 28 | if (empty || null == archiveType) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(archiveType.getUiString()); 33 | } 34 | } 35 | 36 | @Override public String toString() { 37 | return getItem().getUiString(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/UpdateLevelCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.jdktools.versioning.Semver; 20 | import javafx.scene.control.ListCell; 21 | 22 | 23 | public class UpdateLevelCell extends ListCell { 24 | 25 | @Override protected void updateItem(final Semver updateLevel, final boolean empty) { 26 | super.updateItem(updateLevel, empty); 27 | 28 | if (empty || null == updateLevel) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(updateLevel.toString(true)); 33 | } 34 | } 35 | 36 | @Override public String toString() { 37 | return getItem().toString(true); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/ArchitectureCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.jdktools.Architecture; 20 | import javafx.scene.control.ListCell; 21 | 22 | 23 | public class ArchitectureCell extends ListCell { 24 | 25 | @Override protected void updateItem(final Architecture architecture, final boolean empty) { 26 | super.updateItem(architecture, empty); 27 | 28 | if (empty || null == architecture) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(architecture.getUiString()); 33 | } 34 | } 35 | 36 | @Override public String toString() { 37 | return getItem().getUiString(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/DistributionCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import io.foojay.api.discoclient.pkg.Distribution; 20 | import javafx.scene.control.ListCell; 21 | 22 | 23 | public class DistributionCell extends ListCell { 24 | 25 | @Override protected void updateItem(final Distribution distribution, final boolean empty) { 26 | super.updateItem(distribution, empty); 27 | 28 | if (empty || null == distribution) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(distribution.getUiString()); 33 | } 34 | } 35 | 36 | @Override public String toString() { 37 | return getItem().getUiString(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/MajorVersionCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import io.foojay.api.discoclient.pkg.MajorVersion; 20 | import javafx.scene.control.ListCell; 21 | 22 | 23 | public class MajorVersionCell extends ListCell { 24 | 25 | @Override protected void updateItem(final MajorVersion majorVersion, final boolean empty) { 26 | super.updateItem(majorVersion, empty); 27 | setGraphic(null); 28 | if (empty || null == majorVersion) { 29 | setText(null); 30 | } else { 31 | setText(majorVersion.toString()); 32 | } 33 | } 34 | 35 | @Override public String toString() { 36 | return Integer.toString(getItem().getAsInt()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/Records.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.jdktools.Architecture; 20 | import eu.hansolo.jdktools.OperatingMode; 21 | import eu.hansolo.jdktools.OperatingSystem; 22 | import eu.hansolo.jdktools.versioning.VersionNumber; 23 | 24 | import java.time.LocalDate; 25 | 26 | 27 | public class Records { 28 | 29 | public record SysInfo(OperatingSystem operatingSystem, Architecture architecture, OperatingMode operatingMode) {} 30 | 31 | public record JdkInfo(String createdBy, String buildJdk) {} 32 | 33 | public record JDKUpdate(LocalDate date, long remainingDays, UpdateType type) {} 34 | 35 | public record JDKMonUpdate(VersionNumber latestVersion, boolean isUpdateAvailable) {} 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/OperatingSystemCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.jdktools.OperatingSystem; 20 | import javafx.scene.control.ListCell; 21 | 22 | 23 | public class OperatingSystemCell extends ListCell { 24 | 25 | @Override protected void updateItem(final OperatingSystem operatingSystem, final boolean empty) { 26 | super.updateItem(operatingSystem, empty); 27 | 28 | if (empty || null == operatingSystem) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(operatingSystem.getUiString()); 33 | } 34 | } 35 | 36 | @Override public String toString() { 37 | return getItem().getUiString(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/MacosLibCTypeCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.fx.jdkmon.controls.MacosComboBoxCell; 20 | import eu.hansolo.jdktools.LibCType; 21 | 22 | 23 | public class MacosLibCTypeCell extends MacosComboBoxCell { 24 | 25 | @Override protected void updateItem(final LibCType libCType, final boolean empty) { 26 | super.updateItem(libCType, empty); 27 | 28 | if (empty || null == libCType) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(libCType.getUiString()); 33 | setGraphic(isSelected() ? (isDark() ? WHITE_CHECK_MARK : BLACK_CHECK_MARK) : EMPTY_CHECK_MARK); 34 | } 35 | } 36 | 37 | @Override public String toString() { 38 | return getItem().getUiString(); 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/MacosSearchableCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.fx.jdkmon.controls.MacosComboBoxCell; 20 | import javafx.scene.control.Hyperlink; 21 | 22 | 23 | public class MacosSearchableCell extends MacosComboBoxCell { 24 | 25 | @Override protected void updateItem(final Searchable searchable, final boolean empty) { 26 | super.updateItem(searchable, empty); 27 | 28 | if (empty || null == searchable) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(searchable.toString()); 33 | setGraphic(isSelected() ? (isDark() ? WHITE_CHECK_MARK : BLACK_CHECK_MARK) : EMPTY_CHECK_MARK); 34 | } 35 | } 36 | 37 | @Override public String toString() { 38 | return getItem().toString(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/MacosArchiveTypeCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.fx.jdkmon.controls.MacosComboBoxCell; 20 | import eu.hansolo.jdktools.ArchiveType; 21 | 22 | 23 | public class MacosArchiveTypeCell extends MacosComboBoxCell { 24 | 25 | @Override protected void updateItem(final ArchiveType archiveType, final boolean empty) { 26 | super.updateItem(archiveType, empty); 27 | 28 | if (empty || null == archiveType) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(archiveType.getUiString()); 33 | setGraphic(isSelected() ? (isDark() ? WHITE_CHECK_MARK : BLACK_CHECK_MARK) : EMPTY_CHECK_MARK); 34 | } 35 | } 36 | 37 | @Override public String toString() { 38 | return getItem().getUiString(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/MacosUpdateLevelCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.fx.jdkmon.controls.MacosComboBoxCell; 20 | import eu.hansolo.jdktools.versioning.Semver; 21 | 22 | 23 | public class MacosUpdateLevelCell extends MacosComboBoxCell { 24 | 25 | @Override protected void updateItem(final Semver updateLevel, final boolean empty) { 26 | super.updateItem(updateLevel, empty); 27 | 28 | if (empty || null == updateLevel) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(updateLevel.toString(true)); 33 | setGraphic(isSelected() ? (isDark() ? WHITE_CHECK_MARK : BLACK_CHECK_MARK) : EMPTY_CHECK_MARK); 34 | } 35 | } 36 | 37 | @Override public String toString() { 38 | return getItem().toString(true); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/MacosArchitectureCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.fx.jdkmon.controls.MacosComboBoxCell; 20 | import eu.hansolo.jdktools.Architecture; 21 | 22 | 23 | public class MacosArchitectureCell extends MacosComboBoxCell { 24 | 25 | @Override protected void updateItem(final Architecture architecture, final boolean empty) { 26 | super.updateItem(architecture, empty); 27 | 28 | if (empty || null == architecture) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(architecture.getUiString()); 33 | setGraphic(isSelected() ? (isDark() ? WHITE_CHECK_MARK : BLACK_CHECK_MARK) : EMPTY_CHECK_MARK); 34 | } 35 | } 36 | 37 | @Override public String toString() { 38 | return getItem().getUiString(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/controls/WindowButton.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.controls; 18 | 19 | import javafx.beans.property.BooleanProperty; 20 | import javafx.beans.property.ObjectProperty; 21 | import javafx.scene.input.MouseEvent; 22 | 23 | import java.util.function.Consumer; 24 | 25 | 26 | public interface WindowButton { 27 | WindowButtonType getType(); 28 | void setType(final WindowButtonType type); 29 | ObjectProperty typeProperty(); 30 | 31 | boolean isDarkMode(); 32 | void setDarkMode(final boolean darkMode); 33 | BooleanProperty darkModeProperty(); 34 | 35 | boolean isHovered(); 36 | void setHovered(final boolean hovered); 37 | BooleanProperty hoveredProperty(); 38 | 39 | void setOnMousePressed(final Consumer mousePressedConsumer); 40 | void setOnMouseReleased(final Consumer mouseReleasedConsumer); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/MacosDistributionCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.fx.jdkmon.controls.MacosComboBoxCell; 20 | import io.foojay.api.discoclient.pkg.Distribution; 21 | 22 | 23 | public class MacosDistributionCell extends MacosComboBoxCell { 24 | 25 | @Override protected void updateItem(final Distribution distribution, final boolean empty) { 26 | super.updateItem(distribution, empty); 27 | 28 | if (empty || null == distribution) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(distribution.getUiString()); 33 | setGraphic(isSelected() ? (isDark() ? WHITE_CHECK_MARK : BLACK_CHECK_MARK) : EMPTY_CHECK_MARK); 34 | } 35 | } 36 | 37 | @Override public String toString() { 38 | return getItem().getUiString(); 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/MacosMajorVersionCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.fx.jdkmon.controls.MacosComboBoxCell; 20 | import io.foojay.api.discoclient.pkg.MajorVersion; 21 | 22 | 23 | public class MacosMajorVersionCell extends MacosComboBoxCell { 24 | 25 | @Override protected void updateItem(final MajorVersion majorVersion, final boolean empty) { 26 | super.updateItem(majorVersion, empty); 27 | 28 | if (empty || null == majorVersion) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(majorVersion.toString()); 33 | setGraphic(isSelected() ? (isDark() ? WHITE_CHECK_MARK : BLACK_CHECK_MARK) : EMPTY_CHECK_MARK); 34 | } 35 | } 36 | 37 | @Override public String toString() { 38 | return Integer.toString(getItem().getAsInt()); 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/MacosOperatingSystemCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.fx.jdkmon.controls.MacosComboBoxCell; 20 | import eu.hansolo.jdktools.OperatingSystem; 21 | 22 | 23 | public class MacosOperatingSystemCell extends MacosComboBoxCell { 24 | 25 | @Override protected void updateItem(final OperatingSystem operatingSystem, final boolean empty) { 26 | super.updateItem(operatingSystem, empty); 27 | 28 | if (empty || null == operatingSystem) { 29 | setText(null); 30 | setGraphic(null); 31 | } else { 32 | setText(operatingSystem.getUiString()); 33 | setGraphic(isSelected() ? (isDark() ? WHITE_CHECK_MARK : BLACK_CHECK_MARK) : EMPTY_CHECK_MARK); 34 | } 35 | } 36 | 37 | @Override public String toString() { 38 | return getItem().getUiString(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/notification/NotificationEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.notification; 18 | 19 | import javafx.event.Event; 20 | import javafx.event.EventTarget; 21 | import javafx.event.EventType; 22 | 23 | 24 | public class NotificationEvent extends Event { 25 | public static final EventType NOTIFICATION_PRESSED = new EventType(ANY, "NOTIFICATION_PRESSED"); 26 | public static final EventType SHOW_NOTIFICATION = new EventType(ANY, "SHOW_NOTIFICATION"); 27 | public static final EventType HIDE_NOTIFICATION = new EventType(ANY, "HIDE_NOTIFICATION"); 28 | 29 | public final Notification notification; 30 | 31 | 32 | // ******************** Constructors ************************************** 33 | public NotificationEvent(final Notification notification, final Object source, final EventTarget target, EventType type) { 34 | super(source, target, type); 35 | this.notification = notification; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/MajorVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | 20 | import eu.hansolo.jdktools.TermOfSupport; 21 | import eu.hansolo.jdktools.versioning.VersionNumber; 22 | 23 | import java.util.Comparator; 24 | import java.util.Objects; 25 | 26 | 27 | public class MajorVersion implements Comparable { 28 | public static final String FIELD_MAJOR_VERSION = "major_version"; 29 | public static final String FIELD_TERM_OF_SUPPORT = "term_of_support"; 30 | public static final String FIELD_MAINTAINED = "maintained"; 31 | public static final String FIELD_VERSIONS = "versions"; 32 | private final int majorVersion; 33 | private final TermOfSupport termOfSupport; 34 | private final boolean maintained; 35 | 36 | 37 | public MajorVersion(final int majorVersion) { 38 | this(majorVersion, Helper.getTermOfSupport(majorVersion)); 39 | } 40 | public MajorVersion(final int majorVersion, final TermOfSupport termOfSupport) { 41 | if (majorVersion <= 0) { throw new IllegalArgumentException("Major version cannot be <= 0"); } 42 | this.majorVersion = majorVersion; 43 | this.termOfSupport = termOfSupport; 44 | this.maintained = false; 45 | } 46 | 47 | 48 | public int getAsInt() { return majorVersion; } 49 | 50 | public TermOfSupport getTermOfSupport() { return termOfSupport; } 51 | 52 | // VersionNumber 53 | public VersionNumber getVersionNumber() { return new VersionNumber(majorVersion); } 54 | 55 | // Maintained 56 | public Boolean isMaintained() { return maintained; } 57 | 58 | @Override public int compareTo(final MajorVersion majorVersion) { 59 | return Integer.compare(majorVersion.getAsInt(), getAsInt()); 60 | } 61 | 62 | @Override public boolean equals(final Object obj) { 63 | if (this == obj) { return true; } 64 | if (obj == null || getClass() != obj.getClass()) { return false; } 65 | MajorVersion other = (MajorVersion) obj; 66 | return majorVersion == other.majorVersion && maintained == other.maintained; 67 | } 68 | 69 | @Override public int hashCode() { 70 | return Objects.hash(majorVersion, maintained); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/FolderWatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.toolbox.properties.BooleanProperty; 20 | import eu.hansolo.toolbox.properties.ReadOnlyBooleanProperty; 21 | 22 | import java.io.File; 23 | import java.nio.file.FileSystem; 24 | import java.nio.file.FileSystems; 25 | import java.nio.file.Path; 26 | import java.nio.file.Paths; 27 | import java.nio.file.WatchKey; 28 | import java.nio.file.WatchService; 29 | import java.util.concurrent.atomic.AtomicBoolean; 30 | 31 | import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; 32 | import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; 33 | import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; 34 | 35 | 36 | public class FolderWatcher { 37 | private FileSystem fileSystem; 38 | private WatchService watchService; 39 | private Path pathToWatch; 40 | private AtomicBoolean running = new AtomicBoolean(false); 41 | private BooleanProperty changeDetected = new BooleanProperty(false); 42 | private boolean valid = true; 43 | 44 | 45 | public FolderWatcher(final String folderName) { 46 | try { 47 | final File file = new File(folderName); 48 | this.valid = file.exists() && file.isDirectory(); 49 | if (valid) { 50 | fileSystem = FileSystems.getDefault(); 51 | watchService = fileSystem.newWatchService(); 52 | pathToWatch = Paths.get(folderName); 53 | pathToWatch.register(watchService, ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE); 54 | } 55 | } catch (final Exception e) { 56 | throw new RuntimeException("Error initializing FolderWatcher", e); 57 | } 58 | } 59 | 60 | public void startWatching() throws Exception { 61 | if (running.get() || !valid) { return; } 62 | this.running.set(true); 63 | while (this.running.get()) { 64 | final WatchKey key = watchService.take(); 65 | key.pollEvents().forEach(evt -> { 66 | //Object context = evt.context(); 67 | //System.out.printf("%s %d %s\n", evt.kind(), evt.count(), context); 68 | this.changeDetected.set(!this.changeDetected.get()); 69 | }); 70 | key.reset(); 71 | } 72 | } 73 | 74 | public void stopWatching() { 75 | this.running.set(false); 76 | } 77 | 78 | public ReadOnlyBooleanProperty changeDetectedProperty() { return this.changeDetected; } 79 | 80 | public boolean isWatching() { return this.running.get(); } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/notification/NotificationBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.notification; 18 | 19 | import javafx.beans.property.*; 20 | import javafx.scene.image.Image; 21 | 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | import java.util.concurrent.ConcurrentHashMap; 25 | 26 | 27 | public class NotificationBuilder> { 28 | private Map properties = new ConcurrentHashMap<>(); 29 | 30 | 31 | // ******************** Constructors ************************************** 32 | protected NotificationBuilder() { 33 | } 34 | 35 | 36 | // ******************** Methods ******************************************* 37 | public final static NotificationBuilder create() { 38 | return new NotificationBuilder(); 39 | } 40 | 41 | public final B title(final String title) { 42 | properties.put("title", new SimpleStringProperty(title)); 43 | return (B) this; 44 | } 45 | 46 | public final B message(final String message) { 47 | properties.put("message", new SimpleStringProperty(message)); 48 | return (B) this; 49 | } 50 | 51 | public final B image(final Image image) { 52 | properties.put("image", new SimpleObjectProperty<>(image)); 53 | return (B) this; 54 | } 55 | 56 | public final Notification build() { 57 | final Notification notification; 58 | if (properties.keySet().contains("title") && properties.keySet().contains("message") && properties.keySet().contains("image")) { 59 | notification = new Notification(((StringProperty) properties.get("title")).get(), 60 | ((StringProperty) properties.get("message")).get(), 61 | ((ObjectProperty) properties.get("image")).get()); 62 | } else if (properties.keySet().contains("title") && properties.keySet().contains("message")) { 63 | notification = new Notification(((StringProperty) properties.get("title")).get(), 64 | ((StringProperty) properties.get("message")).get()); 65 | } else if (properties.keySet().contains("message") && properties.keySet().contains("image")) { 66 | notification = new Notification(((StringProperty) properties.get("message")).get(), 67 | ((ObjectProperty) properties.get("image")).get()); 68 | } else { 69 | throw new IllegalArgumentException("Wrong or missing parameters."); 70 | } 71 | return notification; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /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 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build-windows: 7 | runs-on: [ windows-latest ] 8 | steps: 9 | - uses: actions/checkout@v4 10 | - name: Set up JDK 25 11 | uses: actions/setup-java@v4 12 | with: 13 | java-version: 25 14 | distribution: 'zulu' 15 | gpg-private-key: ${{ secrets.GPG_KEY }} 16 | gpg-passphrase: PASSPHRASE 17 | - name: Build with Gradle 18 | run: ./gradlew.bat build 19 | env: 20 | PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 21 | - name: Create Distribution 22 | run: .\build_app_windows.bat 23 | - uses: actions/upload-artifact@v4 24 | with: 25 | name: JDKMon-windows-x64 26 | path: | 27 | build/installer 28 | build/libs 29 | 30 | 31 | build-mac: 32 | runs-on: [ macos-13 ] 33 | steps: 34 | - uses: actions/checkout@v4 35 | - name: Set up JDK 25 36 | uses: actions/setup-java@v4 37 | with: 38 | java-version: 25 39 | distribution: 'zulu' 40 | gpg-private-key: ${{ secrets.GPG_KEY }} 41 | gpg-passphrase: PASSPHRASE 42 | - name: Build with Gradle 43 | run: ./gradlew build 44 | env: 45 | PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 46 | - name: Grant execute permission for build_app_macos.sh 47 | run: chmod +x ./build_app_macos.sh 48 | - name: Create Distribution 49 | run: ./build_app_macos.sh 50 | - uses: actions/upload-artifact@v4 51 | with: 52 | name: JDKMon-macos-x64 53 | path: | 54 | build/installer 55 | build/libs 56 | 57 | build-mac-aarch64: 58 | runs-on: [ macos-latest ] 59 | steps: 60 | - uses: actions/checkout@v4 61 | - name: Set up JDK 25 62 | uses: actions/setup-java@v4 63 | with: 64 | java-version: 25 65 | distribution: 'zulu' 66 | gpg-private-key: ${{ secrets.GPG_KEY }} 67 | gpg-passphrase: PASSPHRASE 68 | - name: Build with Gradle 69 | run: ./gradlew build 70 | env: 71 | PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 72 | - name: Grant execute permission for build_app_macos.sh 73 | run: chmod +x ./build_app_macos.sh 74 | - name: Create Distribution 75 | run: ./build_app_macos.sh 76 | - uses: actions/upload-artifact@v4 77 | with: 78 | name: JDKMon-macos-aarch64 79 | path: | 80 | build/installer 81 | build/libs 82 | 83 | build-linux: 84 | runs-on: [ ubuntu-latest ] 85 | steps: 86 | - uses: actions/checkout@v4 87 | - name: Set up JDK 25 88 | uses: actions/setup-java@v4 89 | with: 90 | java-version: 25 91 | distribution: 'zulu' 92 | gpg-private-key: ${{ secrets.GPG_KEY }} 93 | gpg-passphrase: PASSPHRASE 94 | - name: Build with Gradle 95 | run: ./gradlew build 96 | env: 97 | PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 98 | - name: Grant execute permission for build_app_linux.sh 99 | run: chmod +x ./build_app_linux.sh 100 | - name: Create Distribution 101 | run: ./build_app_linux.sh 102 | - uses: actions/upload-artifact@v4 103 | with: 104 | name: JDKMon-linux-x64 105 | path: | 106 | build/installer 107 | build/libs -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/controls/SearchTextFieldSkin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.controls; 18 | 19 | import javafx.scene.control.skin.TextFieldSkin; 20 | import javafx.scene.layout.Region; 21 | import javafx.scene.text.Text; 22 | 23 | 24 | public class SearchTextFieldSkin extends TextFieldSkin { 25 | private Region searchIcon; 26 | private Text searchText; 27 | private Region closeIcon; 28 | 29 | 30 | public SearchTextFieldSkin(final SearchTextField control){ 31 | super(control); 32 | 33 | initGraphics(); 34 | registerListeners(); 35 | } 36 | 37 | 38 | private void initGraphics() { 39 | searchIcon = new Region(); 40 | searchIcon.getStyleClass().addAll("search-icon"); 41 | searchIcon.setFocusTraversable(false); 42 | 43 | searchText = new Text("Search"); 44 | searchText.getStyleClass().addAll("search-text"); 45 | searchText.setFocusTraversable(false); 46 | 47 | closeIcon = new Region(); 48 | closeIcon.getStyleClass().addAll("close-icon"); 49 | closeIcon.setFocusTraversable(false); 50 | closeIcon.setVisible(false); 51 | 52 | getChildren().addAll(searchIcon, searchText, closeIcon); 53 | } 54 | 55 | private void registerListeners() { 56 | closeIcon.setOnMouseClicked(event -> getSkinnable().setText("")); 57 | getSkinnable().textProperty().addListener(o -> { 58 | closeIcon.setVisible(getSkinnable().getText().isEmpty() ? false : true); 59 | }); 60 | 61 | getSkinnable().focusedProperty().addListener(o -> { 62 | searchIcon.setVisible(!getSkinnable().isFocused() && getSkinnable().getText().isEmpty()); 63 | searchText.setVisible(!getSkinnable().isFocused() && getSkinnable().getText().isEmpty()); 64 | closeIcon.setVisible(getSkinnable().isFocused() && !getSkinnable().getText().isEmpty() ? true : false); 65 | }); 66 | 67 | getSkinnable().widthProperty().addListener(o -> { 68 | final double size = searchIcon.getMaxWidth() < 0 ? 20.8 : searchIcon.getWidth(); 69 | searchIcon.setTranslateX(-getSkinnable().getWidth() * 0.5 + size * 0.7); 70 | searchText.setTranslateX(-getSkinnable().getWidth() * 0.5 + size * 2.25); 71 | closeIcon.setTranslateX(getSkinnable().getWidth() * 0.5 - size * 0.7); 72 | }); 73 | 74 | getSkinnable().heightProperty().addListener(observable -> { 75 | closeIcon.setMaxSize(getSkinnable().getHeight() * 0.8, getSkinnable().getHeight() * 0.8); 76 | searchIcon.setMaxSize(getSkinnable().getHeight() * 0.8, getSkinnable().getHeight() * 0.8); 77 | }); 78 | 79 | getSkinnable().sceneProperty().addListener(observable -> { 80 | searchIcon.setTranslateX(-getSkinnable().getWidth() * 0.5 + closeIcon.getWidth() * 0.7); 81 | searchText.setTranslateX(-getSkinnable().getWidth() * 0.5 + closeIcon.getWidth() * 2.25); 82 | closeIcon.setTranslateX(getSkinnable().getWidth() * 0.5 - searchIcon.getWidth() * 0.7); 83 | }); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/controls/macos-window-button.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .macos-window-button { 18 | -RED : #ff6058; 19 | -YELLOW : #ffbc35; 20 | -GREEN : #00c844; 21 | -GRAY : #535353; 22 | -DARK_GRAY : #343535; 23 | -LIGHT_GRAY: #cecbca; 24 | } 25 | 26 | .macos-window-button .circle { 27 | -fx-stroke-width: 0.5px; 28 | } 29 | 30 | .macos-window-button:close .circle, 31 | .macos-window-button:close:hovered .circle { 32 | -fx-fill : -RED; 33 | -fx-stroke: derive(-RED, -10%); 34 | } 35 | .macos-window-button:close:pressed .circle { 36 | -fx-fill : derive(-RED, -20%); 37 | -fx-stroke: derive(-RED, -30%); 38 | } 39 | 40 | .macos-window-button:minimize .circle, 41 | .macos-window-button:minimize:hovered .circle { 42 | -fx-fill : -YELLOW; 43 | -fx-stroke: derive(-YELLOW, -10%); 44 | } 45 | .macos-window-button:minimize:pressed .circle { 46 | -fx-fill : derive(-YELLOW, -20%); 47 | -fx-stroke: derive(-YELLOW, -30%); 48 | } 49 | 50 | .macos-window-button:zoom .circle, 51 | .macos-window-button:zoom:hovered .circle { 52 | -fx-fill : -GREEN; 53 | -fx-stroke: derive(-GREEN, -10%); 54 | } 55 | .macos-window-button:zoom:pressed .circle { 56 | -fx-fill : derive(-GREEN, -20%); 57 | -fx-stroke: derive(-GREEN, -30%); 58 | } 59 | 60 | .macos-window-button:disabled:close .circle, 61 | .macos-window-button:disabled:minimize .circle, 62 | .macos-window-button:disabled:zoom .circle { 63 | -fx-fill : -GRAY; 64 | -fx-stroke: rgb(167, 165, 165); 65 | } 66 | 67 | .macos-window-button:close .symbol, 68 | .macos-window-button:minimize .symbol, 69 | .macos-window-button:zoom .symbol { 70 | -fx-background-color: transparent; 71 | } 72 | 73 | .macos-window-button:hovered:close .symbol { 74 | -fx-background-color: -DARK_GRAY; 75 | -fx-border-color : -DARK_GRAY; 76 | -fx-scale-shape : false; 77 | -fx-shape : "M6.001,5.429l2.554,-2.555l0.571,0.571l-2.555,2.554l2.55,2.55l-0.572,0.572l-2.55,-2.55l-2.554,2.555l-0.571,-0.571l2.555,-2.554l-2.55,-2.55l0.572,-0.572l2.55,2.55Z"; 78 | } 79 | .macos-window-button:hovered:minimize .symbol { 80 | -fx-background-color: -DARK_GRAY; 81 | -fx-scale-shape : false; 82 | -fx-shape : "M2.0,5.5l8,0l0,1l-8,0l0,-1Z"; 83 | } 84 | .macos-window-button:hovered:zoom .symbol { 85 | -fx-background-color: -DARK_GRAY; 86 | -fx-scale-shape : false; 87 | -fx-shape : "M2.696,2.582l4.545,0.656l-3.889,3.889l-0.656,-4.545ZM9.533,9.418l-0.656,-4.545l-3.889,3.889l4.545,0.656Z"; 88 | } 89 | 90 | .macos-window-button:hovered:close .symbol-small { 91 | -fx-background-color: -DARK_GRAY; 92 | -fx-border-color : -DARK_GRAY; 93 | -fx-scale-shape : false; 94 | -fx-shape : "M4.508,4.065L6.426,2.147L6.854,2.576L4.936,4.493L6.85,6.406L6.421,6.835L4.507,4.922L2.59,6.839L2.162,6.411L4.079,4.494L2.166,2.58L2.595,2.151L4.508,4.065Z"; 95 | } 96 | .macos-window-button:hovered:minimize .symbol-small { 97 | -fx-background-color: -DARK_GRAY; 98 | -fx-scale-shape : false; 99 | -fx-shape : "M1.4934,4.118 l6.029,0 l0,0.751 l-6.029,0 l0,-1.4934Z"; 100 | } 101 | .macos-window-button:hovered:zoom .symbol-small { 102 | -fx-background-color: -DARK_GRAY; 103 | -fx-scale-shape : false; 104 | -fx-shape : "M7.159,7.059L6.667,3.648L3.748,6.566L7.159,7.059ZM2.028,1.928L5.439,2.42L2.521,5.339L2.028,1.928Z"; 105 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/ProcessMonitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.jdktools.OperatingSystem; 20 | 21 | import java.util.ArrayList; 22 | import java.util.HashSet; 23 | import java.util.List; 24 | import java.util.Optional; 25 | import java.util.Set; 26 | import java.util.concurrent.Executors; 27 | import java.util.concurrent.ScheduledExecutorService; 28 | import java.util.concurrent.TimeUnit; 29 | import java.util.regex.MatchResult; 30 | import java.util.regex.Matcher; 31 | import java.util.stream.Collectors; 32 | 33 | 34 | public class ProcessMonitor { 35 | private static final OperatingSystem OS = Finder.detectOperatingSystem(); 36 | private static final Matcher MATCHER = OperatingSystem.WINDOWS == OS ? Constants.JAVA_PATH_PATTERN_WIN.matcher("") : Constants.JAVA_PATH_PATTERN.matcher(""); 37 | private final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); 38 | private Set activeJavaSet = new HashSet<>(); 39 | private boolean running = false; 40 | 41 | 42 | public ProcessMonitor() { 43 | 44 | } 45 | 46 | 47 | public void start() { 48 | if (this.running) { return; } 49 | this.running = true; 50 | this.executorService.scheduleWithFixedDelay(() -> this.scan(), 0, 30, TimeUnit.SECONDS); 51 | } 52 | 53 | public void stop() throws InterruptedException { 54 | this.executorService.shutdown(); 55 | if (!executorService.awaitTermination(5, TimeUnit.SECONDS)) { 56 | this.executorService.shutdownNow(); 57 | this.running = false; 58 | } 59 | } 60 | 61 | public List runOnce() { 62 | scan(); 63 | return getActiveJavaInstallations(); 64 | } 65 | 66 | public List getActiveJavaInstallations() { 67 | return new ArrayList<>(activeJavaSet); 68 | } 69 | 70 | private void scan() { 71 | ProcessHandle.allProcesses().forEach(process -> checkProcessDetails(process)); 72 | } 73 | 74 | private void checkProcessDetails(final ProcessHandle process) { 75 | Optional cmdLineOpt = process.info().commandLine(); 76 | if (cmdLineOpt.isPresent()) { 77 | String cmdLine = cmdLineOpt.get(); 78 | MATCHER.reset(cmdLine); 79 | final List results = MATCHER.results().collect(Collectors.toList()); 80 | if (!results.isEmpty()) { 81 | MatchResult result = results.get(0); 82 | activeJavaSet.add(result.group(1)); 83 | } 84 | } 85 | } 86 | 87 | private String processDetails(final ProcessHandle process) { 88 | return String.format("%8d %8s %10s %26s %-40s", 89 | process.pid(), 90 | toString(process.parent().map(ProcessHandle::pid)), 91 | toString(process.info().user()), 92 | toString(process.info().startInstant()), 93 | toString(process.info().commandLine())); 94 | } 95 | private String toString(final Optional optional) { 96 | return optional.map(Object::toString).orElse("-"); 97 | } 98 | 99 | 100 | public static void main(String[] args) { 101 | new ProcessMonitor(); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/notification/NotifierBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.notification; 18 | 19 | import javafx.beans.property.*; 20 | import javafx.geometry.Pos; 21 | import javafx.stage.Stage; 22 | import javafx.util.Duration; 23 | 24 | import java.util.HashMap; 25 | 26 | 27 | public class NotifierBuilder> { 28 | private HashMap properties = new HashMap<>(); 29 | 30 | 31 | // ******************** Constructors ************************************** 32 | protected NotifierBuilder() { 33 | } 34 | 35 | 36 | // ******************** Methods ******************************************* 37 | public final static NotifierBuilder create() { 38 | return new NotifierBuilder(); 39 | } 40 | 41 | public final B owner(final Stage owner) { 42 | properties.put("stage", new SimpleObjectProperty<>(owner)); 43 | return (B)this; 44 | } 45 | 46 | public final B popupLocation(final Pos location) { 47 | properties.put("popupLocation", new SimpleObjectProperty<>(location)); 48 | return (B)this; 49 | } 50 | 51 | public final B width(final double width) { 52 | properties.put("width", new SimpleDoubleProperty(width)); 53 | return (B) this; 54 | } 55 | 56 | public final B height(final double height) { 57 | properties.put("height", new SimpleDoubleProperty(height)); 58 | return (B) this; 59 | } 60 | 61 | public final B spacingY(final double spacingY) { 62 | properties.put("spacingY", new SimpleDoubleProperty(spacingY)); 63 | return (B) this; 64 | } 65 | 66 | public final B popupLifeTime(final Duration popupLifetime) { 67 | properties.put("popupLifeTime", new SimpleObjectProperty<>(popupLifetime)); 68 | return (B) this; 69 | } 70 | 71 | public final B popupAnimationTime(final Duration popupAnimationTime) { 72 | properties.put("popupAnimationTime", new SimpleObjectProperty<>(popupAnimationTime)); 73 | return (B) this; 74 | } 75 | 76 | public final B styleSheet(final String styleSheet) { 77 | properties.put("styleSheet", new SimpleStringProperty(styleSheet)); 78 | return (B) this; 79 | } 80 | 81 | public final Notification.Notifier build() { 82 | final Notification.Notifier notifier = Notification.Notifier.INSTANCE; 83 | for (String key : properties.keySet()) { 84 | if ("owner".equals(key)) { 85 | notifier.setNotificationOwner(((ObjectProperty) properties.get(key)).get()); 86 | } else if ("popupLocation".equals(key)) { 87 | notifier.setPopupLocation(null, ((ObjectProperty) properties.get(key)).get()); 88 | } else if ("width".equals(key)) { 89 | notifier.setWidth(((DoubleProperty) properties.get(key)).get()); 90 | } else if ("height".equals(key)) { 91 | notifier.setHeight(((DoubleProperty) properties.get(key)).get()); 92 | } else if ("spacingY".equals(key)) { 93 | notifier.setSpacingY(((DoubleProperty) properties.get(key)).get()); 94 | } else if ("popupLifeTime".equals(key)) { 95 | notifier.setPopupLifetime(((ObjectProperty) properties.get(key)).get()); 96 | } else if ("popupAnimationTime".equals(key)) { 97 | notifier.setPopupAnimationTime(((ObjectProperty) properties.get(key)).get()); 98 | } else if ("styleSheet".equals(key)) { 99 | notifier.setStyleSheet(((StringProperty) properties.get(key)).get()); 100 | } 101 | } 102 | return notifier; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/controls/win-window-button.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .win-window-button { 18 | -RED : #e62c3a; 19 | -YELLOW : #ffbc35; 20 | -GREEN : #00c844; 21 | -GRAY : #515151; 22 | -DARK_GRAY : #313131; 23 | -LIGHT_GRAY: #969696; 24 | -fx-translate-x: 1px; 25 | -fx-translate-y: -1px; 26 | } 27 | 28 | .win-window-button:close .rect, 29 | .win-window-button:dark:close .rect { 30 | -fx-fill: transparent; 31 | } 32 | 33 | .win-window-button:close:hovered .rect, 34 | .win-window-button:dark:close:hovered .rect, 35 | .win-window-button:close:pressed .rect, 36 | .win-window-button:dark:close:pressed .rect { 37 | -fx-fill: -RED; 38 | } 39 | 40 | .win-window-button:minimize .rect, 41 | .win-window-button:dark.minimize .rect { 42 | -fx-fill: transparent; 43 | } 44 | 45 | .win-window-button:minimize:hovered .rect, 46 | .win-window-button:dark:minimize:hovered .rect, 47 | .win-window-button:minimized:pressed .rect, 48 | .win-window-button:dark:minimized:pressed .rect { 49 | -fx-fill: -YELLOW; 50 | } 51 | 52 | .win-window-button:zoom .rect, 53 | .win-window-button:dark:zoom .rect { 54 | -fx-fill: transparent; 55 | } 56 | 57 | .win-window-button:zoom:hovered .rect, 58 | .win-window-button:dark:zoom:hovered .rect, 59 | .win-window-button:zoom:pressed .rect, 60 | .win-window-button:dark:zoom:pressed .rect { 61 | -fx-fill: -GREEN; 62 | } 63 | 64 | .win-window-button:disabled:close .rect, 65 | .win-window-button:disabled:minimize .rect, 66 | .win-window-button:disabled:zoom .rect { 67 | -fx-fill: white; 68 | } 69 | .win-window-button:dark:disabled:close .rect, 70 | .win-window-button:dark:disabled:minimize .rect, 71 | .win-window-button:dark:disabled:zoom .rect { 72 | -fx-fill: black; 73 | } 74 | 75 | 76 | .win-window-button:close .symbol { 77 | -fx-background-color: black; 78 | -fx-scale-shape : true; 79 | -fx-shape : "M6.368,4.946L11.314,0L12.736,1.422L7.79,6.368L12.736,11.314L11.314,12.736L6.368,7.79L1.422,12.736L0,11.314L4.946,6.368L-0,1.422L1.422,0L6.368,4.946Z"; 80 | } 81 | .win-window-button:hovered:close .symbol { 82 | -fx-background-color: white; 83 | } 84 | .win-window-button:minimize .symbol, 85 | .win-window-button:hovered:minimize .symbol { 86 | -fx-background-color: black; 87 | -fx-scale-shape : true; 88 | -fx-shape : "M0.4,5.4l12,0l0,2l-12,0l0,-2Z"; 89 | } 90 | .win-window-button:zoom .symbol, 91 | .win-window-button:hovered:zoom .symbol { 92 | -fx-background-color: black; 93 | -fx-scale-shape : true; 94 | -fx-shape : "M12.368,0.357L0.368,0.357L0.368,12.379L12.368,12.379L12.368,0.357ZM10.359,2.351L2.377,2.351L2.377,10.385L10.359,10.385L10.359,2.351Z"; 95 | } 96 | 97 | 98 | .win-window-button:dark:close .symbol { 99 | -fx-background-color: -LIGHT_GRAY; 100 | -fx-scale-shape : true; 101 | -fx-shape : "M6.368,4.946L11.314,0L12.736,1.422L7.79,6.368L12.736,11.314L11.314,12.736L6.368,7.79L1.422,12.736L0,11.314L4.946,6.368L-0,1.422L1.422,0L6.368,4.946Z"; 102 | } 103 | .win-window-button:dark:hovered:close .symbol { 104 | -fx-background-color: white; 105 | } 106 | .win-window-button:dark:minimize .symbol, 107 | .win-window-button:dark:hovered:minimize .symbol { 108 | -fx-background-color: -LIGHT_GRAY; 109 | -fx-scale-shape : true; 110 | -fx-shape : "M0.4,5.4l12,0l0,2l-12,0l0,-2Z"; 111 | } 112 | .win-window-button:dark:zoom .symbol, 113 | .win-window-button:dark:hovered:zoom .symbol { 114 | -fx-background-color: -LIGHT_GRAY; 115 | -fx-scale-shape : true; 116 | -fx-shape : "M12.368,0.357L0.368,0.357L0.368,12.379L12.368,12.379L12.368,0.357ZM10.359,2.351L2.377,2.351L2.377,10.385L10.359,10.385L10.359,2.351Z"; 117 | } 118 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/Fonts.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import javafx.scene.text.Font; 20 | 21 | 22 | public class Fonts { 23 | private static final String SF_PRO_NAME; 24 | private static final String SF_PRO_TEXT_LIGHT_NAME; 25 | private static final String SF_PRO_TEXT_REGULAR_NAME; 26 | private static final String SF_PRO_TEXT_MEDIUM_NAME; 27 | private static final String SF_PRO_TEXT_BOLD_NAME; 28 | private static final String SEGOE_UI_NAME; 29 | private static final String SEGOE_UI_LIGHT_NAME; 30 | private static final String SEGOE_UI_SEMI_BOLD_NAME; 31 | private static final String SEGOE_UI_BOLD_NAME; 32 | 33 | private static String sfProName; 34 | private static String sfProTextLightName; 35 | private static String sfProTextRegularName; 36 | private static String sfProTextMediumName; 37 | private static String sfProTextBoldName; 38 | private static String segoeUiName; 39 | private static String segoeUiLightName; 40 | private static String segoeUiSemiBoldName; 41 | private static String segoeUiBoldName; 42 | 43 | 44 | static { 45 | try { 46 | sfProName = Font.loadFont(Fonts.class.getResourceAsStream("/eu/hansolo/fx/jdkmon/tools/SF-Pro.otf"), 10).getName(); 47 | sfProTextLightName = Font.loadFont(Fonts.class.getResourceAsStream("/eu/hansolo/fx/jdkmon/tools/SF-Pro-Text-Light.otf"), 10).getName(); 48 | sfProTextRegularName = Font.loadFont(Fonts.class.getResourceAsStream("/eu/hansolo/fx/jdkmon/tools/SF-Pro-Text-Regular.otf"), 10).getName(); 49 | sfProTextMediumName = Font.loadFont(Fonts.class.getResourceAsStream("/eu/hansolo/fx/jdkmon/tools/SF-Pro-Text-Medium.otf"), 10).getName(); 50 | sfProTextBoldName = Font.loadFont(Fonts.class.getResourceAsStream("/eu/hansolo/fx/jdkmon/tools/SF-Pro-Text-Bold.otf"), 10).getName(); 51 | segoeUiName = Font.loadFont(Fonts.class.getResourceAsStream("/eu/hansolo/fx/jdkmon/tools/segoeui.ttf"), 10).getName(); 52 | segoeUiLightName = Font.loadFont(Fonts.class.getResourceAsStream("/eu/hansolo/fx/jdkmon/tools/segoeuil.ttf"), 10).getName(); 53 | segoeUiSemiBoldName = Font.loadFont(Fonts.class.getResourceAsStream("/eu/hansolo/fx/jdkmon/tools/segoeuisb.ttf"), 10).getName(); 54 | segoeUiBoldName = Font.loadFont(Fonts.class.getResourceAsStream("/eu/hansolo/fx/jdkmon/tools/segoeuib.ttf"), 10).getName(); 55 | } catch (Exception exception) { } 56 | SF_PRO_NAME = sfProName; 57 | SF_PRO_TEXT_LIGHT_NAME = sfProTextLightName; 58 | SF_PRO_TEXT_REGULAR_NAME = sfProTextRegularName; 59 | SF_PRO_TEXT_MEDIUM_NAME = sfProTextMediumName; 60 | SF_PRO_TEXT_BOLD_NAME = sfProTextBoldName; 61 | SEGOE_UI_NAME = segoeUiName; 62 | SEGOE_UI_LIGHT_NAME = segoeUiLightName; 63 | SEGOE_UI_SEMI_BOLD_NAME = segoeUiSemiBoldName; 64 | SEGOE_UI_BOLD_NAME = segoeUiBoldName; 65 | } 66 | 67 | 68 | // ******************** Methods ******************************************* 69 | public static Font sfPro(final double size) { return new Font(SF_PRO_NAME, size); } 70 | public static Font sfProTextLight(final double size) { return new Font(SF_PRO_TEXT_LIGHT_NAME, size); } 71 | public static Font sfProTextRegular(final double size) { return new Font(SF_PRO_TEXT_REGULAR_NAME, size); } 72 | public static Font sfProTextMedium(final double size) { return new Font(SF_PRO_TEXT_MEDIUM_NAME, size); } 73 | public static Font sfProTextBold(final double size) { return new Font(SF_PRO_TEXT_BOLD_NAME, size); } 74 | 75 | public static Font segoeUi(final double size) { return new Font(SEGOE_UI_NAME, size); } 76 | public static Font segoeUiLight(final double size) { return new Font(SEGOE_UI_LIGHT_NAME, size); } 77 | public static Font segoeUiSemiBold(final double size) { return new Font(SEGOE_UI_SEMI_BOLD_NAME, size); } 78 | public static Font segoeUiBold(final double size) { return new Font(SEGOE_UI_BOLD_NAME, size); } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/controls/MacosComboBoxCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.controls; 18 | 19 | import eu.hansolo.fx.jdkmon.tools.Detector; 20 | import eu.hansolo.fx.jdkmon.tools.Detector.MacosAccentColor; 21 | import javafx.beans.property.BooleanProperty; 22 | import javafx.beans.property.BooleanPropertyBase; 23 | import javafx.beans.property.ObjectProperty; 24 | import javafx.beans.property.ObjectPropertyBase; 25 | import javafx.css.PseudoClass; 26 | import javafx.scene.control.ComboBox; 27 | import javafx.scene.control.ContentDisplay; 28 | import javafx.scene.control.ListCell; 29 | import javafx.scene.image.Image; 30 | import javafx.scene.image.ImageView; 31 | 32 | 33 | public class MacosComboBoxCell extends ListCell { 34 | public static final ImageView EMPTY_CHECK_MARK = new ImageView(new Image(MacosComboBoxCell.class.getResourceAsStream("macos-checkmark-empty.png"), 10, 10, true, false)); 35 | public static final ImageView BLACK_CHECK_MARK = new ImageView(new Image(MacosComboBoxCell.class.getResourceAsStream("macos-checkmark-black.png"), 10, 10, true, false)); 36 | public static final ImageView WHITE_CHECK_MARK = new ImageView(new Image(MacosComboBoxCell.class.getResourceAsStream("macos-checkmark-white.png"), 10, 10, true, false)); 37 | private static final PseudoClass DARK_PSEUDO_CLASS = PseudoClass.getPseudoClass("dark"); 38 | private BooleanProperty dark; 39 | private ObjectProperty accentColor; 40 | 41 | 42 | // ******************** Constructors ************************************** 43 | public MacosComboBoxCell() { 44 | getStyleClass().add("macos-combo-box-cell"); 45 | this.dark = new BooleanPropertyBase(Detector.isDarkMode()) { 46 | @Override protected void invalidated() { 47 | pseudoClassStateChanged(DARK_PSEUDO_CLASS, get()); 48 | } 49 | @Override public Object getBean() { return MacosComboBoxCell.this; } 50 | @Override public String getName() { return "dark"; } 51 | }; 52 | this.accentColor = new ObjectPropertyBase<>(Detector.getMacosAccentColor()) { 53 | @Override protected void invalidated() { setStyle(isDark() ? new StringBuilder("-selection-color: ").append(get().getDarkStyleClass()).append(";").toString() : new StringBuilder("-selection-color: ").append(get().getDarkStyleClass()).append(";").toString()); } 54 | @Override public Object getBean() { return MacosComboBoxCell.this; } 55 | @Override public String getName() { return "accentColor"; } 56 | }; 57 | setGraphicTextGap(5); 58 | setContentDisplay(ContentDisplay.LEFT); 59 | } 60 | 61 | 62 | // ******************** Methods ******************************************* 63 | public final boolean isDark() { 64 | return dark.get(); 65 | } 66 | public final void setDark(final boolean dark) { this.dark.set(dark); } 67 | public final BooleanProperty darkProperty() { return dark; } 68 | 69 | public MacosAccentColor getAccentColor() { return accentColor.get(); } 70 | public void setAccentColor(final MacosAccentColor accentColor) { this.accentColor.set(accentColor); } 71 | public ObjectProperty accentColorProperty() { return accentColor; } 72 | 73 | 74 | @Override protected void updateItem(final T item, final boolean empty) { 75 | super.updateItem(item, empty); 76 | 77 | if (empty || null == item) { 78 | setText(null); 79 | setGraphic(null); 80 | } else { 81 | setText(item.toString()); 82 | setGraphic(isSelected() ? (isDark() ? WHITE_CHECK_MARK : BLACK_CHECK_MARK) : EMPTY_CHECK_MARK); 83 | } 84 | } 85 | 86 | @Override public String toString() { 87 | return getItem().toString(); 88 | } 89 | 90 | 91 | // ******************** Style related ************************************* 92 | //@Override public String getUserAgentStylesheet() { return MacosComboBoxCell.class.getResource("../jdk-mon.css").toExternalForm(); } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/controls/AttentionIndicator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.controls; 18 | 19 | import javafx.beans.property.ObjectProperty; 20 | import javafx.beans.property.ObjectPropertyBase; 21 | import javafx.geometry.Insets; 22 | import javafx.scene.control.Tooltip; 23 | import javafx.scene.layout.Background; 24 | import javafx.scene.layout.BackgroundFill; 25 | import javafx.scene.layout.CornerRadii; 26 | import javafx.scene.layout.Region; 27 | import javafx.scene.paint.Color; 28 | import javafx.scene.shape.SVGPath; 29 | 30 | 31 | public class AttentionIndicator extends Region { 32 | public static final Color RED = Color.rgb(171, 41, 59); 33 | public static final Color ORANGE = Color.rgb(247, 137, 5); 34 | private static final double PREFERRED_WIDTH = 18; 35 | private static final double PREFERRED_HEIGHT = 18; 36 | private static final double MINIMUM_WIDTH = 18; 37 | private static final double MINIMUM_HEIGHT = 18; 38 | private static final double MAXIMUM_WIDTH = 18; 39 | private static final double MAXIMUM_HEIGHT = 18; 40 | private static final CornerRadii CORNER_RADII = new CornerRadii(3); 41 | private Color _backgroundColor = RED; 42 | private Color _iconColor = Color.WHITE; 43 | private Tooltip _tooltip = null; 44 | private SVGPath icon; 45 | private ObjectProperty backgroundColor; 46 | private ObjectProperty iconColor; 47 | private ObjectProperty tooltip; 48 | 49 | 50 | // ******************** Constructors ************************************** 51 | public AttentionIndicator() { 52 | initGraphics(); 53 | } 54 | 55 | 56 | // ******************** Initialization ************************************ 57 | private void initGraphics() { 58 | setMinSize(MINIMUM_WIDTH, MINIMUM_HEIGHT); 59 | setMaxSize(MAXIMUM_WIDTH, MAXIMUM_HEIGHT); 60 | setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); 61 | 62 | setBackground(new Background(new BackgroundFill(_backgroundColor, CORNER_RADII, Insets.EMPTY))); 63 | 64 | icon = new SVGPath(); 65 | icon.setContent("M12.694,2.832c0.265,-0.473 0.764,-0.766 1.306,-0.766c0.542,0 1.041,0.293 1.306,0.766c2.684,4.793 8.792,15.7 11.436,20.421c0.261,0.467 0.256,1.039 -0.015,1.501c-0.271,0.462 -0.767,0.746 -1.302,0.746c-5.353,0 -17.62,0 -22.915,0c-0.522,-0 -1.005,-0.277 -1.269,-0.727c-0.264,-0.451 -0.27,-1.007 -0.015,-1.463c2.626,-4.689 8.773,-15.665 11.468,-20.478Zm3.223,16.412c0,-0.546 -0.443,-0.988 -0.988,-0.988l-1.986,-0c-0.545,-0 -0.988,0.442 -0.988,0.988l0,1.976c0,0.545 0.443,0.988 0.988,0.988l1.986,-0c0.545,-0 0.988,-0.443 0.988,-0.988l0,-1.976Zm0.117,-9.008c0,-0.555 -0.451,-1.006 -1.006,-1.006l-2.012,0c-0.555,0 -1.006,0.451 -1.006,1.006l0,5.987c0,0.555 0.451,1.006 1.006,1.006l2.012,0c0.555,0 1.006,-0.451 1.006,-1.006l0,-5.987Z"); 66 | icon.setFill(Color.WHITE); 67 | icon.setScaleX(0.5); 68 | icon.setScaleY(0.5); 69 | icon.setLayoutX(-5); 70 | icon.setLayoutY(-5); 71 | 72 | getChildren().setAll(icon); 73 | } 74 | 75 | 76 | // ******************** Methods ******************************************* 77 | public Color getBackgroundColor() { return null == backgroundColor ? _backgroundColor : backgroundColor.get(); } 78 | public void setBackgroundColor(final Color backgroundColor) { 79 | if (null == this.backgroundColor) { 80 | _backgroundColor = backgroundColor; 81 | setBackground(new Background(new BackgroundFill(_backgroundColor, CORNER_RADII, Insets.EMPTY))); 82 | } else { 83 | this.backgroundColor.set(backgroundColor); 84 | } 85 | } 86 | public ObjectProperty backgroundColorProperty() { 87 | if (null == backgroundColor) { 88 | backgroundColor = new ObjectPropertyBase<>(_backgroundColor) { 89 | @Override protected void invalidated() { setBackground(new Background(new BackgroundFill(get(), CORNER_RADII, Insets.EMPTY)));} 90 | @Override public Object getBean() { return AttentionIndicator.this; } 91 | @Override public String getName() { return "backgroundColor"; } 92 | }; 93 | _backgroundColor = null; 94 | } 95 | return backgroundColor; 96 | } 97 | 98 | public Color getIconColor() { return null == iconColor ? _iconColor : iconColor.get(); } 99 | public void setIconColor(final Color iconColor) { 100 | if (null == this.iconColor) { 101 | _iconColor = iconColor; 102 | icon.setFill(_iconColor); 103 | } else { 104 | this.iconColor.set(iconColor); 105 | } 106 | } 107 | public ObjectProperty iconColorProperty() { 108 | if (null == iconColor) { 109 | iconColor = new ObjectPropertyBase<>(_iconColor) { 110 | @Override protected void invalidated() { icon.setFill(get()); } 111 | @Override public Object getBean() { return AttentionIndicator.this; } 112 | @Override public String getName() { return "iconColor"; } 113 | }; 114 | _iconColor = null; 115 | } 116 | return iconColor; 117 | } 118 | 119 | public Tooltip getTooltip() { return null == tooltip ? _tooltip : tooltip.get(); } 120 | public void setTooltip(final Tooltip tooltip) { 121 | if (null == this.tooltip) { 122 | _tooltip = tooltip; 123 | Tooltip.install(AttentionIndicator.this, _tooltip); 124 | } else { 125 | this.tooltip.set(tooltip); 126 | } 127 | } 128 | public ObjectProperty tooltipProperty() { 129 | if (null == tooltip) { 130 | tooltip = new ObjectPropertyBase<>(_tooltip) { 131 | @Override protected void invalidated() { Tooltip.install(AttentionIndicator.this, get()); } 132 | @Override public Object getBean() { return AttentionIndicator.this; } 133 | @Override public String getName() { return "tooltip"; } 134 | }; 135 | _tooltip = null; 136 | } 137 | return tooltip; 138 | } 139 | } -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/jdkmon/notification/notification.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .root { 18 | -fx-background-color: transparent; 19 | -fx-fill : transparent; 20 | } 21 | 22 | 23 | /* Notifications for MacOS */ 24 | .notification-mac { 25 | -fx-background-color : rgb(0, 0, 0, 0.75); /*rgb(119, 118, 118, 0.95);*/ 26 | -fx-border-color : rgb(0, 0, 0, 0.85); /*rgb(139, 138, 138, 0.95);*/ 27 | -fx-border-width : 1px; 28 | -fx-background-radius: 10px; 29 | -fx-border-radius : 10px; 30 | -fx-effect : none; 31 | -foreground-color : rgb(242, 241, 241); 32 | -background-color : rgb(0, 0, 0, 0.75); /*rgb(119, 118, 118, 0.95);*/ 33 | -icon-color : white; 34 | } 35 | 36 | .notification-mac .title { 37 | -fx-font-size : 1.0em; 38 | -fx-font-weight : bold; 39 | -fx-text-fill : -foreground-color; 40 | -fx-content-display : left; 41 | -fx-graphic-text-gap: 5px; 42 | } 43 | 44 | .notification-mac .msg-area { 45 | -fx-background-color : transparent; /*-background-color;*/ 46 | -fx-background-insets: 0; 47 | -fx-font-size : 1.0em; 48 | -fx-text-fill : -foreground-color; 49 | -fx-wrap-text : true; 50 | } 51 | .notification-mac .msg-area .content, 52 | .notification-mac .msg-area:focused .content { 53 | -fx-background-color : transparent; /*-background-color;*/ 54 | -fx-background-insets: 0; 55 | -fx-background-radius: 0; 56 | -fx-padding : 0px; 57 | } 58 | .notification-mac .msg-area > .scroll-pane { 59 | -fx-background-color : transparent; /*-background-color;*/ 60 | -fx-background-insets: 0; 61 | -fx-padding : 0; 62 | } 63 | .notification-mac .msg-area > .scroll-pane > .viewport { 64 | -fx-background-color : transparent; /*-background-color;*/ 65 | -fx-background-insets: 0; 66 | -fx-padding : 0; 67 | } 68 | .notification-mac .msg-area > .scroll-pane > .scroll-bar .increment-arrow, 69 | .notification-mac .msg-area > .scroll-pane > .scroll-bar .decrement-arrow { 70 | -fx-shape : ""; 71 | -fx-background-insets: 2; 72 | -fx-padding : 0; 73 | } 74 | .notification-mac .msg-area > .scroll-pane > .scroll-bar:horizontal .thumb, 75 | .notification-mac .msg-area > .scroll-pane > .scroll-bar:vertical .thumb { 76 | -fx-background-color : rgba(0, 0, 0, 0.1); 77 | -fx-background-radius: 2em; 78 | } 79 | .notification-mac .msg-area > .scroll-pane > .scroll-bar:horizontal .thumb:hover, 80 | .notification-mac .msg-area > .scroll-pane > .scroll-bar:vertical .thumb:hover { 81 | -fx-background-color : rgba(0, 0, 0, 0.3); 82 | -fx-background-radius: 2em; 83 | } 84 | .notification-mac .msg-area > .scroll-pane > .scroll-bar:horizontal { 85 | visibility : hidden; 86 | -fx-background-insets: 0; 87 | -fx-padding : 0; 88 | } 89 | .notification-mac .msg-area > .scroll-pane > .scroll-bar:horizontal .track { 90 | -fx-background-color : -background-color; 91 | -fx-border-color : -background-color; 92 | -fx-background-radius: 0; 93 | -fx-border-radius : 2em; 94 | } 95 | .notification-mac .msg-area > .scroll-pane > .scroll-bar:horizontal > .increment-button, 96 | .notification-mac .msg-area > .scroll-pane > .scroll-bar:horizontal > .decrement-button { 97 | -fx-padding: 0; 98 | } 99 | .notification-mac .msg-area > .scroll-pane > .scroll-bar:vertical { 100 | visibility : hidden; 101 | -fx-background-insets: 0; 102 | -fx-padding : 0; 103 | } 104 | .notification-mac .msg-area > .scroll-pane > .scroll-bar:vertical .track { 105 | -fx-background-color : -background-color; 106 | -fx-border-color : -background-color; 107 | -fx-background-radius: 0; 108 | -fx-border-radius : 2em; 109 | } 110 | .notification-mac .msg-area > .scroll-pane > .scroll-bar:vertical > .increment-button, 111 | .notification-mac .msg-area > .scroll-pane > .scroll-bar:vertical > .decrement-button { 112 | -fx-padding: 0; 113 | } 114 | .notification-mac .msg-area > .scroll-pane > .corner { 115 | -fx-background-color: transparent; 116 | } 117 | 118 | 119 | /* Notifications for Windows 10 */ 120 | .notification-win { 121 | -fx-background-color : rgb(31, 31, 31); 122 | -fx-border-color : rgb(31, 31, 31); 123 | -fx-border-width : 1px; 124 | -fx-background-radius: 0px; 125 | -fx-border-radius : 0px; 126 | -fx-effect : none; 127 | -foreground-color : rgb(160, 160, 160); 128 | -background-color : rgb(31, 31, 31); 129 | -icon-color : white; 130 | } 131 | 132 | .notification-win .title { 133 | -fx-font-size : 1em; 134 | -fx-font-weight : bold; 135 | -fx-text-fill : white; 136 | -fx-content-display : left; 137 | -fx-graphic-text-gap: 10px; 138 | } 139 | 140 | .notification-win .msg-area { 141 | -fx-background-color : -background-color; 142 | -fx-background-insets: 0; 143 | -fx-font-size : 1em; 144 | -fx-text-fill : -foreground-color; 145 | -fx-wrap-text : true; 146 | } 147 | .notification-win .msg-area .content, 148 | .notification-win .msg-area:focused .content { 149 | -fx-background-color : -background-color; 150 | -fx-background-insets: 0; 151 | -fx-background-radius: 0; 152 | -fx-padding : 0px; 153 | } 154 | .notification-win .msg-area > .scroll-pane { 155 | -fx-background-color : -background-color; 156 | -fx-background-insets: 0; 157 | -fx-padding : 0; 158 | } 159 | .notification-win .msg-area > .scroll-pane > .viewport { 160 | -fx-background-color : -background-color; 161 | -fx-background-insets: 0; 162 | -fx-padding : 0; 163 | } 164 | .notification-win .msg-area > .scroll-pane > .scroll-bar .increment-arrow, 165 | .notification-win .msg-area > .scroll-pane > .scroll-bar .decrement-arrow { 166 | -fx-shape : ""; 167 | -fx-background-insets: 0; 168 | -fx-padding : 0; 169 | } 170 | .notification-win .msg-area > .scroll-pane > .scroll-bar:horizontal .thumb, 171 | .notification-win .msg-area > .scroll-pane > .scroll-bar:vertical .thumb { 172 | -fx-background-color : rgba(0, 0, 0, 0.1); 173 | -fx-background-radius: 0; 174 | } 175 | .notification-win .msg-area > .scroll-pane > .scroll-bar:horizontal .thumb:hover, 176 | .notification-win .msg-area > .scroll-pane > .scroll-bar:vertical .thumb:hover { 177 | -fx-background-color : rgba(0, 0, 0, 0.3); 178 | -fx-background-radius: 0; 179 | } 180 | .notification-win .msg-area > .scroll-pane > .scroll-bar:horizontal { 181 | visibility : hidden; 182 | -fx-background-insets: 0; 183 | -fx-padding : 0; 184 | } 185 | .notification-win .msg-area > .scroll-pane > .scroll-bar:horizontal .track { 186 | -fx-background-color : -background-color; 187 | -fx-border-color : -background-color; 188 | -fx-background-radius: 0; 189 | -fx-border-radius : 0; 190 | } 191 | .notification-win .msg-area > .scroll-pane > .scroll-bar:horizontal > .increment-button, 192 | .notification-win .msg-area > .scroll-pane > .scroll-bar:horizontal > .decrement-button { 193 | -fx-padding: 0; 194 | } 195 | .notification-win .msg-area > .scroll-pane > .scroll-bar:vertical { 196 | visibility : hidden; 197 | -fx-background-insets: 0; 198 | -fx-padding : 0; 199 | } 200 | .notification-win .msg-area > .scroll-pane > .scroll-bar:vertical .track { 201 | -fx-background-color : -background-color; 202 | -fx-border-color : -background-color; 203 | -fx-background-radius: 0; 204 | -fx-border-radius : 0; 205 | } 206 | .notification-win .msg-area > .scroll-pane > .scroll-bar:vertical > .increment-button, 207 | .notification-win .msg-area > .scroll-pane > .scroll-bar:vertical > .decrement-button { 208 | -fx-padding: 0; 209 | } 210 | .notification-win .msg-area > .scroll-pane > .corner { 211 | -fx-background-color: transparent; 212 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/ResizeHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import javafx.collections.ObservableList; 20 | import javafx.event.EventHandler; 21 | import javafx.event.EventType; 22 | import javafx.scene.Cursor; 23 | import javafx.scene.Node; 24 | import javafx.scene.Parent; 25 | import javafx.scene.Scene; 26 | import javafx.scene.input.MouseEvent; 27 | import javafx.stage.Stage; 28 | 29 | 30 | public class ResizeHelper { 31 | 32 | 33 | // ******************** Methods ******************************************* 34 | public static void addResizeListener(Stage stage) { 35 | ResizeListener resizeListener = new ResizeListener(stage); 36 | stage.getScene().addEventHandler(MouseEvent.MOUSE_MOVED, resizeListener); 37 | stage.getScene().addEventHandler(MouseEvent.MOUSE_PRESSED, resizeListener); 38 | stage.getScene().addEventHandler(MouseEvent.MOUSE_DRAGGED, resizeListener); 39 | stage.getScene().addEventHandler(MouseEvent.MOUSE_EXITED, resizeListener); 40 | stage.getScene().addEventHandler(MouseEvent.MOUSE_EXITED_TARGET, resizeListener); 41 | ObservableList children = stage.getScene().getRoot().getChildrenUnmodifiable(); 42 | for (Node child : children) { 43 | addListenerDeeply(child, resizeListener); 44 | } 45 | } 46 | 47 | private static void addListenerDeeply(Node node, EventHandler listener) { 48 | node.addEventHandler(MouseEvent.MOUSE_MOVED, listener); 49 | node.addEventHandler(MouseEvent.MOUSE_PRESSED, listener); 50 | node.addEventHandler(MouseEvent.MOUSE_DRAGGED, listener); 51 | node.addEventHandler(MouseEvent.MOUSE_EXITED, listener); 52 | node.addEventHandler(MouseEvent.MOUSE_EXITED_TARGET, listener); 53 | if (node instanceof Parent) { 54 | Parent parent = (Parent) node; 55 | ObservableList children = parent.getChildrenUnmodifiable(); 56 | for (Node child : children) { 57 | addListenerDeeply(child, listener); 58 | } 59 | } 60 | } 61 | 62 | 63 | // ******************** Inner Classes ************************************* 64 | private static class ResizeListener implements EventHandler { 65 | private Stage stage; 66 | private Cursor cursorEvent = Cursor.DEFAULT; 67 | private int border = 8; 68 | private double startX = 0; 69 | private double startY = 0; 70 | private double startScreenX = 0; 71 | private double startScreenY = 0; 72 | 73 | 74 | // ******************** Constructors ********************************** 75 | public ResizeListener(Stage stage) { 76 | this.stage = stage; 77 | } 78 | 79 | 80 | // ******************** Methods *************************************** 81 | @Override public void handle(MouseEvent e) { 82 | EventType type = e.getEventType(); 83 | Scene scene = stage.getScene(); 84 | 85 | double mouseEventX = e.getSceneX(); 86 | double mouseEventY = e.getSceneY(); 87 | double sceneWidth = scene.getWidth(); 88 | double sceneHeight = scene.getHeight(); 89 | 90 | if (MouseEvent.MOUSE_MOVED.equals(type)) { 91 | if (mouseEventX < border && mouseEventY < border) { 92 | cursorEvent = Cursor.NW_RESIZE; 93 | } else if (mouseEventX < border && mouseEventY > sceneHeight - border) { 94 | cursorEvent = Cursor.SW_RESIZE; 95 | } else if (mouseEventX > sceneWidth - border && mouseEventY < border) { 96 | cursorEvent = Cursor.NE_RESIZE; 97 | } else if (mouseEventX > sceneWidth - border && mouseEventY > sceneHeight - border) { 98 | cursorEvent = Cursor.SE_RESIZE; 99 | } else if (mouseEventX < border) { 100 | cursorEvent = Cursor.W_RESIZE; 101 | } else if (mouseEventX > sceneWidth - border) { 102 | cursorEvent = Cursor.E_RESIZE; 103 | } else if (mouseEventY < border) { 104 | cursorEvent = Cursor.N_RESIZE; 105 | } else if (mouseEventY > sceneHeight - border) { 106 | cursorEvent = Cursor.S_RESIZE; 107 | } else { 108 | cursorEvent = Cursor.DEFAULT; 109 | } 110 | scene.setCursor(cursorEvent); 111 | } else if (MouseEvent.MOUSE_EXITED.equals(type) || MouseEvent.MOUSE_EXITED_TARGET.equals(type)) { 112 | scene.setCursor(Cursor.DEFAULT); 113 | } else if (MouseEvent.MOUSE_PRESSED.equals(type)) { 114 | startX = stage.getWidth() - mouseEventX; 115 | startY = stage.getHeight() - mouseEventY; 116 | } else if (MouseEvent.MOUSE_DRAGGED.equals(type)) { 117 | if (!Cursor.DEFAULT.equals(cursorEvent)) { 118 | if (!Cursor.W_RESIZE.equals(cursorEvent) && !Cursor.E_RESIZE.equals(cursorEvent)) { 119 | final double minHeight = stage.getMinHeight() > (border * 2) ? stage.getMinHeight() : (border * 2); 120 | final double maxHeight = stage.getMaxHeight(); 121 | if (Cursor.NW_RESIZE.equals(cursorEvent) || Cursor.N_RESIZE.equals(cursorEvent) || Cursor.NE_RESIZE.equals(cursorEvent)) { 122 | double newHeight = stage.getHeight() - (e.getScreenY() - stage.getY()); 123 | if (newHeight >= minHeight && newHeight <= maxHeight) { 124 | stage.setHeight(newHeight); 125 | stage.setY(e.getScreenY()); 126 | } else { 127 | newHeight = Math.min(Math.max(newHeight, minHeight), maxHeight); 128 | // y1 + h1 = y2 + h2 129 | // y1 = y2 + h2 - h1 130 | stage.setY(stage.getY() + stage.getHeight() - newHeight); 131 | stage.setHeight(newHeight); 132 | } 133 | } else { 134 | stage.setHeight(Math.min(Math.max(mouseEventY + startY, minHeight), maxHeight)); 135 | } 136 | } 137 | 138 | if (!Cursor.N_RESIZE.equals(cursorEvent) && !Cursor.S_RESIZE.equals(cursorEvent)) { 139 | final double minWidth = stage.getMinWidth() > (border * 2) ? stage.getMinWidth() : (border * 2); 140 | final double maxWidth = stage.getMaxWidth(); 141 | if (Cursor.NW_RESIZE.equals(cursorEvent) || Cursor.W_RESIZE.equals(cursorEvent) || Cursor.SW_RESIZE.equals(cursorEvent)) { 142 | double newWidth = stage.getWidth() - (e.getScreenX() - stage.getX()); 143 | if (newWidth >= minWidth && newWidth <= maxWidth) { 144 | stage.setWidth(newWidth); 145 | stage.setX(e.getScreenX()); 146 | } else { 147 | newWidth = Math.min(Math.max(newWidth, minWidth), maxWidth); 148 | // x1 + w1 = x2 + w2 149 | // x1 = x2 + w2 - w1 150 | stage.setX(stage.getX() + stage.getWidth() - newWidth); 151 | stage.setWidth(newWidth); 152 | } 153 | } else { 154 | stage.setWidth(Math.min(Math.max(mouseEventX + startX, minWidth), maxWidth)); 155 | } 156 | } 157 | } 158 | } 159 | } 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/Distro.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.jdktools.scopes.BuildScope; 20 | import eu.hansolo.jdktools.versioning.VersionNumber; 21 | import io.foojay.api.discoclient.pkg.Feature; 22 | 23 | import java.io.IOException; 24 | import java.time.LocalDateTime; 25 | import java.util.ArrayList; 26 | import java.util.List; 27 | import java.util.Optional; 28 | import java.util.stream.Collectors; 29 | 30 | import static eu.hansolo.jdktools.Constants.COMMA; 31 | import static eu.hansolo.jdktools.Constants.NEW_LINE; 32 | 33 | 34 | public class Distro { 35 | private final String name; 36 | private final String apiString; 37 | private final String version; 38 | private final VersionNumber versionNumber; 39 | private final String jdkMajorVersion; 40 | private final String operatingSystem; 41 | private final String architecture; 42 | private final Boolean fxBundled; 43 | private final String location; 44 | private final Feature feature; 45 | private final BuildScope buildScope; 46 | private final boolean handledBySdkman; 47 | private final String path; 48 | private boolean inUse; 49 | private boolean supportsCRaC; 50 | private final List modules; 51 | private Optional releaseDate; 52 | private Optional endOfLifeDate; 53 | 54 | 55 | public Distro(final String name, final String apiString, final String version, final String jdkMajorVersion, final String operatingSystem, final String architecture, final Boolean fxBundled, final String location, final Feature feature, final BuildScope buildScope, final boolean handledBySdkman, final String path) { 56 | this.name = name; 57 | this.apiString = apiString; 58 | this.version = version; 59 | this.versionNumber = VersionNumber.fromText(version); 60 | this.jdkMajorVersion = jdkMajorVersion; 61 | this.operatingSystem = operatingSystem; 62 | this.architecture = architecture; 63 | this.fxBundled = fxBundled; 64 | this.location = location; 65 | this.feature = feature; 66 | this.buildScope = buildScope; 67 | this.handledBySdkman = handledBySdkman; 68 | this.path = path; 69 | this.inUse = false; 70 | this.supportsCRaC = false; 71 | this.modules = new ArrayList<>(); 72 | this.releaseDate = Optional.empty(); 73 | this.endOfLifeDate = Optional.empty(); 74 | } 75 | 76 | 77 | public String getName() { return name; } 78 | 79 | public String getApiString() { return apiString; } 80 | 81 | public String getVersion() { return version; } 82 | 83 | public String getJdkMajorVersion() { return jdkMajorVersion; } 84 | 85 | public String getOperatingSystem() { return operatingSystem; } 86 | 87 | public String getArchitecture() { return architecture; } 88 | 89 | public Boolean getFxBundled() { return fxBundled; } 90 | 91 | public String getLocation() { return location; } 92 | 93 | public Feature getFeature() { return feature; } 94 | 95 | public BuildScope getBuildScope() { return buildScope; } 96 | 97 | public VersionNumber getVersionNumber() { return versionNumber; } 98 | 99 | public boolean isHandledBySdkman() { return handledBySdkman; } 100 | 101 | public String getPath() { return path; } 102 | 103 | public boolean isInUse() { return inUse; } 104 | public void setInUse(final boolean inUse) { this.inUse = inUse; } 105 | 106 | public boolean supportsCRaC() { return this.supportsCRaC; } 107 | public void setSupportsCRaC(final boolean supportsCRaC) { this.supportsCRaC = supportsCRaC; } 108 | 109 | public long getSize() { 110 | long size; 111 | try { 112 | size = Helper.getFolderSize(getPath()); 113 | } catch (IOException e) { 114 | size = -1; 115 | } 116 | return size; 117 | } 118 | 119 | public List getModules() { return modules; } 120 | public void setModules(final List modules) { 121 | this.modules.clear(); 122 | this.modules.addAll(modules); 123 | } 124 | 125 | public Optional getReleaseDate() { return this.releaseDate; } 126 | public void setReleaseDate(final LocalDateTime releaseDate) { this.releaseDate = Optional.of(releaseDate); } 127 | 128 | public Optional getEndOfLifeDate() { return this.endOfLifeDate; } 129 | public void setEndOfLifeDate(final LocalDateTime endOfLifeDate) { this.endOfLifeDate = Optional.of(endOfLifeDate); } 130 | 131 | public String getModulesText(final boolean includeModules) { 132 | if (getVersionNumber().getFeature().isPresent()) { 133 | if (getVersionNumber().getFeature().getAsInt() < 9) { return "(No modular JDK)"; } 134 | } 135 | if (this.modules.isEmpty()) { return "No modules found"; } 136 | StringBuilder msgBuilder = new StringBuilder(); 137 | msgBuilder.append(this.modules.size()).append(" modules"); 138 | if (this.modules.size() <= 45) { 139 | msgBuilder.append(" (Probably JLink JRE)"); 140 | } else if (this.modules.size() < 60) { 141 | msgBuilder.append(" (Probably JRE)"); 142 | } 143 | if (includeModules) { 144 | msgBuilder.append(NEW_LINE); 145 | for (int i = 0; i < modules.size(); i++) { 146 | msgBuilder.append(modules.get(i)).append(COMMA); 147 | if (i > 4 && i % 5 == 0) { msgBuilder.append(NEW_LINE); } 148 | } 149 | msgBuilder.setLength(msgBuilder.length() - 1); 150 | } 151 | return msgBuilder.toString(); 152 | } 153 | 154 | @Override public String toString() { 155 | return new StringBuilder().append("{") 156 | .append("\"name\":\"").append(getName()).append("\",") 157 | .append("\"api_string\":\"").append(getApiString()).append("\",") 158 | .append("\"version\":\"").append(getVersion()).append("\",") 159 | .append("\"operating_system\":\"").append(getOperatingSystem()).append("\",") 160 | .append("\"architecture\":\"").append(getArchitecture()).append("\",") 161 | .append("\"fx\":\"").append(getFxBundled()).append("\",") 162 | .append("\"location\":\"").append(getLocation()).append("\",") 163 | .append("\"feature\":\"").append(getFeature()).append("\",") 164 | .append("\"handled_by_sdkman\":").append(isHandledBySdkman()).append(",") 165 | .append("\"path\":\"").append(path).append("\",") 166 | .append("\"in_use\":").append(isInUse()).append(",") 167 | .append("\"supports_crac\":").append(supportsCRaC()).append(",") 168 | .append("\"modules\":\"").append(getModulesText(true)).append("\"") 169 | .append("}") 170 | .toString(); 171 | } 172 | 173 | @Override public boolean equals(final Object obj) { 174 | if (!(obj instanceof Distro)) { return false; } 175 | Distro distribution = (Distro) obj; 176 | return (distribution.getApiString().equals(distribution.getApiString()) && 177 | distribution.getVersion().equals(getVersion()) && 178 | distribution.getFxBundled() == fxBundled && 179 | distribution.supportsCRaC() == supportsCRaC); 180 | } 181 | 182 | @Override public int hashCode() { 183 | int hash = 7; 184 | hash = 31 * hash + (null == name ? 0 : name.hashCode()); 185 | hash = 31 * hash + (null == version ? 0 : version.hashCode()); 186 | return hash; 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original 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 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s 90 | ' "$PWD" ) || exit 91 | 92 | # Use the maximum available, or set MAX_FD != -1 to use that value. 93 | MAX_FD=maximum 94 | 95 | warn () { 96 | echo "$*" 97 | } >&2 98 | 99 | die () { 100 | echo 101 | echo "$*" 102 | echo 103 | exit 1 104 | } >&2 105 | 106 | # OS specific support (must be 'true' or 'false'). 107 | cygwin=false 108 | msys=false 109 | darwin=false 110 | nonstop=false 111 | case "$( uname )" in #( 112 | CYGWIN* ) cygwin=true ;; #( 113 | Darwin* ) darwin=true ;; #( 114 | MSYS* | MINGW* ) msys=true ;; #( 115 | NONSTOP* ) nonstop=true ;; 116 | esac 117 | 118 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 119 | 120 | 121 | # Determine the Java command to use to start the JVM. 122 | if [ -n "$JAVA_HOME" ] ; then 123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 124 | # IBM's JDK on AIX uses strange locations for the executables 125 | JAVACMD=$JAVA_HOME/jre/sh/java 126 | else 127 | JAVACMD=$JAVA_HOME/bin/java 128 | fi 129 | if [ ! -x "$JAVACMD" ] ; then 130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 131 | 132 | Please set the JAVA_HOME variable in your environment to match the 133 | location of your Java installation." 134 | fi 135 | else 136 | JAVACMD=java 137 | if ! command -v java >/dev/null 2>&1 138 | then 139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 140 | 141 | Please set the JAVA_HOME variable in your environment to match the 142 | location of your Java installation." 143 | fi 144 | fi 145 | 146 | # Increase the maximum file descriptors if we can. 147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 148 | case $MAX_FD in #( 149 | max*) 150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 151 | # shellcheck disable=SC2039,SC3045 152 | MAX_FD=$( ulimit -H -n ) || 153 | warn "Could not query maximum file descriptor limit" 154 | esac 155 | case $MAX_FD in #( 156 | '' | soft) :;; #( 157 | *) 158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 159 | # shellcheck disable=SC2039,SC3045 160 | ulimit -n "$MAX_FD" || 161 | warn "Could not set maximum file descriptor limit to $MAX_FD" 162 | esac 163 | fi 164 | 165 | # Collect all arguments for the java command, stacking in reverse order: 166 | # * args from the command line 167 | # * the main class name 168 | # * -classpath 169 | # * -D...appname settings 170 | # * --module-path (only if needed) 171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 172 | 173 | # For Cygwin or MSYS, switch paths to Windows format before running java 174 | if "$cygwin" || "$msys" ; then 175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 177 | 178 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 179 | 180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 181 | for arg do 182 | if 183 | case $arg in #( 184 | -*) false ;; # don't mess with options #( 185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 186 | [ -e "$t" ] ;; #( 187 | *) false ;; 188 | esac 189 | then 190 | arg=$( cygpath --path --ignore --mixed "$arg" ) 191 | fi 192 | # Roll the args list around exactly as many times as the number of 193 | # args, so each arg winds up back in the position where it started, but 194 | # possibly modified. 195 | # 196 | # NB: a `for` loop captures its iteration list before it begins, so 197 | # changing the positional parameters here affects neither the number of 198 | # iterations, nor the values presented in `arg`. 199 | shift # remove old arg 200 | set -- "$@" "$arg" # push replacement arg 201 | done 202 | fi 203 | 204 | 205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 207 | 208 | # Collect all arguments for the java command: 209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 210 | # and any embedded shellness will be escaped. 211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 212 | # treated as '${Hostname}' itself on the command line. 213 | 214 | set -- \ 215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 216 | -classpath "$CLASSPATH" \ 217 | org.gradle.wrapper.GradleWrapperMain \ 218 | "$@" 219 | 220 | # Stop when "xargs" is not available. 221 | if ! command -v xargs >/dev/null 2>&1 222 | then 223 | die "xargs is not available" 224 | fi 225 | 226 | # Use "xargs" to parse quoted args. 227 | # 228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 229 | # 230 | # In Bash we could simply go: 231 | # 232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 233 | # set -- "${ARGS[@]}" "$@" 234 | # 235 | # but POSIX shell has neither arrays nor command substitution, so instead we 236 | # post-process each arg (as a line of input to sed) to backslash-escape any 237 | # character that might be a shell metacharacter, then use eval to reverse 238 | # that process (while maintaining the separation between arguments), and wrap 239 | # the whole thing up as a single "set" statement. 240 | # 241 | # This will of course break if any of these variables contains a newline or 242 | # an unmatched quote. 243 | # 244 | 245 | eval "set -- $( 246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 247 | xargs -n1 | 248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 249 | tr '\n' ' ' 250 | )" '"$@"' 251 | 252 | exec "$JAVACMD" "$@" 253 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/controls/MacosWindowButton.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.controls; 18 | 19 | import javafx.beans.DefaultProperty; 20 | import javafx.beans.property.BooleanProperty; 21 | import javafx.beans.property.BooleanPropertyBase; 22 | import javafx.beans.property.ObjectProperty; 23 | import javafx.beans.property.ObjectPropertyBase; 24 | import javafx.collections.ObservableList; 25 | import javafx.css.PseudoClass; 26 | import javafx.scene.Node; 27 | import javafx.scene.input.MouseEvent; 28 | import javafx.scene.layout.Region; 29 | import javafx.scene.shape.Circle; 30 | import javafx.scene.shape.StrokeType; 31 | 32 | import java.util.function.Consumer; 33 | 34 | 35 | @DefaultProperty("children") 36 | public class MacosWindowButton extends Region implements WindowButton { 37 | private static final double MINIMUM_WIDTH = WindowButtonSize.SMALL.px; 38 | private static final double MINIMUM_HEIGHT = WindowButtonSize.SMALL.px; 39 | private static final double MAXIMUM_WIDTH = WindowButtonSize.NORMAL.px; 40 | private static final double MAXIMUM_HEIGHT = WindowButtonSize.NORMAL.px; 41 | private static final PseudoClass CLOSE_PSEUDO_CLASS = PseudoClass.getPseudoClass("close"); 42 | private static final PseudoClass MINIMIZE_PSEUDO_CLASS = PseudoClass.getPseudoClass("minimize"); 43 | private static final PseudoClass ZOOM_PSEUDO_CLASS = PseudoClass.getPseudoClass("zoom"); 44 | private static final PseudoClass HOVERED_PSEUDO_CLASS = PseudoClass.getPseudoClass("hovered"); 45 | private static final PseudoClass PRESSED_PSEUDO_CLASS = PseudoClass.getPseudoClass("pressed"); 46 | private static final PseudoClass DARK_MODE_PSEUDO_CLASS = PseudoClass.getPseudoClass("dark"); 47 | private WindowButtonSize iconSize; 48 | private BooleanProperty darkMode; 49 | private BooleanProperty hovered; 50 | private static String userAgentStyleSheet; 51 | private ObjectProperty type; 52 | private double size; 53 | private double width; 54 | private double height; 55 | private Circle circle; 56 | private Region symbol; 57 | private Consumer mousePressedConsumer; 58 | private Consumer mouseReleasedConsumer; 59 | 60 | 61 | // ******************** Constructors ************************************** 62 | public MacosWindowButton() { 63 | this(WindowButtonType.CLOSE); 64 | } 65 | public MacosWindowButton(final WindowButtonType type) { 66 | this(type, WindowButtonSize.NORMAL); 67 | } 68 | public MacosWindowButton(final WindowButtonType type, final WindowButtonSize size) { 69 | this.type = new ObjectPropertyBase<>(type) { 70 | @Override protected void invalidated() { 71 | switch(get()) { 72 | case CLOSE -> { 73 | pseudoClassStateChanged(CLOSE_PSEUDO_CLASS, true); 74 | pseudoClassStateChanged(MINIMIZE_PSEUDO_CLASS, false); 75 | pseudoClassStateChanged(ZOOM_PSEUDO_CLASS, false); 76 | } 77 | case MINIMIZE -> { 78 | pseudoClassStateChanged(CLOSE_PSEUDO_CLASS, false); 79 | pseudoClassStateChanged(MINIMIZE_PSEUDO_CLASS, true); 80 | pseudoClassStateChanged(ZOOM_PSEUDO_CLASS, false); 81 | } 82 | case ZOOM -> { 83 | pseudoClassStateChanged(CLOSE_PSEUDO_CLASS, false); 84 | pseudoClassStateChanged(MINIMIZE_PSEUDO_CLASS, false); 85 | pseudoClassStateChanged(ZOOM_PSEUDO_CLASS, true); 86 | } 87 | } 88 | } 89 | @Override public Object getBean() { return MacosWindowButton.this; } 90 | @Override public String getName() { return "type"; } 91 | }; 92 | this.darkMode = new BooleanPropertyBase(false) { 93 | @Override protected void invalidated() { pseudoClassStateChanged(DARK_MODE_PSEUDO_CLASS, get()); } 94 | @Override public Object getBean() { return MacosWindowButton.this; } 95 | @Override public String getName() { return "darkMode"; } 96 | }; 97 | this.hovered = new BooleanPropertyBase() { 98 | @Override protected void invalidated() { pseudoClassStateChanged(HOVERED_PSEUDO_CLASS, get()); } 99 | @Override public Object getBean() { return MacosWindowButton.this; } 100 | @Override public String getName() { return "hovered"; } 101 | }; 102 | this.iconSize = size; 103 | 104 | pseudoClassStateChanged(CLOSE_PSEUDO_CLASS, WindowButtonType.CLOSE == type); 105 | pseudoClassStateChanged(MINIMIZE_PSEUDO_CLASS, WindowButtonType.MINIMIZE == type); 106 | pseudoClassStateChanged(ZOOM_PSEUDO_CLASS, WindowButtonType.ZOOM == type); 107 | 108 | initGraphics(); 109 | registerListeners(); 110 | } 111 | 112 | 113 | // ******************** Initialization ************************************ 114 | private void initGraphics() { 115 | if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 || 116 | Double.compare(getHeight(), 0.0) <= 0) { 117 | if (getPrefWidth() > 0 && getPrefHeight() > 0) { 118 | setPrefSize(getPrefWidth(), getPrefHeight()); 119 | } else { 120 | setPrefSize(iconSize.px, iconSize.px); 121 | } 122 | } 123 | 124 | getStyleClass().add("macos-window-button"); 125 | 126 | circle = new Circle(); 127 | circle.getStyleClass().add("circle"); 128 | circle.setStrokeType(StrokeType.INSIDE); 129 | 130 | symbol = new Region(); 131 | symbol.getStyleClass().add(WindowButtonSize.NORMAL == iconSize ? "symbol" : "symbol-small"); 132 | 133 | getChildren().setAll(circle, symbol); 134 | } 135 | 136 | private void registerListeners() { 137 | widthProperty().addListener(o -> resize()); 138 | heightProperty().addListener(o -> resize()); 139 | addEventFilter(MouseEvent.MOUSE_PRESSED, e -> { 140 | pseudoClassStateChanged(PRESSED_PSEUDO_CLASS, true); 141 | if (null == mousePressedConsumer) { return; } 142 | mousePressedConsumer.accept(e); 143 | }); 144 | addEventFilter(MouseEvent.MOUSE_RELEASED, e -> { 145 | pseudoClassStateChanged(PRESSED_PSEUDO_CLASS, false); 146 | if (null == mouseReleasedConsumer) { return; } 147 | mouseReleasedConsumer.accept(e); 148 | }); 149 | } 150 | 151 | 152 | // ******************** Methods ******************************************* 153 | @Override protected double computeMinWidth(final double HEIGHT) { return MINIMUM_WIDTH; } 154 | @Override protected double computeMinHeight(final double WIDTH) { return MINIMUM_HEIGHT; } 155 | @Override protected double computePrefWidth(final double HEIGHT) { return super.computePrefWidth(HEIGHT); } 156 | @Override protected double computePrefHeight(final double WIDTH) { return super.computePrefHeight(WIDTH); } 157 | @Override protected double computeMaxWidth(final double HEIGHT) { return MAXIMUM_WIDTH; } 158 | @Override protected double computeMaxHeight(final double WIDTH) { return MAXIMUM_HEIGHT; } 159 | 160 | @Override public ObservableList getChildren() { return super.getChildren(); } 161 | 162 | public WindowButtonType getType() { return type.get(); } 163 | public void setType(final WindowButtonType type) { this.type.set(type); } 164 | public ObjectProperty typeProperty() { return type; } 165 | 166 | public boolean isDarkMode() { return darkMode.get(); } 167 | public void setDarkMode(final boolean darkMode) { this.darkMode.set(darkMode); } 168 | public BooleanProperty darkModeProperty() { return darkMode; } 169 | 170 | public boolean isHovered() { return hovered.get(); } 171 | public void setHovered(final boolean hovered) { this.hovered.set(hovered); } 172 | public BooleanProperty hoveredProperty() { return hovered; } 173 | 174 | public void setOnMousePressed(final Consumer mousePressedConsumer) { this.mousePressedConsumer = mousePressedConsumer; } 175 | public void setOnMouseReleased(final Consumer mouseReleasedConsumer) { this.mouseReleasedConsumer = mouseReleasedConsumer; } 176 | 177 | 178 | // ******************** Layout ******************************************** 179 | private void resize() { 180 | width = getWidth() - getInsets().getLeft() - getInsets().getRight(); 181 | height = getHeight() - getInsets().getTop() - getInsets().getBottom(); 182 | size = width < height ? width : height; 183 | 184 | 185 | if (width > 0 && height > 0) { 186 | setMinSize(size, size); 187 | setMaxSize(size, size); 188 | setPrefSize(size, size); 189 | 190 | double center = size * 0.5; 191 | circle.setRadius(center); 192 | circle.setCenterX(center); 193 | circle.setCenterY(center); 194 | 195 | symbol.setPrefSize(size, size); 196 | } 197 | } 198 | 199 | @Override public String getUserAgentStylesheet() { 200 | if (null == userAgentStyleSheet) { userAgentStyleSheet = MacosWindowButton.class.getResource("macos-window-button.css").toExternalForm(); } 201 | return userAgentStyleSheet; 202 | } 203 | } 204 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/MinimizedPkg.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import com.google.gson.Gson; 20 | import com.google.gson.JsonObject; 21 | import eu.hansolo.jdktools.Architecture; 22 | import eu.hansolo.jdktools.ArchiveType; 23 | import eu.hansolo.jdktools.LibCType; 24 | import eu.hansolo.jdktools.OperatingSystem; 25 | import eu.hansolo.jdktools.PackageType; 26 | import eu.hansolo.jdktools.ReleaseStatus; 27 | import eu.hansolo.jdktools.Verification; 28 | import eu.hansolo.jdktools.versioning.Semver; 29 | import io.foojay.api.discoclient.DiscoClient; 30 | import io.foojay.api.discoclient.pkg.Distribution; 31 | import io.foojay.api.discoclient.pkg.MajorVersion; 32 | import io.foojay.api.discoclient.pkg.Pkg; 33 | 34 | import static eu.hansolo.jdktools.Constants.COLON; 35 | import static eu.hansolo.jdktools.Constants.COMMA; 36 | import static eu.hansolo.jdktools.Constants.CURLY_BRACKET_CLOSE; 37 | import static eu.hansolo.jdktools.Constants.CURLY_BRACKET_OPEN; 38 | import static eu.hansolo.jdktools.Constants.QUOTES; 39 | 40 | 41 | public class MinimizedPkg { 42 | private String id; 43 | private ArchiveType archiveType; 44 | private Distribution distribution; 45 | private MajorVersion majorVersion; 46 | private Semver javaVersion; 47 | private ReleaseStatus releaseStatus; 48 | private OperatingSystem operatingSystem; 49 | private LibCType libCType; 50 | private Architecture architecture; 51 | private PackageType packageType; 52 | private boolean javafxBundled; 53 | private boolean directlyDownloadable; 54 | private String filename; 55 | private boolean freeToUseInProduction; 56 | private Verification tckTested; 57 | private String tckCertUri; 58 | private Verification aqavitCertified; 59 | private String aqavitCertUri; 60 | 61 | 62 | public MinimizedPkg(final String jsonText) { 63 | if (null == jsonText || jsonText.isEmpty()) { throw new IllegalArgumentException("Json text cannot be null or empty"); } 64 | final Gson gson = new Gson(); 65 | final JsonObject json = gson.fromJson(jsonText, JsonObject.class); 66 | 67 | this.id = json.get(Pkg.FIELD_ID).getAsString(); 68 | this.distribution = DiscoClient.getDistributionFromText(json.get(Pkg.FIELD_DISTRIBUTION).getAsString()); 69 | if (null == this.distribution) { 70 | throw new IllegalArgumentException("Distribution not found"); 71 | } 72 | this.majorVersion = new MajorVersion(json.get(Pkg.FIELD_MAJOR_VERSION).getAsInt()); 73 | this.javaVersion = Semver.fromText(json.get(Pkg.FIELD_JAVA_VERSION).getAsString()).getSemver1(); 74 | this.architecture = Architecture.fromText(json.get(Pkg.FIELD_ARCHITECTURE).getAsString()); 75 | this.operatingSystem = OperatingSystem.fromText(json.get(Pkg.FIELD_OPERATING_SYSTEM).getAsString()); 76 | this.libCType = json.has(Pkg.FIELD_LIB_C_TYPE) ? LibCType.fromText(json.get(Pkg.FIELD_LIB_C_TYPE).getAsString()) : this.operatingSystem.getLibCType(); 77 | this.packageType = PackageType.fromText(json.get(Pkg.FIELD_PACKAGE_TYPE).getAsString()); 78 | this.releaseStatus = ReleaseStatus.fromText(json.get(Pkg.FIELD_RELEASE_STATUS).getAsString()); 79 | this.archiveType = ArchiveType.fromText(json.get(Pkg.FIELD_ARCHIVE_TYPE).getAsString()); 80 | this.javafxBundled = json.get(Pkg.FIELD_JAVAFX_BUNDLED).getAsBoolean(); 81 | this.directlyDownloadable = json.get(Pkg.FIELD_DIRECTLY_DOWNLOADABLE).getAsBoolean(); 82 | this.filename = json.get(Pkg.FIELD_FILENAME).getAsString(); 83 | this.freeToUseInProduction = json.get(Pkg.FIELD_FREE_USE_IN_PROD).getAsBoolean(); 84 | this.tckTested = json.has(Pkg.FIELD_TCK_TESTED) ? Verification.fromText(json.get(Pkg.FIELD_TCK_TESTED).getAsString()) : Verification.UNKNOWN; 85 | this.tckCertUri = json.has(Pkg.FIELD_TCK_CERT_URI) ? json.get(Pkg.FIELD_TCK_CERT_URI).getAsString() : ""; 86 | this.aqavitCertified = json.has(Pkg.FIELD_AQAVIT_CERTIFIED) ? Verification.fromText(json.get(Pkg.FIELD_AQAVIT_CERTIFIED).getAsString()) : Verification.UNKNOWN; 87 | this.aqavitCertUri = json.has(Pkg.FIELD_AQAVIT_CERT_URI) ? json.get(Pkg.FIELD_AQAVIT_CERT_URI).getAsString() : ""; 88 | } 89 | public MinimizedPkg(final String id, final ArchiveType archiveType, final Distribution distribution, final MajorVersion majorVersion, final Semver javaVersion, 90 | final ReleaseStatus releaseStatus, final OperatingSystem operatingSystem, final Architecture architecture, final LibCType libCType, final PackageType packageType, 91 | final boolean javafxBundled, final boolean directlyDownloadable, final String filename, final boolean freeToUseInProduction, final Verification tckTested, 92 | final String tckCertUri, final Verification aqavitCertified, final String aqavitCertUri) { 93 | this.id = id; 94 | this.archiveType = archiveType; 95 | this.distribution = distribution; 96 | this.majorVersion = majorVersion; 97 | this.javaVersion = javaVersion; 98 | this.releaseStatus = releaseStatus; 99 | this.operatingSystem = operatingSystem; 100 | this.architecture = architecture; 101 | this.libCType = libCType; 102 | this.packageType = packageType; 103 | this.javafxBundled = javafxBundled; 104 | this.directlyDownloadable = directlyDownloadable; 105 | this.filename = filename; 106 | this.freeToUseInProduction = freeToUseInProduction; 107 | this.tckTested = tckTested; 108 | this.tckCertUri = tckCertUri; 109 | this.aqavitCertified = aqavitCertified; 110 | this.aqavitCertUri = aqavitCertUri; 111 | } 112 | 113 | public String getId() { return id; } 114 | 115 | public ArchiveType getArchiveType() { return archiveType; } 116 | 117 | public Distribution getDistribution() { return distribution; } 118 | 119 | public MajorVersion getMajorVersion() { return majorVersion; } 120 | 121 | public Semver getJavaVersion() { return javaVersion; } 122 | 123 | public ReleaseStatus getReleaseStatus() { return releaseStatus; } 124 | 125 | public OperatingSystem getOperatingSystem() { return operatingSystem; } 126 | 127 | public LibCType getLibCType() { return libCType; } 128 | 129 | public Architecture getArchitecture() { return architecture; } 130 | 131 | public PackageType getPackageType() { return packageType; } 132 | 133 | public boolean isJavaFXBundled() { return javafxBundled; } 134 | 135 | public boolean isDirectlyDownloadable() { return directlyDownloadable; } 136 | 137 | public String getFilename() { return filename; } 138 | 139 | public boolean isFreeToUseInProduction() { return freeToUseInProduction; } 140 | 141 | public Verification getTckTested() { return tckTested; } 142 | 143 | public String getTckCertUri() { return tckCertUri; } 144 | 145 | public Verification getAqavitCertified() { return aqavitCertified; } 146 | 147 | public String getAqavitCertUri() { return aqavitCertUri; } 148 | 149 | @Override public String toString() { 150 | return new StringBuilder().append(CURLY_BRACKET_OPEN) 151 | .append(QUOTES).append(Pkg.FIELD_ID).append(QUOTES).append(COLON).append(QUOTES).append(getId()).append(QUOTES).append(COMMA) 152 | .append(QUOTES).append(Pkg.FIELD_DISTRIBUTION).append(QUOTES).append(COLON).append(QUOTES).append(distribution.getName()).append(QUOTES).append(COMMA) 153 | .append(QUOTES).append(Pkg.FIELD_JAVA_VERSION).append(QUOTES).append(COLON).append(QUOTES).append(javaVersion.toString()).append(QUOTES).append(COMMA) 154 | .append(QUOTES).append(Pkg.FIELD_ARCHITECTURE).append(QUOTES).append(COLON).append(QUOTES).append(architecture.name()).append(QUOTES).append(COMMA) 155 | .append(QUOTES).append(Pkg.FIELD_OPERATING_SYSTEM).append(QUOTES).append(COLON).append(QUOTES).append(operatingSystem.name()).append(QUOTES).append(COMMA) 156 | .append(QUOTES).append(Pkg.FIELD_PACKAGE_TYPE).append(QUOTES).append(COLON).append(QUOTES).append(packageType.name()).append(QUOTES).append(COMMA) 157 | .append(QUOTES).append(Pkg.FIELD_RELEASE_STATUS).append(QUOTES).append(COLON).append(QUOTES).append(releaseStatus.name()).append(QUOTES).append(COMMA) 158 | .append(QUOTES).append(Pkg.FIELD_ARCHIVE_TYPE).append(QUOTES).append(COLON).append(QUOTES).append(archiveType.getUiString()).append(QUOTES).append(COMMA) 159 | .append(QUOTES).append(Pkg.FIELD_JAVAFX_BUNDLED).append(QUOTES).append(COLON).append(javafxBundled).append(COMMA) 160 | .append(QUOTES).append(Pkg.FIELD_FILENAME).append(QUOTES).append(COLON).append(QUOTES).append(filename).append(QUOTES).append(COMMA) 161 | .append(QUOTES).append(Pkg.FIELD_FREE_USE_IN_PROD).append(QUOTES).append(COLON).append(freeToUseInProduction).append(COMMA) 162 | .append(QUOTES).append(Pkg.FIELD_TCK_TESTED).append(QUOTES).append(COLON).append(QUOTES).append(tckTested.getApiString()).append(QUOTES).append(COMMA) 163 | .append(QUOTES).append(Pkg.FIELD_TCK_CERT_URI).append(QUOTES).append(COLON).append(QUOTES).append(tckCertUri).append(QUOTES).append(COMMA) 164 | .append(QUOTES).append(Pkg.FIELD_AQAVIT_CERTIFIED).append(QUOTES).append(COLON).append(QUOTES).append(aqavitCertified.getApiString()).append(QUOTES).append(COMMA) 165 | .append(QUOTES).append(Pkg.FIELD_AQAVIT_CERT_URI).append(QUOTES).append(COLON).append(QUOTES).append(aqavitCertUri).append(QUOTES) 166 | .append(CURLY_BRACKET_CLOSE) 167 | .toString(); 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/controls/WinWindowButton.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.controls; 18 | 19 | import javafx.beans.DefaultProperty; 20 | import javafx.beans.property.BooleanProperty; 21 | import javafx.beans.property.BooleanPropertyBase; 22 | import javafx.beans.property.ObjectProperty; 23 | import javafx.beans.property.ObjectPropertyBase; 24 | import javafx.collections.ObservableList; 25 | import javafx.css.PseudoClass; 26 | import javafx.geometry.Insets; 27 | import javafx.scene.Node; 28 | import javafx.scene.input.MouseEvent; 29 | import javafx.scene.layout.AnchorPane; 30 | import javafx.scene.layout.Region; 31 | import javafx.scene.layout.StackPane; 32 | import javafx.scene.shape.Circle; 33 | import javafx.scene.shape.Rectangle; 34 | import javafx.scene.shape.StrokeType; 35 | 36 | import java.util.function.Consumer; 37 | 38 | import static eu.hansolo.fx.jdkmon.controls.WindowButtonSize.NORMAL; 39 | 40 | 41 | @DefaultProperty("children") 42 | public class WinWindowButton extends Region implements WindowButton { 43 | private static final double MINIMUM_WIDTH = WindowButtonSize.SMALL.px; 44 | private static final double MINIMUM_HEIGHT = WindowButtonSize.SMALL.px; 45 | private static final double MAXIMUM_WIDTH = WindowButtonSize.SMALL.px; 46 | private static final double MAXIMUM_HEIGHT = WindowButtonSize.SMALL.px; 47 | private static final PseudoClass CLOSE_PSEUDO_CLASS = PseudoClass.getPseudoClass("close"); 48 | private static final PseudoClass MINIMIZE_PSEUDO_CLASS = PseudoClass.getPseudoClass("minimize"); 49 | private static final PseudoClass ZOOM_PSEUDO_CLASS = PseudoClass.getPseudoClass("zoom"); 50 | private static final PseudoClass HOVERED_PSEUDO_CLASS = PseudoClass.getPseudoClass("hovered"); 51 | private static final PseudoClass PRESSED_PSEUDO_CLASS = PseudoClass.getPseudoClass("pressed"); 52 | private static final PseudoClass DARK_MODE_PSEUDO_CLASS = PseudoClass.getPseudoClass("dark"); 53 | private WindowButtonSize iconSize; 54 | private BooleanProperty darkMode; 55 | private BooleanProperty hovered; 56 | private static String userAgentStyleSheet; 57 | private ObjectProperty type; 58 | private double size; 59 | private double width; 60 | private double height; 61 | private Rectangle rectangle; 62 | private Region symbol; 63 | private Consumer mousePressedConsumer; 64 | private Consumer mouseReleasedConsumer; 65 | 66 | 67 | // ******************** Constructors ************************************** 68 | public WinWindowButton() { 69 | this(WindowButtonType.CLOSE); 70 | } 71 | public WinWindowButton(final WindowButtonType type) { 72 | this(type, WindowButtonSize.SMALL); 73 | } 74 | public WinWindowButton(final WindowButtonType type, final WindowButtonSize size) { 75 | this.type = new ObjectPropertyBase<>(type) { 76 | @Override protected void invalidated() { 77 | switch(get()) { 78 | case CLOSE -> { 79 | pseudoClassStateChanged(CLOSE_PSEUDO_CLASS, true); 80 | pseudoClassStateChanged(MINIMIZE_PSEUDO_CLASS, false); 81 | pseudoClassStateChanged(ZOOM_PSEUDO_CLASS, false); 82 | } 83 | case MINIMIZE -> { 84 | pseudoClassStateChanged(CLOSE_PSEUDO_CLASS, false); 85 | pseudoClassStateChanged(MINIMIZE_PSEUDO_CLASS, true); 86 | pseudoClassStateChanged(ZOOM_PSEUDO_CLASS, false); 87 | } 88 | case ZOOM -> { 89 | pseudoClassStateChanged(CLOSE_PSEUDO_CLASS, false); 90 | pseudoClassStateChanged(MINIMIZE_PSEUDO_CLASS, false); 91 | pseudoClassStateChanged(ZOOM_PSEUDO_CLASS, true); 92 | } 93 | } 94 | } 95 | @Override public Object getBean() { return WinWindowButton.this; } 96 | @Override public String getName() { return "type"; } 97 | }; 98 | this.darkMode = new BooleanPropertyBase(false) { 99 | @Override protected void invalidated() { pseudoClassStateChanged(DARK_MODE_PSEUDO_CLASS, get()); } 100 | @Override public Object getBean() { return WinWindowButton.this; } 101 | @Override public String getName() { return "darkMode"; } 102 | }; 103 | this.hovered = new BooleanPropertyBase() { 104 | @Override protected void invalidated() { pseudoClassStateChanged(HOVERED_PSEUDO_CLASS, get()); } 105 | @Override public Object getBean() { return WinWindowButton.this; } 106 | @Override public String getName() { return "hovered"; } 107 | }; 108 | this.iconSize = size; 109 | 110 | pseudoClassStateChanged(CLOSE_PSEUDO_CLASS, WindowButtonType.CLOSE == type); 111 | pseudoClassStateChanged(MINIMIZE_PSEUDO_CLASS, WindowButtonType.MINIMIZE == type); 112 | pseudoClassStateChanged(ZOOM_PSEUDO_CLASS, WindowButtonType.ZOOM == type); 113 | 114 | initGraphics(); 115 | registerListeners(); 116 | } 117 | 118 | 119 | // ******************** Initialization ************************************ 120 | private void initGraphics() { 121 | if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 || 122 | Double.compare(getHeight(), 0.0) <= 0) { 123 | if (getPrefWidth() > 0 && getPrefHeight() > 0) { 124 | setPrefSize(getPrefWidth(), getPrefHeight()); 125 | } else { 126 | setPrefSize(iconSize.px, iconSize.px); 127 | } 128 | } 129 | 130 | getStyleClass().add("win-window-button"); 131 | 132 | rectangle = new Rectangle(); 133 | rectangle.getStyleClass().add("rect"); 134 | rectangle.setStrokeType(StrokeType.INSIDE); 135 | 136 | symbol = new Region(); 137 | symbol.getStyleClass().add("symbol"); 138 | 139 | getChildren().setAll(rectangle, symbol); 140 | } 141 | 142 | private void registerListeners() { 143 | widthProperty().addListener(o -> resize()); 144 | heightProperty().addListener(o -> resize()); 145 | addEventFilter(MouseEvent.MOUSE_PRESSED, e -> { 146 | pseudoClassStateChanged(PRESSED_PSEUDO_CLASS, true); 147 | if (null == mousePressedConsumer) { return; } 148 | mousePressedConsumer.accept(e); 149 | }); 150 | addEventFilter(MouseEvent.MOUSE_RELEASED, e -> { 151 | pseudoClassStateChanged(PRESSED_PSEUDO_CLASS, false); 152 | if (null == mouseReleasedConsumer) { return; } 153 | mouseReleasedConsumer.accept(e); 154 | }); 155 | } 156 | 157 | 158 | // ******************** Methods ******************************************* 159 | @Override protected double computeMinWidth(final double HEIGHT) { return MINIMUM_WIDTH; } 160 | @Override protected double computeMinHeight(final double WIDTH) { return MINIMUM_HEIGHT; } 161 | @Override protected double computePrefWidth(final double HEIGHT) { return super.computePrefWidth(HEIGHT); } 162 | @Override protected double computePrefHeight(final double WIDTH) { return super.computePrefHeight(WIDTH); } 163 | @Override protected double computeMaxWidth(final double HEIGHT) { return MAXIMUM_WIDTH; } 164 | @Override protected double computeMaxHeight(final double WIDTH) { return MAXIMUM_HEIGHT; } 165 | 166 | @Override public ObservableList getChildren() { return super.getChildren(); } 167 | 168 | public WindowButtonType getType() { return type.get(); } 169 | public void setType(final WindowButtonType type) { this.type.set(type); } 170 | public ObjectProperty typeProperty() { return type; } 171 | 172 | public boolean isDarkMode() { return darkMode.get(); } 173 | public void setDarkMode(final boolean darkMode) { this.darkMode.set(darkMode); } 174 | public BooleanProperty darkModeProperty() { return darkMode; } 175 | 176 | public boolean isHovered() { return hovered.get(); } 177 | public void setHovered(final boolean hovered) { this.hovered.set(hovered); } 178 | public BooleanProperty hoveredProperty() { return hovered; } 179 | 180 | public void setOnMousePressed(final Consumer mousePressedConsumer) { this.mousePressedConsumer = mousePressedConsumer; } 181 | public void setOnMouseReleased(final Consumer mouseReleasedConsumer) { this.mouseReleasedConsumer = mouseReleasedConsumer; } 182 | 183 | 184 | // ******************** Layout ******************************************** 185 | private void resize() { 186 | width = getWidth() - getInsets().getLeft() - getInsets().getRight(); 187 | height = getHeight() - getInsets().getTop() - getInsets().getBottom(); 188 | size = width < height ? width : height; 189 | 190 | 191 | if (width > 0 && height > 0) { 192 | setMaxSize(46, 31); 193 | setPrefSize(46, 31); 194 | 195 | rectangle.setWidth(46); 196 | rectangle.setHeight(31); 197 | 198 | symbol.setPrefSize(iconSize.px, iconSize.px); 199 | symbol.setMinSize(iconSize.px, iconSize.px); 200 | symbol.setMaxSize(iconSize.px, iconSize.px); 201 | symbol.setLayoutX((rectangle.getWidth() - iconSize.px) * 0.5); 202 | symbol.setLayoutY((rectangle.getHeight() - iconSize.px) * 0.5); 203 | } 204 | } 205 | 206 | @Override public String getUserAgentStylesheet() { 207 | if (null == userAgentStyleSheet) { userAgentStyleSheet = WinWindowButton.class.getResource("win-window-button.css").toExternalForm(); } 208 | return userAgentStyleSheet; 209 | } 210 | } 211 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/jdkmon/tools/PropertyManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.jdkmon.tools; 18 | 19 | import eu.hansolo.fx.jdkmon.Main; 20 | import eu.hansolo.jdktools.OperatingSystem; 21 | import eu.hansolo.jdktools.util.Helper; 22 | import eu.hansolo.jdktools.versioning.VersionNumber; 23 | import io.foojay.api.discoclient.DiscoClient; 24 | 25 | import java.io.FileInputStream; 26 | import java.io.FileOutputStream; 27 | import java.io.IOException; 28 | import java.io.OutputStream; 29 | import java.nio.file.Files; 30 | import java.nio.file.Path; 31 | import java.nio.file.Paths; 32 | import java.util.Properties; 33 | 34 | 35 | public enum PropertyManager { 36 | INSTANCE; 37 | 38 | public static final String VERSION_PROPERTIES = "version.properties"; 39 | public static final String JDKMON_PROPERTIES = "jdkmon.properties"; 40 | public static final String PROPERTY_VERSION = "version"; 41 | public static final String PROPERTY_SEARCH_PATH = "searchpath"; 42 | public static final String PROPERTY_JAVAFX_SEARCH_PATH = "javafx_searchpath"; 43 | public static final String PROPERTY_REMEMBER_DOWNLOAD_FOLDER = "remember_download_folder"; 44 | public static final String PROPERTY_DOWNLOAD_FOLDER = "download_folder"; 45 | public static final String PROPERTY_DARK_MODE = "dark_mode"; 46 | public static final String PROPERTY_FEATURES = "features"; 47 | public static final String PROPERTY_AUTO_EXTRACT = "autoextract"; 48 | public static final String PROPERTY_SHOW_UNKNOWN_BUILDS = "show_unknown_builds"; 49 | public static final String PROPERTY_SHOW_NOTIFICATIONS = "show_notifications"; 50 | private Properties properties; 51 | private Properties versionProperties; 52 | 53 | 54 | // ******************** Constructors ************************************** 55 | PropertyManager() { 56 | properties = new Properties(); 57 | // Load properties 58 | final String jdkMonPropertiesFilePath = new StringBuilder(Constants.HOME_FOLDER).append(JDKMON_PROPERTIES).toString(); 59 | 60 | // Create properties file if not exists 61 | Path path = Paths.get(jdkMonPropertiesFilePath); 62 | if (!Files.exists(path)) { createProperties(properties); } 63 | 64 | // Load properties file 65 | try (FileInputStream jdkMonPropertiesFile = new FileInputStream(jdkMonPropertiesFilePath)) { 66 | properties.load(jdkMonPropertiesFile); 67 | } catch (IOException ex) { 68 | System.out.println("Error reading jdkmon properties file. " + ex); 69 | } 70 | 71 | // If properties empty, fill with default values 72 | if (properties.isEmpty()) { 73 | createProperties(properties); 74 | } else { 75 | validateProperties(); 76 | } 77 | 78 | // Version number properties 79 | versionProperties = new Properties(); 80 | try { 81 | versionProperties.load(Main.class.getResourceAsStream(VERSION_PROPERTIES)); 82 | } catch (IOException ex) { 83 | System.out.println("Error reading version properties file. " + ex); 84 | } 85 | 86 | } 87 | 88 | 89 | // ******************** Methods ******************************************* 90 | public Properties getProperties() { return properties; } 91 | 92 | public Object get(final String KEY) { return properties.getOrDefault(KEY, ""); } 93 | public void set(final String KEY, final String VALUE) { 94 | properties.setProperty(KEY, VALUE); 95 | storeProperties(); 96 | } 97 | 98 | public String getString(final String key) { return properties.getOrDefault(key, "").toString(); } 99 | public void setString(final String key, final String value) { properties.setProperty(key, value); } 100 | 101 | public double getDouble(final String key) { return getDouble(key, 0); } 102 | public double getDouble(final String key, final double defaultValue) { return Double.parseDouble(properties.getOrDefault(key, Double.toString(defaultValue)).toString()); } 103 | public void setDouble(final String key, final double value) { properties.setProperty(key, Double.toString(value)); } 104 | 105 | public float getFloat(final String key) { return getFloat(key, 0); } 106 | public float getFloat(final String key, final float defaultValue) { return Float.parseFloat(properties.getOrDefault(key, Float.toString(defaultValue)).toString()); } 107 | public void setFloat(final String key, final float value) { properties.setProperty(key, Float.toString(value)); } 108 | 109 | public int getInt(final String key) { return getInt(key, 0); } 110 | public int getInt(final String key, final int defaultValue) { return Integer.parseInt(properties.getOrDefault(key, Integer.toString(defaultValue)).toString()); } 111 | public void setInt(final String key, final int value) { properties.setProperty(key, Integer.toString(value)); } 112 | 113 | public long getLong(final String key) { return getLong(key, 0); } 114 | public long getLong(final String key, final long defaultValue) { return Long.parseLong(properties.getOrDefault(key, Long.toString(defaultValue)).toString()); } 115 | public void setLong(final String key, final long value) { properties.setProperty(key, Long.toString(value)); } 116 | 117 | public boolean getBoolean(final String key) { return getBoolean(key, false); } 118 | public boolean getBoolean(final String key, final boolean defaultValue) { return Boolean.parseBoolean(properties.getOrDefault(key, Boolean.toString(defaultValue)).toString()); } 119 | public void setBoolean(final String key, final boolean value) { properties.setProperty(key, Boolean.toString(value)); } 120 | 121 | public boolean hasKey(final String key) { return properties.containsKey(key); } 122 | 123 | public void storeProperties() { 124 | if (null == properties) { return; } 125 | final String propFilePath = new StringBuilder(Constants.HOME_FOLDER).append(JDKMON_PROPERTIES).toString(); 126 | try (OutputStream output = new FileOutputStream(propFilePath)) { 127 | properties.store(output, null); 128 | } catch (IOException ex) { 129 | ex.printStackTrace(); 130 | } 131 | } 132 | 133 | public void resetSearchPathProperty(final boolean javafx) { 134 | final String propFilePath = new StringBuilder(Constants.HOME_FOLDER).append(JDKMON_PROPERTIES).toString(); 135 | try (OutputStream output = new FileOutputStream(propFilePath)) { 136 | if (javafx) { 137 | properties.put(PROPERTY_JAVAFX_SEARCH_PATH, Constants.HOME_FOLDER); 138 | } else { 139 | final String searchPath = getDefaultSearchPath(); 140 | properties.put(PROPERTY_SEARCH_PATH, searchPath); 141 | } 142 | properties.store(output, null); 143 | } catch (IOException ex) { 144 | ex.printStackTrace(); 145 | } 146 | } 147 | 148 | public VersionNumber getVersionNumber() { 149 | return VersionNumber.fromText(versionProperties.getProperty(PROPERTY_VERSION)); 150 | } 151 | 152 | 153 | // ******************** Properties **************************************** 154 | private String getDefaultSearchPath() { 155 | final OperatingSystem operatingSystem = Helper.getOperatingSystem(); 156 | final String searchPath; 157 | switch(operatingSystem) { 158 | case MACOS -> searchPath = Finder.MACOS_JAVA_INSTALL_PATH; 159 | case WINDOWS -> searchPath = Finder.WINDOWS_JAVA_INSTALL_PATH; 160 | case LINUX, ALPINE_LINUX, LINUX_MUSL -> searchPath = Finder.LINUX_JAVA_INSTALL_PATH; 161 | default -> searchPath = ""; 162 | } 163 | return searchPath; 164 | } 165 | 166 | private void validateProperties() { 167 | if (null == properties) { return; } 168 | boolean storeProperties = false; 169 | if (!properties.containsKey(PROPERTY_SEARCH_PATH)) { properties.put(PROPERTY_SEARCH_PATH, getDefaultSearchPath()); storeProperties = true; } 170 | if (!properties.containsKey(PROPERTY_JAVAFX_SEARCH_PATH)) { properties.put(PROPERTY_JAVAFX_SEARCH_PATH, Constants.HOME_FOLDER); storeProperties = true; } 171 | if (!properties.containsKey(PROPERTY_REMEMBER_DOWNLOAD_FOLDER)) { properties.put(PROPERTY_REMEMBER_DOWNLOAD_FOLDER, "FALSE"); storeProperties = true; } 172 | if (!properties.containsKey(PROPERTY_DOWNLOAD_FOLDER)) { properties.put(PROPERTY_DOWNLOAD_FOLDER, ""); storeProperties = true; } 173 | if (!properties.containsKey(PROPERTY_DARK_MODE)) { properties.put(PROPERTY_DARK_MODE, "FALSE"); storeProperties = true; } 174 | if (!properties.containsKey(PROPERTY_FEATURES)) { properties.put(PROPERTY_FEATURES, Constants.FEATURES); storeProperties = true; } 175 | if (!properties.containsKey(PROPERTY_AUTO_EXTRACT)) { properties.put(PROPERTY_AUTO_EXTRACT, "FALSE"); storeProperties = true; } 176 | if (!properties.containsKey(PROPERTY_SHOW_UNKNOWN_BUILDS)) { properties.put(PROPERTY_SHOW_UNKNOWN_BUILDS, "FALSE"); storeProperties = true; } 177 | if (!properties.containsKey(PROPERTY_SHOW_NOTIFICATIONS)) { properties.put(PROPERTY_SHOW_NOTIFICATIONS, "TRUE"); storeProperties = true; } 178 | if (storeProperties) { storeProperties(); } 179 | } 180 | 181 | private void createProperties(Properties properties) { 182 | final String propFilePath = new StringBuilder(Constants.HOME_FOLDER).append(JDKMON_PROPERTIES).toString(); 183 | try (OutputStream output = new FileOutputStream(propFilePath)) { 184 | final String searchPath = getDefaultSearchPath(); 185 | properties.put(PROPERTY_SEARCH_PATH, searchPath); 186 | properties.put(PROPERTY_JAVAFX_SEARCH_PATH, Constants.HOME_FOLDER); 187 | properties.put(PROPERTY_REMEMBER_DOWNLOAD_FOLDER, "FALSE"); 188 | properties.put(PROPERTY_DOWNLOAD_FOLDER, ""); 189 | properties.put(PROPERTY_DARK_MODE, "FALSE"); 190 | properties.put(PROPERTY_FEATURES, Constants.FEATURES); 191 | properties.put(PROPERTY_AUTO_EXTRACT, "FALSE"); 192 | properties.put(PROPERTY_SHOW_UNKNOWN_BUILDS, "FALSE"); 193 | properties.put(PROPERTY_SHOW_NOTIFICATIONS, "TRUE"); 194 | properties.store(output, null); 195 | } catch (IOException ex) { 196 | ex.printStackTrace(); 197 | } 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JDKMon 2 | 3 | [![GitHub stars](https://badgen.net/github/stars/HanSolo/JDKMon)](https://GitHub.com/HanSolo/JDKMon/stargazers/) 4 | 5 | [![Github all releases](https://img.shields.io/github/downloads/HanSolo/JDKMon/total.svg)](https://GitHub.com/HanSolo/JDKMon/releases/) 6 | 7 | [![JFXCentral](https://img.shields.io/badge/Find_me_on-JFXCentral-blue?logo=googlechrome&logoColor=white)](https://www.jfx-central.com/downloads/jdkmon) 8 | 9 | 10 |
11 | 12 | [JDKMon Home](https://harmoniccode.blogspot.com/p/jdkmon.html) 13 | 14 |
15 | JDKMon is a little tool written in JavaFX that tries to detect all JDK's installed 16 | on your machine and will inform you about new updates and vulnerabilities of each OpenJDK distribution found. 17 | In addition JDKMon is also able to monitor JavaFX SDK versions that are installed on your 18 | machine. 19 | 20 | (On MacOS you need at least version 11.0 to run JDKMon) 21 | 22 | At the moment the following distributions will be identified: 23 | - AdoptOpenJDK 24 | - AdoptOpenJDK J9 25 | - Bi Sheng 26 | - Corretto 27 | - Debian (pkgs not downloadable) 28 | - Dragonwell 29 | - Gluon GraalVM 30 | - GraalVM CE8, CE11, CE16, CE17, CE19, CE20 31 | - GraalVM Community 32 | - GraalVM 33 | - JetBrains 34 | - Kona 35 | - Liberica 36 | - Liberica Native 37 | - Mandrel 38 | - Microsoft 39 | - OJDK Build 40 | - Open Logic 41 | - Oracle (not all pkgs downloadable) 42 | - Oracle OpenJDK 43 | - RedHat (pkgs not downloadable) 44 | - SAP Machine 45 | - Semeru 46 | - Semeru Certified 47 | - Temurin 48 | - Trava 49 | - Zulu 50 | - Zulu Prime 51 | 52 | 53 | In case the distribution found was not identified it will be mentioned in the main window as 54 | "Unknown build of OpenJDK". If you stumble upon this case, please file an [issue](https://github.com/HanSolo/JDKMon/issues) and mention 55 | the distribution incl. version that you are using. 56 | 57 | JDKMon can be build for: 58 | - Windows x64 59 | - MacOS x64 60 | - MacOS aarch64 61 | - Linux x64 62 | - Linux aarch64 63 | 64 | You can always check if you have the latest version install by taking a look at the About window. 65 | This can be opened by selecting ```About``` from the menu. If there is a new version available 66 | you will find a link in the About window that will open the page with the latest release in your default 67 | browser. 68 | 69 | ![About](https://i.ibb.co/QNqBLcG/About.png) 70 | 71 | You could also always get the latest version [here](https://github.com/HanSolo/JDKMon/releases). 72 | 73 | Depending on the operating system it will try to find the JDK's 74 | in the following folders: 75 | 76 | MacOS: `/System/Volumes/Data/Library/Java/JavaVirtualMachines/` 77 | 78 | Windows: `C:\Program Files\Java\` 79 | 80 | Linux: `/usr/lib/jvm`(FXTrayIcon only supports a few linux distros) 81 | 82 | You can change the folders JDKMon is scanning for installed JDK's by selecting 83 | the `"Add JDK search path"` menu entry. The selected path will be added to the list of 84 | folders stored in the jdkmon.properties file in your user home folder. 85 | JDKMon will scan all given folders for installed JDK's. 86 | 87 | If you would like to reset the folders that should be scanned to the default, simply 88 | select `"Default JDK search path"` in the menu. 89 | 90 | You can also change the folders JDKMon is scanning for JavaFX SDK's by selecting 91 | the `"Add JavaFX search path"` menu entry. The selected path will be added to the list of 92 | folders stored in the jdkmon.properties file in your user home folder. 93 | You just need to add the folder than contains all your `javafx-sdk-mm.ii.uu` folders. 94 | 95 | If you would like to reset the folders that should be scanned for JavaFX SDK's to the default, 96 | simply select `"Default JavaFX search path"`. It will be reset to the your home folder. 97 | 98 | You can search and download for a JDK from different distributions in the dialog that opens when 99 | you select `"Download a JDK"` from the menu. 100 | 101 | The application will stay in the system tray with an icon. If you click the icon 102 | a menu will appear where you can select 103 | 104 | 105 | `JDK Main: The main window` 106 | 107 | `Rescan: Will rescan for installed JDK's and check for updates` 108 | 109 | `Add search path: Will open the directory chooser to add a path to the search paths` 110 | 111 | `Default search path: Will reset the search path to the platform dependent default` 112 | 113 | `Remember download folder: When remember download folder is active you don't have to select a download folder everytime` 114 | 115 | `Download a JDK: Opens a dialog where you can search/download a JDK from different distributions` 116 | 117 | `Exit: Exit the application` 118 | ` 119 | 120 | ATTENTION:
121 | When running the application via `java -jar` on Linux you might have to 122 | add `-Djdk.gtk.version=2` to make it work correctly e.g. `java -Djdk.gtk.version=3 -jar JDKMon-linux-22.0.0.jar` 123 | 124 | On Mac and Windows the dark mode will be detected automatically and the user interface will 125 | adjust it's design to either dark or light mode. On Linux you can change the variable "dark_mode" in the 126 | jdkmon.properties file (in your user folder) to "TRUE" to see the application in dark mode. 127 | The application will only check for dark/light mode during startup and won't change when it is running. 128 | 129 | The main window will show you all JDK's found by JDKMon and if there is an 130 | update available it will show you the archive types of the available updates. 131 | In the image below you can see that there is an update for Zulu(FX) available 132 | and that you can download it as a tar.gz file. 133 | To download an update just click on the archive type tag and choose a folder 134 | where the download should be stored. 135 | 136 | If an update is available and there are release details available, a little blue dot with a question mark 137 | will appear at the end of the packages list. When clicking on the dot the default browser will open with 138 | the release details over at [foojay.io](https://foojay.io) 139 | 140 | JDKMon will not only help you to keep your installed OpenJDK distributions up to date but will also check 141 | the NVD (National Vulnerability Database) for known vulnerabilities (CVE - Common Vulnerability and Exposure) related to their version number. If you have for example installed 142 | an OpenJDK distribution with the version 11.0.13, JDKMon will check the NVD for known vulnerabilities of OpenJDK 143 | with the version number 11.0.13. In case JDKMon will find vulnerabilities, it will indicate this with a red 144 | square with an exclamation mark behind the version number. Meaning to say if you have for example Zulu 11.0.13 145 | and Liberica 11.0.13 installed ony your machine, JDKMon will show you the vulnerabilties, it found for 146 | OpenJDK 11.0.13 for both distributions. So there is no guarantee that your installed distribution is really 147 | affected by the CVE's found in the NVD but you at least get the info that there are vulnerabilities for 11.0.13. 148 | 149 | ![JDKMon](https://i.ibb.co/8MB9Lmx/JDKMon.png) 150 | 151 | If you hover over a distribution, a tooltip will pop up that shows you the path where the distribution is installed, 152 | the number of modules the distribution comes with if it is modular and the size of the folder it is installed in. 153 | 154 | When you click on the yellow circle a window will open which shows the CVE's found. 155 | You can click on each CVE to open it in a browser with more detailled information. 156 | 157 | ![Vulnerabilities](https://i.ibb.co/M50z992/vulnerabilities.png) 158 | 159 | In the menu you will find an entry named "JEP's, JSR's, Projects". This will open a dialog with 3 drop down boxes 160 | as you can see in the following image. 161 | 162 | ![JepJsrProject](https://i.ibb.co/BPZwX98/Xnip2023-11-06-12-42-15.png) 163 | 164 | When selecting one item of those boxes, it will open the related JEP, JSR or project in your 165 | default browser so that you can read more about it. 166 | 167 | 168 | #### User Interface 169 | How it looks on MacOS and Linux (light/dark mode): 170 | ![Updates](https://i.ibb.co/HttqQ3n/update-mac-linux.png) 171 | 172 | ![Download](https://i.ibb.co/DbYK1F3/download-mac-linux.png) 173 | 174 | How it looks on Windows (light/dark mode): 175 | 176 | ![Updates](https://i.ibb.co/w6d9bV4/update-win.png) 177 | 178 | ![Download](https://i.ibb.co/HF5F8ff/download-win.png) 179 | 180 | 181 | ### Additional properties 182 | In your user home folder (e.g. /Users/YOUR_USERNAME or /home/YOUR_USERNAME) you will find 183 | a file named ```jdkmon.properties```. This file contains the following settings: 184 | ``` 185 | searchpath=THE PATHS THAT WILL SCANNED FOR JDK'S (default depends on operating system) 186 | remember_download_folder=TRUE/FALSE (default is FALSE) 187 | download_folder=THE FOLDER WHERE DOWNLOADS WILL BE STORED (default is empty) 188 | dark_mode=TRUE/FALSE (default is FALSE) 189 | javafx_searchpath=PATH THAT WILL BE SCANNED FOR JAVAFX SDK'S (default is the user home folder) 190 | features=loom,panama,metropolis,valhalla,lanai,kona_fiber (list of features to look for) EXPERIMENTAL! 191 | autoextract=TRUE/FALSE Will directly extract downloaded JDK's (default is FALSE) EXPERIMENTAL! 192 | show_unknown_builds=TRUE/FALSE Will show unknown builds of OpenJDK (default is FALSE) EXPERIMENTAL! 193 | ``` 194 | 195 | ### Switch JDK script 196 | Since release 17.0.67 of JDKMon, it will create a script in your user home folder called 197 | 198 | - switch-jdk.sh (Linux and Mac) 199 | - switch-jdk.bat (Windows) 200 | 201 | With this script you can switch to a specific JDK that was found by JDKMon. 202 | You can call the script with the -h parameter to get more help as follows: 203 | 204 | ``` 205 | >: ./switch-jdk.sh -h 206 | . ./switch-jdk.sh JDK_NAME 207 | 208 | JDK_NAME can be one of the following: 209 | zulu_17_0_7_0 210 | zulu_20_0_1_0 211 | zulu_8_0_372_0 212 | gluon_graalvm_22_1_0_1 213 | zulu_21_0_0_0 214 | graalvm_ce17_22_3_1_0 215 | zulu_11_0_19_0 216 | 217 | >: . ./switch-jdk.sh zulu_11_0_19_0 218 | Switched to zulu 11.0.19 219 | openjdk version "11.0.19" 2023-04-18 LTS 220 | OpenJDK Runtime Environment Zulu11.64+19-CA (build 11.0.19+7-LTS) 221 | OpenJDK 64-Bit Server VM Zulu11.64+19-CA (build 11.0.19+7-LTS, mixed mode) 222 | 223 | >: java -version 224 | openjdk version "11.0.19" 2023-04-18 LTS 225 | OpenJDK Runtime Environment Zulu11.64+19-CA (build 11.0.19+7-LTS) 226 | OpenJDK 64-Bit Server VM Zulu11.64+19-CA (build 11.0.19+7-LTS, mixed mode) 227 | ``` 228 | 229 | This script enables you to switch to a JDK of your choice for the current shell session. 230 | 231 | 232 | ### Installation 233 | #### Linux 234 | Install the deb pkg via 235 | ```sudo dpkg -i jdkmon_22.0.0-1_amd64.deb``` 236 | 237 | #### Windows 238 | Make sure that you unblocked the msi package and set the rights correctly before you 239 | execute the msi installer 240 | 241 | #### MacOS 242 | Install the pkg and make sure it is not unblocked because it comes from an unknown source. 243 | 244 | ### Installation problems 245 | #### Linux 246 | Make sure that you have the following programs installed before you execute build_appLinux.sh: 247 | - binutils ```sudo apt install binutils``` 248 | - fakeroot ```sudo apt install fakeroot``` 249 | - rpm ```sudo apt install rpm``` 250 | 251 | ### Problems opening CVE links 252 | #### Linux 253 | Make sure you have the xdg-open tool installed (it is part of the xdg-utils package). 254 | - xdg-utils ```sudo apt install xdg-utils``` 255 | 256 | ### No CVEs found 257 | In case the cve files (in your home folder) are empty, 258 | delete the empty file and restart JDKMon. After the restart the file should be filled with data again. 259 | - cvedb.json 260 | - graalvm_cvedb.json 261 | -------------------------------------------------------------------------------- /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 {yyyy} {name of copyright owner} 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 | --------------------------------------------------------------------------------