From 8e1219d88e348a9eb30881c94288b6d346205903 Mon Sep 17 00:00:00 2001 From: Robinson Date: Sun, 31 Jan 2021 22:28:55 +0100 Subject: [PATCH] Updated copyright --- build.gradle.kts | 27 ++---- settings.gradle.kts | 2 +- src/dorkbox/systemTray/Checkbox.java | 2 +- src/dorkbox/systemTray/Entry.java | 2 +- src/dorkbox/systemTray/Menu.java | 2 +- src/dorkbox/systemTray/MenuItem.java | 2 +- src/dorkbox/systemTray/Separator.java | 2 +- src/dorkbox/systemTray/Status.java | 2 +- src/dorkbox/systemTray/Tray.java | 2 +- .../gnomeShell/AppIndicatorExtension.java | 2 +- .../systemTray/gnomeShell/DummyFile.java | 15 ++++ .../gnomeShell/ExtensionSupport.java | 2 +- .../gnomeShell/LegacyExtension.java | 2 +- src/dorkbox/systemTray/peer/CheckboxPeer.java | 2 +- src/dorkbox/systemTray/peer/EntryPeer.java | 2 +- src/dorkbox/systemTray/peer/MenuItemPeer.java | 2 +- src/dorkbox/systemTray/peer/MenuPeer.java | 2 +- .../systemTray/peer/SeparatorPeer.java | 2 +- src/dorkbox/systemTray/peer/StatusPeer.java | 2 +- src/dorkbox/systemTray/ui/awt/AwtMenu.java | 2 +- .../systemTray/ui/awt/AwtMenuItem.java | 2 +- .../ui/awt/AwtMenuItemCheckbox.java | 2 +- .../ui/awt/AwtMenuItemSeparator.java | 2 +- .../systemTray/ui/awt/AwtMenuItemStatus.java | 2 +- src/dorkbox/systemTray/ui/awt/_AwtTray.java | 2 +- .../systemTray/ui/gtk/GtkBaseMenuItem.java | 2 +- src/dorkbox/systemTray/ui/gtk/GtkMenu.java | 2 +- .../systemTray/ui/gtk/GtkMenuItem.java | 2 +- .../ui/gtk/GtkMenuItemCheckbox.java | 2 +- .../ui/gtk/GtkMenuItemSeparator.java | 2 +- .../systemTray/ui/gtk/GtkMenuItemStatus.java | 2 +- .../ui/gtk/_AppIndicatorNativeTray.java | 2 +- .../ui/gtk/_GtkStatusIconNativeTray.java | 2 +- .../systemTray/ui/osx/OsxBaseMenuItem.java | 2 +- .../systemTray/ui/osx/OsxClickAction.java | 4 +- src/dorkbox/systemTray/ui/osx/OsxMenu.java | 2 +- .../systemTray/ui/osx/OsxMenuItem.java | 2 +- .../ui/osx/OsxMenuItemCheckbox.java | 2 +- .../ui/osx/OsxMenuItemSeparator.java | 4 +- .../systemTray/ui/osx/OsxMenuItemStatus.java | 4 +- .../systemTray/ui/osx/_OsxNativeTray.java | 2 +- .../systemTray/ui/swing/SwingMenu.java | 2 +- .../systemTray/ui/swing/SwingMenuItem.java | 2 +- .../ui/swing/SwingMenuItemCheckbox.java | 2 +- .../ui/swing/SwingMenuItemSeparator.java | 2 +- .../ui/swing/SwingMenuItemStatus.java | 2 +- .../systemTray/ui/swing/SwingUIFactory.java | 2 +- .../systemTray/ui/swing/TrayPopup.java | 2 +- .../systemTray/ui/swing/_SwingTray.java | 2 +- .../ui/swing/_WindowsNativeTray.java | 2 +- .../systemTray/util/EventDispatch.java | 15 ++++ .../systemTray/util/HeavyCheckMark.java | 15 ++++ .../systemTray/util/ImageResizeUtil.java | 2 +- src/dorkbox/systemTray/util/LinuxSwingUI.java | 2 +- .../systemTray/util/SizeAndScalingUtil.java | 2 +- .../systemTray/util/SystemTrayFixes.java | 2 +- .../systemTray/util/WindowsSwingUI.java | 2 +- test-javaFx/dorkbox/TestTrayJavaFX.java | 3 +- test-swt/dorkbox/TestTraySwt.java | 3 +- test/dorkbox/CustomSwingUI.java | 2 +- test/dorkbox/TestMultiTray.java | 89 +++++++++++++++++++ test/dorkbox/TestReAddTray.java | 9 +- test/dorkbox/TestTray.java | 3 +- 63 files changed, 208 insertions(+), 85 deletions(-) create mode 100644 test/dorkbox/TestMultiTray.java diff --git a/build.gradle.kts b/build.gradle.kts index 91305ca..e900683 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2018 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import java.time.Instant /////////////////////////////// @@ -86,12 +85,9 @@ licensing { } -val exampleCompile : Configuration by configurations.creating { extendsFrom(configurations.implementation.get()) } val javaFxExampleCompile : Configuration by configurations.creating { extendsFrom(configurations.implementation.get()) } val swtExampleCompile : Configuration by configurations.creating { extendsFrom(configurations.implementation.get()) } -val SourceSetContainer.example: SourceSet get() = maybeCreate("example") -fun SourceSetContainer.example(block: SourceSet.() -> Unit) = example.apply(block) val SourceSetContainer.javaFxExample: SourceSet get() = maybeCreate("javaFxExample") fun SourceSetContainer.javaFxExample(block: SourceSet.() -> Unit) = javaFxExample.apply(block) val SourceSetContainer.swtExample: SourceSet get() = maybeCreate("swtExample") @@ -115,12 +111,6 @@ sourceSets { } test { - java { - setSrcDirs(listOf("test")) // no includes - } - } - - example { java { setSrcDirs(listOf("test")) // only want to include java files for the source. 'setSrcDirs' resets includes... @@ -156,7 +146,7 @@ sourceSets { srcDir(sourceSets["main"].resources) } - compileClasspath += sourceSets.main.get().runtimeClasspath + sourceSets.example.runtimeClasspath + compileClasspath += sourceSets.test.get().runtimeClasspath } swtExample { @@ -175,7 +165,7 @@ sourceSets { srcDir(sourceSets["main"].resources) } - compileClasspath += sourceSets.example.compileClasspath + compileClasspath += sourceSets.test.get().runtimeClasspath } } @@ -263,7 +253,8 @@ dependencies { isTransitive = false } - exampleCompile.dependencies += log + configurations["testCompile"].dependencies += configurations["implementation"].dependencies + configurations["testCompile"].dependencies += log javaFxExampleCompile.dependencies += log swtExampleCompile.dependencies += log } @@ -272,7 +263,7 @@ dependencies { ////// Tasks to launch examples from gradle /////////////////////////////// task("example") { - classpath = sourceSets.example.runtimeClasspath + classpath = sourceSets.test.get().runtimeClasspath main = "dorkbox.TestTray" standardInput = System.`in` } @@ -300,10 +291,10 @@ task("jarExample") { duplicatesStrategy = DuplicatesStrategy.EXCLUDE - from(sourceSets.example.output.classesDirs) - from(sourceSets.example.output.resourcesDir) + from(sourceSets.test.get().output.classesDirs) + from(sourceSets.test.get().output.resourcesDir) - from(exampleCompile.map { if (it.isDirectory) it else zipTree(it) }) { + from(configurations["testCompile"].map { if (it.isDirectory) it else zipTree(it) }) { exclude("META-INF/*.DSA", "META-INF/*.SF") } diff --git a/settings.gradle.kts b/settings.gradle.kts index cce9d6c..ec55c25 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2018 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/Checkbox.java b/src/dorkbox/systemTray/Checkbox.java index 3699514..ba301e4 100644 --- a/src/dorkbox/systemTray/Checkbox.java +++ b/src/dorkbox/systemTray/Checkbox.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/Entry.java b/src/dorkbox/systemTray/Entry.java index 1399b81..5fb046a 100644 --- a/src/dorkbox/systemTray/Entry.java +++ b/src/dorkbox/systemTray/Entry.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/Menu.java b/src/dorkbox/systemTray/Menu.java index e13964c..d1f2bcd 100644 --- a/src/dorkbox/systemTray/Menu.java +++ b/src/dorkbox/systemTray/Menu.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/MenuItem.java b/src/dorkbox/systemTray/MenuItem.java index 7e0929e..5df8fd7 100644 --- a/src/dorkbox/systemTray/MenuItem.java +++ b/src/dorkbox/systemTray/MenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/Separator.java b/src/dorkbox/systemTray/Separator.java index 9e2b3c7..1c396f1 100644 --- a/src/dorkbox/systemTray/Separator.java +++ b/src/dorkbox/systemTray/Separator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/Status.java b/src/dorkbox/systemTray/Status.java index 9086b80..41caf7b 100644 --- a/src/dorkbox/systemTray/Status.java +++ b/src/dorkbox/systemTray/Status.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/Tray.java b/src/dorkbox/systemTray/Tray.java index 5118220..f37b19f 100644 --- a/src/dorkbox/systemTray/Tray.java +++ b/src/dorkbox/systemTray/Tray.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/gnomeShell/AppIndicatorExtension.java b/src/dorkbox/systemTray/gnomeShell/AppIndicatorExtension.java index 7856fb9..672b5d8 100644 --- a/src/dorkbox/systemTray/gnomeShell/AppIndicatorExtension.java +++ b/src/dorkbox/systemTray/gnomeShell/AppIndicatorExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/gnomeShell/DummyFile.java b/src/dorkbox/systemTray/gnomeShell/DummyFile.java index 6dbbd57..b3eb7cb 100644 --- a/src/dorkbox/systemTray/gnomeShell/DummyFile.java +++ b/src/dorkbox/systemTray/gnomeShell/DummyFile.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.systemTray.gnomeShell; import java.io.File; diff --git a/src/dorkbox/systemTray/gnomeShell/ExtensionSupport.java b/src/dorkbox/systemTray/gnomeShell/ExtensionSupport.java index e474c19..d573041 100644 --- a/src/dorkbox/systemTray/gnomeShell/ExtensionSupport.java +++ b/src/dorkbox/systemTray/gnomeShell/ExtensionSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/gnomeShell/LegacyExtension.java b/src/dorkbox/systemTray/gnomeShell/LegacyExtension.java index f28a457..efe20f5 100644 --- a/src/dorkbox/systemTray/gnomeShell/LegacyExtension.java +++ b/src/dorkbox/systemTray/gnomeShell/LegacyExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/peer/CheckboxPeer.java b/src/dorkbox/systemTray/peer/CheckboxPeer.java index abbaf9a..890e33f 100644 --- a/src/dorkbox/systemTray/peer/CheckboxPeer.java +++ b/src/dorkbox/systemTray/peer/CheckboxPeer.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/peer/EntryPeer.java b/src/dorkbox/systemTray/peer/EntryPeer.java index eace91a..ab01af2 100644 --- a/src/dorkbox/systemTray/peer/EntryPeer.java +++ b/src/dorkbox/systemTray/peer/EntryPeer.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/peer/MenuItemPeer.java b/src/dorkbox/systemTray/peer/MenuItemPeer.java index db57442..8c2fe05 100644 --- a/src/dorkbox/systemTray/peer/MenuItemPeer.java +++ b/src/dorkbox/systemTray/peer/MenuItemPeer.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/peer/MenuPeer.java b/src/dorkbox/systemTray/peer/MenuPeer.java index 05af586..a0b3218 100644 --- a/src/dorkbox/systemTray/peer/MenuPeer.java +++ b/src/dorkbox/systemTray/peer/MenuPeer.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/peer/SeparatorPeer.java b/src/dorkbox/systemTray/peer/SeparatorPeer.java index 6898b6d..bd9312b 100644 --- a/src/dorkbox/systemTray/peer/SeparatorPeer.java +++ b/src/dorkbox/systemTray/peer/SeparatorPeer.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/peer/StatusPeer.java b/src/dorkbox/systemTray/peer/StatusPeer.java index b8073d0..c0fc70a 100644 --- a/src/dorkbox/systemTray/peer/StatusPeer.java +++ b/src/dorkbox/systemTray/peer/StatusPeer.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/awt/AwtMenu.java b/src/dorkbox/systemTray/ui/awt/AwtMenu.java index 4f5d04f..b41794a 100644 --- a/src/dorkbox/systemTray/ui/awt/AwtMenu.java +++ b/src/dorkbox/systemTray/ui/awt/AwtMenu.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/awt/AwtMenuItem.java b/src/dorkbox/systemTray/ui/awt/AwtMenuItem.java index c1916c4..39ae628 100644 --- a/src/dorkbox/systemTray/ui/awt/AwtMenuItem.java +++ b/src/dorkbox/systemTray/ui/awt/AwtMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/awt/AwtMenuItemCheckbox.java b/src/dorkbox/systemTray/ui/awt/AwtMenuItemCheckbox.java index c4b9974..e3c2218 100644 --- a/src/dorkbox/systemTray/ui/awt/AwtMenuItemCheckbox.java +++ b/src/dorkbox/systemTray/ui/awt/AwtMenuItemCheckbox.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/awt/AwtMenuItemSeparator.java b/src/dorkbox/systemTray/ui/awt/AwtMenuItemSeparator.java index 589e3c8..d68c5cb 100644 --- a/src/dorkbox/systemTray/ui/awt/AwtMenuItemSeparator.java +++ b/src/dorkbox/systemTray/ui/awt/AwtMenuItemSeparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/awt/AwtMenuItemStatus.java b/src/dorkbox/systemTray/ui/awt/AwtMenuItemStatus.java index e05d004..a1df322 100644 --- a/src/dorkbox/systemTray/ui/awt/AwtMenuItemStatus.java +++ b/src/dorkbox/systemTray/ui/awt/AwtMenuItemStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/awt/_AwtTray.java b/src/dorkbox/systemTray/ui/awt/_AwtTray.java index 1363a22..f83cb3c 100644 --- a/src/dorkbox/systemTray/ui/awt/_AwtTray.java +++ b/src/dorkbox/systemTray/ui/awt/_AwtTray.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/gtk/GtkBaseMenuItem.java b/src/dorkbox/systemTray/ui/gtk/GtkBaseMenuItem.java index 80cfe14..b893d26 100644 --- a/src/dorkbox/systemTray/ui/gtk/GtkBaseMenuItem.java +++ b/src/dorkbox/systemTray/ui/gtk/GtkBaseMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/gtk/GtkMenu.java b/src/dorkbox/systemTray/ui/gtk/GtkMenu.java index e236fbb..5545538 100644 --- a/src/dorkbox/systemTray/ui/gtk/GtkMenu.java +++ b/src/dorkbox/systemTray/ui/gtk/GtkMenu.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/gtk/GtkMenuItem.java b/src/dorkbox/systemTray/ui/gtk/GtkMenuItem.java index 523f576..38a45f6 100644 --- a/src/dorkbox/systemTray/ui/gtk/GtkMenuItem.java +++ b/src/dorkbox/systemTray/ui/gtk/GtkMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/gtk/GtkMenuItemCheckbox.java b/src/dorkbox/systemTray/ui/gtk/GtkMenuItemCheckbox.java index 6934b38..4f56ebe 100644 --- a/src/dorkbox/systemTray/ui/gtk/GtkMenuItemCheckbox.java +++ b/src/dorkbox/systemTray/ui/gtk/GtkMenuItemCheckbox.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/gtk/GtkMenuItemSeparator.java b/src/dorkbox/systemTray/ui/gtk/GtkMenuItemSeparator.java index 58787c8..95979c5 100644 --- a/src/dorkbox/systemTray/ui/gtk/GtkMenuItemSeparator.java +++ b/src/dorkbox/systemTray/ui/gtk/GtkMenuItemSeparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/gtk/GtkMenuItemStatus.java b/src/dorkbox/systemTray/ui/gtk/GtkMenuItemStatus.java index a21fbf7..bede291 100644 --- a/src/dorkbox/systemTray/ui/gtk/GtkMenuItemStatus.java +++ b/src/dorkbox/systemTray/ui/gtk/GtkMenuItemStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/gtk/_AppIndicatorNativeTray.java b/src/dorkbox/systemTray/ui/gtk/_AppIndicatorNativeTray.java index f8b6c81..264a392 100644 --- a/src/dorkbox/systemTray/ui/gtk/_AppIndicatorNativeTray.java +++ b/src/dorkbox/systemTray/ui/gtk/_AppIndicatorNativeTray.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/gtk/_GtkStatusIconNativeTray.java b/src/dorkbox/systemTray/ui/gtk/_GtkStatusIconNativeTray.java index 9b87d7d..9c8b994 100644 --- a/src/dorkbox/systemTray/ui/gtk/_GtkStatusIconNativeTray.java +++ b/src/dorkbox/systemTray/ui/gtk/_GtkStatusIconNativeTray.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/osx/OsxBaseMenuItem.java b/src/dorkbox/systemTray/ui/osx/OsxBaseMenuItem.java index 6c9735e..9c0c2bc 100644 --- a/src/dorkbox/systemTray/ui/osx/OsxBaseMenuItem.java +++ b/src/dorkbox/systemTray/ui/osx/OsxBaseMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/osx/OsxClickAction.java b/src/dorkbox/systemTray/ui/osx/OsxClickAction.java index db663bb..76625fb 100644 --- a/src/dorkbox/systemTray/ui/osx/OsxClickAction.java +++ b/src/dorkbox/systemTray/ui/osx/OsxClickAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,7 +80,7 @@ class OsxClickAction extends NSObject { clickMap.remove(asPointer()); } - protected + @Override protected void finalize() throws Throwable { synchronized (clickMap){ clickMap.remove(asPointer()); diff --git a/src/dorkbox/systemTray/ui/osx/OsxMenu.java b/src/dorkbox/systemTray/ui/osx/OsxMenu.java index 0df2efe..667e6a7 100644 --- a/src/dorkbox/systemTray/ui/osx/OsxMenu.java +++ b/src/dorkbox/systemTray/ui/osx/OsxMenu.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/osx/OsxMenuItem.java b/src/dorkbox/systemTray/ui/osx/OsxMenuItem.java index 41d9c64..0f3b784 100644 --- a/src/dorkbox/systemTray/ui/osx/OsxMenuItem.java +++ b/src/dorkbox/systemTray/ui/osx/OsxMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/osx/OsxMenuItemCheckbox.java b/src/dorkbox/systemTray/ui/osx/OsxMenuItemCheckbox.java index fdcd190..8534655 100644 --- a/src/dorkbox/systemTray/ui/osx/OsxMenuItemCheckbox.java +++ b/src/dorkbox/systemTray/ui/osx/OsxMenuItemCheckbox.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/osx/OsxMenuItemSeparator.java b/src/dorkbox/systemTray/ui/osx/OsxMenuItemSeparator.java index fa9b310..299c0c5 100644 --- a/src/dorkbox/systemTray/ui/osx/OsxMenuItemSeparator.java +++ b/src/dorkbox/systemTray/ui/osx/OsxMenuItemSeparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,8 @@ */ package dorkbox.systemTray.ui.osx; -import dorkbox.systemTray.peer.EntryPeer; import dorkbox.jna.macos.cocoa.NSMenuItem; +import dorkbox.systemTray.peer.EntryPeer; class OsxMenuItemSeparator implements EntryPeer { diff --git a/src/dorkbox/systemTray/ui/osx/OsxMenuItemStatus.java b/src/dorkbox/systemTray/ui/osx/OsxMenuItemStatus.java index 6a5630d..c909a70 100644 --- a/src/dorkbox/systemTray/ui/osx/OsxMenuItemStatus.java +++ b/src/dorkbox/systemTray/ui/osx/OsxMenuItemStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,9 +15,9 @@ */ package dorkbox.systemTray.ui.osx; +import dorkbox.jna.macos.cocoa.NSString; import dorkbox.systemTray.Status; import dorkbox.systemTray.peer.StatusPeer; -import dorkbox.jna.macos.cocoa.NSString; class OsxMenuItemStatus extends OsxBaseMenuItem implements StatusPeer { diff --git a/src/dorkbox/systemTray/ui/osx/_OsxNativeTray.java b/src/dorkbox/systemTray/ui/osx/_OsxNativeTray.java index 1571eca..1cd5b8b 100644 --- a/src/dorkbox/systemTray/ui/osx/_OsxNativeTray.java +++ b/src/dorkbox/systemTray/ui/osx/_OsxNativeTray.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/swing/SwingMenu.java b/src/dorkbox/systemTray/ui/swing/SwingMenu.java index de6fc5f..535add6 100644 --- a/src/dorkbox/systemTray/ui/swing/SwingMenu.java +++ b/src/dorkbox/systemTray/ui/swing/SwingMenu.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/swing/SwingMenuItem.java b/src/dorkbox/systemTray/ui/swing/SwingMenuItem.java index f844c96..d6c83d3 100644 --- a/src/dorkbox/systemTray/ui/swing/SwingMenuItem.java +++ b/src/dorkbox/systemTray/ui/swing/SwingMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/swing/SwingMenuItemCheckbox.java b/src/dorkbox/systemTray/ui/swing/SwingMenuItemCheckbox.java index 23a336b..c520968 100644 --- a/src/dorkbox/systemTray/ui/swing/SwingMenuItemCheckbox.java +++ b/src/dorkbox/systemTray/ui/swing/SwingMenuItemCheckbox.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/swing/SwingMenuItemSeparator.java b/src/dorkbox/systemTray/ui/swing/SwingMenuItemSeparator.java index cb70604..a7eaca6 100644 --- a/src/dorkbox/systemTray/ui/swing/SwingMenuItemSeparator.java +++ b/src/dorkbox/systemTray/ui/swing/SwingMenuItemSeparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/swing/SwingMenuItemStatus.java b/src/dorkbox/systemTray/ui/swing/SwingMenuItemStatus.java index 0b568d2..e649f33 100644 --- a/src/dorkbox/systemTray/ui/swing/SwingMenuItemStatus.java +++ b/src/dorkbox/systemTray/ui/swing/SwingMenuItemStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/swing/SwingUIFactory.java b/src/dorkbox/systemTray/ui/swing/SwingUIFactory.java index ec28c3c..6b30f45 100644 --- a/src/dorkbox/systemTray/ui/swing/SwingUIFactory.java +++ b/src/dorkbox/systemTray/ui/swing/SwingUIFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/swing/TrayPopup.java b/src/dorkbox/systemTray/ui/swing/TrayPopup.java index f61cb29..c542f1d 100644 --- a/src/dorkbox/systemTray/ui/swing/TrayPopup.java +++ b/src/dorkbox/systemTray/ui/swing/TrayPopup.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/swing/_SwingTray.java b/src/dorkbox/systemTray/ui/swing/_SwingTray.java index 1a643b7..e592e1b 100644 --- a/src/dorkbox/systemTray/ui/swing/_SwingTray.java +++ b/src/dorkbox/systemTray/ui/swing/_SwingTray.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/ui/swing/_WindowsNativeTray.java b/src/dorkbox/systemTray/ui/swing/_WindowsNativeTray.java index 2edf6e0..6cf46e9 100644 --- a/src/dorkbox/systemTray/ui/swing/_WindowsNativeTray.java +++ b/src/dorkbox/systemTray/ui/swing/_WindowsNativeTray.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 dorkbox, llc. + * Copyright 2021 dorkbox, llc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/util/EventDispatch.java b/src/dorkbox/systemTray/util/EventDispatch.java index 3a48d5e..5ddb8d0 100644 --- a/src/dorkbox/systemTray/util/EventDispatch.java +++ b/src/dorkbox/systemTray/util/EventDispatch.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.systemTray.util; import java.util.concurrent.CountDownLatch; diff --git a/src/dorkbox/systemTray/util/HeavyCheckMark.java b/src/dorkbox/systemTray/util/HeavyCheckMark.java index 0c2e7a5..a243b9f 100644 --- a/src/dorkbox/systemTray/util/HeavyCheckMark.java +++ b/src/dorkbox/systemTray/util/HeavyCheckMark.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.systemTray.util; import java.awt.Color; diff --git a/src/dorkbox/systemTray/util/ImageResizeUtil.java b/src/dorkbox/systemTray/util/ImageResizeUtil.java index d0236fe..04b22fc 100644 --- a/src/dorkbox/systemTray/util/ImageResizeUtil.java +++ b/src/dorkbox/systemTray/util/ImageResizeUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/util/LinuxSwingUI.java b/src/dorkbox/systemTray/util/LinuxSwingUI.java index bb5e148..7e8d32d 100644 --- a/src/dorkbox/systemTray/util/LinuxSwingUI.java +++ b/src/dorkbox/systemTray/util/LinuxSwingUI.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/util/SizeAndScalingUtil.java b/src/dorkbox/systemTray/util/SizeAndScalingUtil.java index 25c0dd4..d943f19 100644 --- a/src/dorkbox/systemTray/util/SizeAndScalingUtil.java +++ b/src/dorkbox/systemTray/util/SizeAndScalingUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/util/SystemTrayFixes.java b/src/dorkbox/systemTray/util/SystemTrayFixes.java index e666397..e8792a2 100644 --- a/src/dorkbox/systemTray/util/SystemTrayFixes.java +++ b/src/dorkbox/systemTray/util/SystemTrayFixes.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dorkbox/systemTray/util/WindowsSwingUI.java b/src/dorkbox/systemTray/util/WindowsSwingUI.java index 0263e42..2f4c6c8 100644 --- a/src/dorkbox/systemTray/util/WindowsSwingUI.java +++ b/src/dorkbox/systemTray/util/WindowsSwingUI.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/test-javaFx/dorkbox/TestTrayJavaFX.java b/test-javaFx/dorkbox/TestTrayJavaFX.java index b18e8e4..6fff867 100644 --- a/test-javaFx/dorkbox/TestTrayJavaFX.java +++ b/test-javaFx/dorkbox/TestTrayJavaFX.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package dorkbox; import java.awt.event.ActionListener; diff --git a/test-swt/dorkbox/TestTraySwt.java b/test-swt/dorkbox/TestTraySwt.java index 50a1e0e..51ee332 100644 --- a/test-swt/dorkbox/TestTraySwt.java +++ b/test-swt/dorkbox/TestTraySwt.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package dorkbox; import java.awt.event.ActionListener; diff --git a/test/dorkbox/CustomSwingUI.java b/test/dorkbox/CustomSwingUI.java index ce4fbb2..96ede72 100644 --- a/test/dorkbox/CustomSwingUI.java +++ b/test/dorkbox/CustomSwingUI.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/test/dorkbox/TestMultiTray.java b/test/dorkbox/TestMultiTray.java new file mode 100644 index 0000000..0f2ce19 --- /dev/null +++ b/test/dorkbox/TestMultiTray.java @@ -0,0 +1,89 @@ +/* + * Copyright 2021 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package dorkbox; + +import java.net.URL; + +import dorkbox.systemTray.MenuItem; +import dorkbox.systemTray.SystemTray; +import dorkbox.util.CacheUtil; + +/** + * Icons from 'SJJB Icons', public domain/CC0 icon set + */ +public +class TestMultiTray { + + public static final URL LT_GRAY_TRAIN = TestMultiTray.class.getResource("transport_train_station.p.666666.32.png"); + public static final URL GREEN_TRAIN = TestMultiTray.class.getResource("transport_train_station.p.39AC39.32.png"); + + public static + void main(String[] args) { + // make sure JNA jar is on the classpath! + new TestMultiTray(); + } + + private SystemTray systemTray1; + private SystemTray systemTray2; + + public + TestMultiTray() { + SystemTray.DEBUG = true; // for test apps, we always want to run in debug mode + + // for test apps, make sure the cache is always reset. These are the ones used, and you should never do this in production. + CacheUtil.clear("SysTrayExample1"); + CacheUtil.clear("SysTrayExample2"); + + // SwingUtil.setLookAndFeel(null); // set Native L&F (this is the System L&F instead of CrossPlatform L&F) + // SystemTray.SWING_UI = new CustomSwingUI(); + + this.systemTray1 = SystemTray.get("SysTrayExample1"); + if (systemTray1 == null) { + throw new RuntimeException("Unable to load SystemTray!"); + } + + systemTray1.setTooltip("Mail Checker"); + systemTray1.setImage(LT_GRAY_TRAIN); + systemTray1.setStatus("No Mail"); + + systemTray1.getMenu().add(new MenuItem("Quit", e->{ + systemTray1.shutdown(); + //System.exit(0); not necessary if all non-daemon threads have stopped. + })).setShortcut('q'); // case does not matter + + + System.err.println("Creating another tray"); + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + systemTray2 = SystemTray.get("SysTrayExample2"); + if (systemTray2 == null) { + throw new RuntimeException("Unable to load SystemTray!"); + } + + systemTray2.setTooltip("Choo-Choo!"); + systemTray2.setImage(GREEN_TRAIN); + systemTray2.setStatus("HONK"); + + systemTray2.getMenu().add(new MenuItem("Quit", e->{ + systemTray2.shutdown(); + //System.exit(0); not necessary if all non-daemon threads have stopped. + })).setShortcut('q'); // case does not matter + } +} diff --git a/test/dorkbox/TestReAddTray.java b/test/dorkbox/TestReAddTray.java index 8bcf914..17c30cd 100644 --- a/test/dorkbox/TestReAddTray.java +++ b/test/dorkbox/TestReAddTray.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package dorkbox; import java.net.URL; @@ -69,16 +68,18 @@ class TestReAddTray { e.printStackTrace(); } + System.err.println("Removing then adding new tray"); + systemTray.remove(); - systemTray = SystemTray.get(); + systemTray = SystemTray.get("SysTrayExample"); if (systemTray == null) { throw new RuntimeException("Unable to load SystemTray!"); } systemTray.setTooltip("Mail Checker"); systemTray.setImage(LT_GRAY_TRAIN); - systemTray.setStatus("No Mail"); + systemTray.setStatus("SUPER Mail"); systemTray.getMenu().add(new MenuItem("Quit", e->{ systemTray.shutdown(); diff --git a/test/dorkbox/TestTray.java b/test/dorkbox/TestTray.java index 89b4879..e1eaed9 100644 --- a/test/dorkbox/TestTray.java +++ b/test/dorkbox/TestTray.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package dorkbox; import java.awt.event.ActionListener;