diff --git a/LICENSE b/LICENSE index 33bfec9..14b0cfb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,39 +1,318 @@ - - Dorkbox Notify - Apache 2.0 License - https://github.com/dorkbox - Copyright 2015, dorkbox, llc - Linux, MacOS, or Windows (notification/growl/toast/) popups for the desktop for Java 6+ + - Notify - + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Notify + Copyright 2021 + Dorkbox LLC + Linux, MacOS, or Windows (notification/growl/toast/) popups for the desktop for Java 8+ + + Extra license information + - SwingActiveRender - Active Renderer for Swing + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/SwingActiveRender + Copyright 2021 + Dorkbox LLC + + Extra license information + - PropertyLoader - Property annotation and loader for fields + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/PropertyLoader + Copyright 2021 + Dorkbox LLC + + - Utilities - Utilities for use within Java projects + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Utilities + Copyright 2021 + Dorkbox LLC + + Extra license information + - MersenneTwisterFast - + [BSD 3-Clause License] + https://git.dorkbox.com/dorkbox/Utilities + Copyright 2003 + Sean Luke + Michael Lecuyer (portions Copyright 1993 + + - FileUtil (code from FilenameUtils.java for normalize + dependencies) - + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Utilities + http://commons.apache.org/proper/commons-io/ + Copyright 2013 + The Apache Software Foundation + Kevin A. Burton + Scott Sanders + Daniel Rall + Christoph.Reck + Peter Donald + Jeff Turner + Matthew Hawthorne + Martin Cooper + Jeremias Maerki + Stephen Colebourne + + - FastThreadLocal - + [BSD 3-Clause License] + https://git.dorkbox.com/dorkbox/Utilities + https://github.com/LWJGL/lwjgl3/blob/5819c9123222f6ce51f208e022cb907091dd8023/modules/core/src/main/java/org/lwjgl/system/FastThreadLocal.java + https://github.com/riven8192/LibStruct/blob/master/src/net/indiespot/struct/runtime/FastThreadLocal.java + Copyright 2014 + Lightweight Java Game Library Project + Riven + + - Base64Fast - + [BSD 3-Clause License] + https://git.dorkbox.com/dorkbox/Utilities + http://migbase64.sourceforge.net/ + Copyright 2004 + Mikael Grev, MiG InfoCom AB. (base64@miginfocom.com) + + - BCrypt - + [BSD 2-Clause "Simplified" or "FreeBSD" license] + https://git.dorkbox.com/dorkbox/Utilities + http://www.mindrot.org/projects/jBCrypt + Copyright 2006 + Damien Miller (djm@mindrot.org) + GWT modified version + + - Bias, BinarySearch - + [MIT License] + https://git.dorkbox.com/dorkbox/Utilities + https://github.com/timboudreau/util + Copyright 2013 + Tim Boudreau + + - ConcurrentEntry - + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Utilities + Copyright 2016 + bennidi + dorkbox + + - Collection Utilities (Array, ArrayMap, BooleanArray, ByteArray, CharArray, FloatArray, IdentityMap, IntArray, IntFloatMap, IntIntMap, IntMap, IntSet, LongArray, LongMap, ObjectFloatMap, ObjectIntMap, ObjectMap, ObjectSet, OrderedMap, OrderedSet) - + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Utilities + https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/utils + Copyright 2011 + LibGDX + Mario Zechner (badlogicgames@gmail.com) + Nathan Sweet (nathan.sweet@gmail.com) + + - Predicate - + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Utilities + https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/utils + Copyright 2011 + LibGDX + Mario Zechner (badlogicgames@gmail.com) + Nathan Sweet (nathan.sweet@gmail.com) + xoppa + + - Select, QuickSelect - + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Utilities + https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/utils + Copyright 2011 + LibGDX + Mario Zechner (badlogicgames@gmail.com) + Nathan Sweet (nathan.sweet@gmail.com) + Jon Renner + + - TimSort, ComparableTimSort - + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Utilities + https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/utils + Copyright 2008 + The Android Open Source Project + + - Modified hex conversion utility methods - + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Utilities + https://netty.io + Copyright 2014 + The Netty Project + + - Retrofit - A type-safe HTTP client for Android and Java + [The Apache Software License, Version 2.0] + https://github.com/square/retrofit + Copyright 2020 + Square, Inc + + - JNA - Simplified native library access for Java. + [The Apache Software License, Version 2.0] + https://github.com/twall/jna + Copyright 2021 + Timothy Wall + + - JNA-Platform - Mappings for a number of commonly used platform functions + [The Apache Software License, Version 2.0] + https://github.com/twall/jna + Copyright 2021 + Timothy Wall + + - Java Uuid Generator - A set of Java classes for working with UUIDs + [The Apache Software License, Version 2.0] + https://github.com/cowtowncoder/java-uuid-generator + Copyright 2021 + Tatu Saloranta (tatu.saloranta@iki.fi) + Contributors. See source release-notes/CREDITS + + - Netty - An event-driven asynchronous network application framework + [The Apache Software License, Version 2.0] + https://netty.io + Copyright 2021 + The Netty Project + Contributors. See source NOTICE + + - Bouncy Castle Crypto - Lightweight cryptography API and JCE Extension + [The Apache Software License, Version 2.0] + http://www.bouncycastle.org + Copyright 2021 + The Legion of the Bouncy Castle Inc + + - Lightweight Java Game Library - Java library that enables cross-platform access to popular native APIs + [BSD 3-Clause License] + https://github.com/LWJGL/lwjgl3 + Copyright 2021 + Lightweight Java Game Library + + - TypeTools - A simple, zero-dependency library for working with types. Supports Java 1.6+ and Android. + [The Apache Software License, Version 2.0] + https://github.com/jhalterman/typetools + Copyright 2021 + Jonathan Halterman and friends + + - SLF4J - Simple facade or abstraction for various logging frameworks + [MIT License] + http://www.slf4j.org + Copyright 2021 + QOS.ch + + - XZ for Java - Complete implementation of XZ data compression in pure Java + [Public Domain, per Creative Commons CC0] + https://tukaani.org/xz/java.html + Copyright 2021 + Lasse Collin + Igor Pavlov + + - Executor - Shell, JVM, and SSH command execution on Linux, MacOS, or Windows for Java 8+ + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Executor + Copyright 2021 + Dorkbox LLC + + Extra license information + - ZT Process Executor - + [The Apache Software License, Version 2.0] + https://github.com/zeroturnaround/zt-exec + Copyright 2014 + ZeroTurnaround LLC + + - Apache Commons Exec - + [The Apache Software License, Version 2.0] + https://commons.apache.org/proper/commons-exec/ + Copyright 2014 + The Apache Software Foundation + + - Kotlin - + [The Apache Software License, Version 2.0] + https://github.com/JetBrains/kotlin + Copyright 2020 + JetBrains s.r.o. and Kotlin Programming Language contributors + Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply + See: https://github.com/JetBrains/kotlin/blob/master/license/README.md + + - kotlinx.coroutines - Library support for Kotlin coroutines with multiplatform support + [The Apache Software License, Version 2.0] + https://github.com/Kotlin/kotlinx.coroutines + Copyright 2021 + JetBrains s.r.o. + + - kotlin-logging - Lightweight logging framework for Kotlin + [The Apache Software License, Version 2.0] + https://github.com/MicroUtils/kotlin-logging + Copyright 2021 + Ohad Shai + + - SLF4J - Simple facade or abstraction for various logging frameworks + [MIT License] + http://www.slf4j.org + Copyright 2021 + QOS.ch + + - SSHJ - SSHv2 library for Java + [The Apache Software License, Version 2.0] + https://github.com/hierynomus/sshj + Copyright 2021 + Jeroen van Erp + SSHJ Contributors + + Extra license information + - Apache MINA - + [The Apache Software License, Version 2.0] + https://mina.apache.org/sshd-project/ + The Apache Software Foundation + + - Apache Commons-Net - + [The Apache Software License, Version 2.0] + https://commons.apache.org/proper/commons-net/ + The Apache Software Foundation + + - JZlib - + [The Apache Software License, Version 2.0] + http://www.jcraft.com/jzlib + Atsuhiko Yamanaka + JCraft, Inc. + + - Bouncy Castle Crypto - + [The Apache Software License, Version 2.0] + http://www.bouncycastle.org + The Legion of the Bouncy Castle Inc + + - ed25519-java - + [Public Domain, per Creative Commons CC0] + https://github.com/str4d/ed25519-java + https://github.com/str4d + + - SwtJavaFx - Swt and JavaFx Utilities + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/SwtJavaFx + Copyright 2021 + Dorkbox LLC + + Extra license information + - Eclipse Platform - Frameworks and common services to support the use of Eclipse and it's tools (SWT) + [Eclipse Public License (EPL)] + https://projects.eclipse.org/projects/eclipse.platform + Copyright 2021 + The Eclipse Foundation, Inc. + + - OpenJFX - OpenJFX client application platform for desktop, mobile and embedded systems + [GNU General Public License, version 2, with the Classpath Exception] + https://github.com/openjdk/jfx + Copyright 2021 + Oracle and/or its affiliates + + - SLF4J - Simple facade or abstraction for various logging frameworks + [MIT License] + http://www.slf4j.org + Copyright 2021 + QOS.ch + + - PropertyLoader - Property annotation and loader for fields + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/PropertyLoader + Copyright 2021 + Dorkbox LLC + + - PropertyLoader - Property annotation and loader for fields + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/PropertyLoader + Copyright 2021 + Dorkbox LLC - - ControlsFX - BSD 3-clause License - https://bitbucket.org/controlsfx/controlsfx/ - Copyright 2013, 2014, ControlsFX - Dialog icons by the ControlsFX project - - - - Dorkbox ObjectPool - Apache 2.0 License - https://github.com/dorkbox - Copyright 2014, dorkbox, llc - Fast, lightweight, and compatible blocking/non-blocking/soft-reference object pool for Java 6+ - - - - Dorkbox TweenEngine - Apache 2.0 License - https://github.com/dorkbox - Copyright 2015, dorkbox, llc - High performance and lightweight Animation/Tween framework for Java 6+ - - - - Java Universal Tween Engine - Apache 2.0 License - https://code.google.com/p/java-universal-tween-engine/ - Copyright 2012, Aurelien Ribon - Abandoned project, origin of TweenEngine code fork. - - - - Robert Penner's Easing Functions - BSD 3-clause License - http://robertpenner.com/easing/ - Copyright 2001, Robert Penner - Tween easing algorithms - - - - SLF4J - MIT License - http://www.slf4j.org - Copyright 2004-2008, QOS.ch + - Dorkbox TweenEngine - + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/TweenEngine + Copyright 2021 + Dorkbox LLC diff --git a/build.gradle.kts b/build.gradle.kts index 77c02e2..da0fded 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,45 +14,29 @@ * limitations under the License. */ -import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask import java.time.Instant -import java.util.Properties -import kotlin.collections.ArrayList -import kotlin.collections.component1 -import kotlin.collections.component2 -import kotlin.collections.set -import kotlin.reflect.KMutableProperty -import kotlin.reflect.full.declaredMemberProperties /////////////////////////////// ////// PUBLISH TO SONATYPE / MAVEN CENTRAL -////// -////// TESTING : local maven repo -////// -////// RELEASE : sonatype / maven central, then +////// TESTING : (to local maven repo) <'publish and release' - 'publishToMavenLocal'> +////// RELEASE : (to sonatype/maven central), <'publish and release' - 'publishToSonatypeAndRelease'> /////////////////////////////// -println("\tGradle ${project.gradle.gradleVersion} on Java ${JavaVersion.current()}") +gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS_FULL // always show the stacktrace! +gradle.startParameter.warningMode = WarningMode.All plugins { - java - signing - `maven-publish` + id("com.dorkbox.GradleUtils") version "1.12" + id("com.dorkbox.Licensing") version "2.5.4" + id("com.dorkbox.VersionUpdate") version "2.1" + id("com.dorkbox.GradlePublish") version "1.10" - // close and release on sonatype - id("io.codearte.nexus-staging") version "0.20.0" - - id("com.dorkbox.CrossCompile") version "1.0.1" - id("com.dorkbox.Licensing") version "1.4" - id("com.dorkbox.VersionUpdate") version "1.4.1" - id("com.dorkbox.GradleUtils") version "1.0" - - kotlin("jvm") version "1.3.11" + kotlin("jvm") version "1.4.21-2" } object Extras { // set for the project - const val description = "Linux, MacOS, or Windows (notification/growl/toast/) popups for the desktop for Java 6+" + const val description = "Linux, MacOS, or Windows (notification/growl/toast/) popups for the desktop for Java 8+" const val group = "com.dorkbox" const val version = "3.7" @@ -60,45 +44,18 @@ object Extras { const val name = "Notify" const val id = "Notify" const val vendor = "Dorkbox LLC" + const val vendorUrl = "https://dorkbox.com" const val url = "https://git.dorkbox.com/dorkbox/Notify" val buildDate = Instant.now().toString() - - val JAVA_VERSION = JavaVersion.VERSION_1_6.toString() - - var sonatypeUserName = "" - var sonatypePassword = "" } /////////////////////////////// ///// assign 'Extras' -///////////////////////////////z -description = Extras.description -group = Extras.group -version = Extras.version - -val propsFile = File("$projectDir/../../gradle.properties").normalize() -if (propsFile.canRead()) { - println("\tLoading custom property data from: [$propsFile]") - - val props = Properties() - propsFile.inputStream().use { - props.load(it) - } - - val extraProperties = Extras::class.declaredMemberProperties.filterIsInstance>() - props.forEach { (k, v) -> run { - val key = k as String - val value = v as String - - val member = extraProperties.find { it.name == key } - if (member != null) { - member.setter.call(Extras::class.objectInstance, value) - } - else { - project.extra.set(k, v) - } - }} -} +/////////////////////////////// +GradleUtils.load("$projectDir/../../gradle.properties", Extras) +GradleUtils.fixIntellijPaths() +GradleUtils.defaultResolutionStrategy() +GradleUtils.compileConfiguration(JavaVersion.VERSION_1_8) licensing { license(License.APACHE_2) { @@ -107,11 +64,6 @@ licensing { note(Extras.description) } - license("Dorkbox Utils", License.APACHE_2) { - author(Extras.vendor) - url("https://git.dorkbox.com/dorkbox/Utilities") - } - license("Dorkbox TweenEngine", License.APACHE_2) { author(Extras.vendor) url("https://git.dorkbox.com/dorkbox/TweenEngine") @@ -126,6 +78,11 @@ sourceSets { // want to include java files for the source. 'setSrcDirs' resets includes... include("**/*.java") } + + resources { + setSrcDirs(listOf("resources")) + include("*.png") + } } test { @@ -135,6 +92,11 @@ sourceSets { // want to include java files for the source. 'setSrcDirs' resets includes... include("**/*.java") } + + resources { + setSrcDirs(listOf("test")) + include("*.png") + } } } @@ -146,17 +108,6 @@ repositories { /////////////////////////////// ////// Task defaults /////////////////////////////// -tasks.withType { - options.encoding = "UTF-8" - - sourceCompatibility = Extras.JAVA_VERSION - targetCompatibility = Extras.JAVA_VERSION -} - -tasks.withType { - duplicatesStrategy = DuplicatesStrategy.FAIL -} - tasks.jar.get().apply { manifest { // https://docs.oracle.com/javase/tutorial/deployment/jar/packageman.html @@ -174,118 +125,33 @@ tasks.jar.get().apply { } } -tasks.compileJava.get().apply { - println("\tCompiling classes to Java $sourceCompatibility") -} - - dependencies { implementation("com.dorkbox:TweenEngine:8.3") - implementation("com.dorkbox:Utilities:1.1") + implementation("com.dorkbox:SwingActiveRender:1.1") + implementation("com.dorkbox:Utilities:1.9") + implementation("com.dorkbox:PropertyLoader:1.0") } -/////////////////////////////// -////// PUBLISH TO SONATYPE / MAVEN CENTRAL -////// -////// TESTING : local maven repo -////// -////// RELEASE : sonatype / maven central, then -/////////////////////////////// -val sourceJar = task("sourceJar") { - description = "Creates a JAR that contains the source code." +publishToSonatype { + groupId = Extras.group + artifactId = Extras.id + version = Extras.version - from(sourceSets["main"].java) + name = Extras.name + description = Extras.description + url = Extras.url - archiveClassifier.set("sources") -} + vendor = Extras.vendor + vendorUrl = Extras.vendorUrl -val javaDocJar = task("javaDocJar") { - description = "Creates a JAR that contains the javadocs." - - archiveClassifier.set("javadoc") -} - -publishing { - publications { - create("maven") { - groupId = Extras.group - artifactId = Extras.id - version = Extras.version - - from(components["java"]) - - artifact(sourceJar) - artifact(javaDocJar) - - pom { - name.set(Extras.name) - description.set(Extras.description) - url.set(Extras.url) - - issueManagement { - url.set("${Extras.url}/issues") - system.set("Gitea Issues") - } - organization { - name.set(Extras.vendor) - url.set("https://dorkbox.com") - } - developers { - developer { - id.set("dorkbox") - name.set(Extras.vendor) - email.set("email@dorkbox.com") - } - } - scm { - url.set(Extras.url) - connection.set("scm:${Extras.url}.git") - } - } - - } + issueManagement { + url = "${Extras.url}/issues" + nickname = "Gitea Issues" } - - repositories { - maven { - setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2") - credentials { - username = Extras.sonatypeUserName - password = Extras.sonatypePassword - } - } - } - - - tasks.withType { - onlyIf { - publication == publishing.publications["maven"] && repository == publishing.repositories["maven"] - } - } - - tasks.withType { - onlyIf { - publication == publishing.publications["maven"] - } - } - - // output the release URL in the console - tasks["releaseRepository"].doLast { - val url = "https://oss.sonatype.org/content/repositories/releases/" - val projectName = Extras.group.replace('.', '/') - val name = Extras.name - val version = Extras.version - - println("Maven URL: $url$projectName/$name/$version/") + developer { + id = "dorkbox" + name = Extras.vendor + email = "email@dorkbox.com" } } - -nexusStaging { - username = Extras.sonatypeUserName - password = Extras.sonatypePassword -} - -signing { - sign(publishing.publications["maven"]) -} diff --git a/src/dorkbox/notify/ActionHandler.java b/src/dorkbox/notify/ActionHandler.java new file mode 100644 index 0000000..c83c62f --- /dev/null +++ b/src/dorkbox/notify/ActionHandler.java @@ -0,0 +1,21 @@ +/* + * 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.notify; + +public +interface ActionHandler { + void handle(T value); +} diff --git a/src/dorkbox/notify/LookAndFeel.java b/src/dorkbox/notify/LookAndFeel.java index daf0154..03651c6 100644 --- a/src/dorkbox/notify/LookAndFeel.java +++ b/src/dorkbox/notify/LookAndFeel.java @@ -24,15 +24,14 @@ import java.util.Iterator; import java.util.Map; import java.util.Random; +import dorkbox.swingActiveRender.ActionHandlerLong; +import dorkbox.swingActiveRender.SwingActiveRender; import dorkbox.tweenEngine.BaseTween; import dorkbox.tweenEngine.Tween; import dorkbox.tweenEngine.TweenCallback; import dorkbox.tweenEngine.TweenEngine; import dorkbox.tweenEngine.TweenEquations; -import dorkbox.util.ActionHandler; -import dorkbox.util.ActionHandlerLong; import dorkbox.util.ScreenUtil; -import dorkbox.util.swing.SwingActiveRender; @SuppressWarnings({"FieldCanBeLocal"}) class LookAndFeel { diff --git a/src/dorkbox/notify/Notify.java b/src/dorkbox/notify/Notify.java index cff4305..0fd8c9d 100644 --- a/src/dorkbox/notify/Notify.java +++ b/src/dorkbox/notify/Notify.java @@ -17,7 +17,6 @@ package dorkbox.notify; import java.awt.Image; import java.awt.image.BufferedImage; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.lang.ref.SoftReference; @@ -28,10 +27,9 @@ import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; -import dorkbox.util.ActionHandler; +import dorkbox.propertyLoader.Property; import dorkbox.util.ImageUtil; import dorkbox.util.LocationResolver; -import dorkbox.util.Property; import dorkbox.util.SwingUtil; /** @@ -129,11 +127,11 @@ class Notify { throw new RuntimeException("Unable to set an image that already has been set. This action must be done as soon as possible."); } - Image imageImmediate = ImageUtil.getImageImmediate(image); + ImageUtil.waitForImageLoad(image); // we only use 48x48 pixel images. Resize as necessary - int width = imageImmediate.getWidth(null); - int height = imageImmediate.getHeight(null); + int width = image.getWidth(null); + int height = image.getHeight(null); BufferedImage bufferedImage; @@ -161,11 +159,12 @@ class Notify { } if (image == null) { - String name = IMAGE_PATH + File.separatorChar + imageName; + // String name = IMAGE_PATH + File.separatorChar + imageName; + String name = imageName; resourceAsStream = LocationResolver.getResourceAsStream(name); - image = new ImageIcon(ImageUtil.getImageImmediate(ImageIO.read(resourceAsStream))); + image = new ImageIcon(ImageIO.read(resourceAsStream)); imageCache.put(imageName, new SoftReference(image)); } } catch (IOException e) { diff --git a/test/NotifyTest.java b/test/NotifyTest.java index a4ec722..6483443 100644 --- a/test/NotifyTest.java +++ b/test/NotifyTest.java @@ -26,7 +26,6 @@ import javax.swing.JPanel; import dorkbox.notify.Notify; import dorkbox.notify.Pos; -import dorkbox.util.ActionHandler; import dorkbox.util.ImageUtil; import dorkbox.util.LocationResolver; import dorkbox.util.ScreenUtil; @@ -63,104 +62,107 @@ class NotifyTest { int count = 2; - for (int i = 0; i < count; i++) { - final int finalI = i; - notify = Notify.create() - .title("Notify title " + i) - .text("This is a notification " + i + " popup message This is a notification popup message This is a " + - "notification popup message") - .hideAfter(13000) - .position(Pos.BOTTOM_RIGHT) - // .position(Pos.CENTER) - // .setScreen(0) - .darkStyle() - // .shake(1300, 4) - .shake(1300, 10) - .attach(frame) - .hideCloseButton() - .onAction(new ActionHandler() { - @Override - public - void handle(final Notify arg0) { - System.err.println("Notification " + finalI + " clicked on!"); - } - }); - notify.showWarning(); - - // try { - // Thread.sleep(1000); - // } catch (InterruptedException e) { - // e.printStackTrace(); - // } - } - - for (int i = 0; i < count; i++) { - final int finalI = i; - notify = Notify.create() - .title("Notify title " + i) - .text("This is a notification " + i + " popup message This is a notification popup message This is a " + - "notification popup message") - .hideAfter(13000) - .position(Pos.TOP_LEFT) - // .position(Pos.CENTER) - // .setScreen(0) - // .darkStyle() - // .shake(1300, 4) - // .shake(1300, 10) - .attach(frame) - // .hideCloseButton() - .onAction(new ActionHandler() { - @Override - public - void handle(final Notify arg0) { - System.err.println("Notification " + finalI + " clicked on!"); - } - }); - notify.showWarning(); - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - - - - for (int i = 0; i < count; i++) { - final int finalI = i; - notify = Notify.create() - .title("Notify title " + i) - .text("This is a notification " + i + " popup message This is a notification popup message This is a " + - "notification popup message") - .hideAfter(3000) - .position(Pos.TOP_RIGHT) -// .setScreen(0) - .darkStyle() - // .shake(1300, 4) - .shake(1300, 10) - .hideCloseButton() - .onAction(new ActionHandler() { - @Override - public - void handle(final Notify arg0) { - System.err.println("Notification " + finalI + " clicked on!"); - } - }); - notify.show(); - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } +// for (int i = 0; i < count; i++) { +// final int finalI = i; +// notify = Notify.create() +// .title("Notify title " + i) +// .text("This is a notification " + i + " popup message This is a notification popup message This is a " + +// "notification popup message") +// .hideAfter(13000) +// .position(Pos.BOTTOM_RIGHT) +// // .position(Pos.CENTER) +// // .setScreen(0) +// .darkStyle() +// // .shake(1300, 4) +// .shake(1300, 10) +// .attach(frame) +// .hideCloseButton() +// .onAction(new ActionHandler() { +// @Override +// public +// void handle(final Notify arg0) { +// System.err.println("Notification " + finalI + " clicked on!"); +// } +// }); +// notify.showWarning(); +// +// // try { +// // Thread.sleep(1000); +// // } catch (InterruptedException e) { +// // e.printStackTrace(); +// // } +// } +// +// for (int i = 0; i < count; i++) { +// final int finalI = i; +// notify = Notify.create() +// .title("Notify title " + i) +// .text("This is a notification " + i + " popup message This is a notification popup message This is a " + +// "notification popup message") +// .hideAfter(13000) +// .position(Pos.TOP_LEFT) +// // .position(Pos.CENTER) +// // .setScreen(0) +// // .darkStyle() +// // .shake(1300, 4) +// // .shake(1300, 10) +// .attach(frame) +// // .hideCloseButton() +// .onAction(new ActionHandler() { +// @Override +// public +// void handle(final Notify arg0) { +// System.err.println("Notification " + finalI + " clicked on!"); +// } +// }); +// notify.showWarning(); +// +// try { +// Thread.sleep(1000); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } +// } +// +// +// +// +// for (int i = 0; i < count; i++) { +// final int finalI = i; +// notify = Notify.create() +// .title("Notify title " + i) +// .text("This is a notification " + i + " popup message This is a notification popup message This is a " + +// "notification popup message") +// .hideAfter(3000) +// .position(Pos.TOP_RIGHT) +// // .setScreen(0) +// .darkStyle() +// // .shake(1300, 4) +// .shake(1300, 10) +// .hideCloseButton() +// .onAction(new ActionHandler() { +// @Override +// public +// void handle(final Notify arg0) { +// System.err.println("Notification " + finalI + " clicked on!"); +// } +// }); +// notify.show(); +// +// try { +// Thread.sleep(1000); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } +// } + // The purpose of this, is to display this image AS A SQUARE! InputStream resourceAsStream = LocationResolver.getResourceAsStream("notify-dark.png"); Image image = null; try { - image = ImageUtil.getImageImmediate(ImageIO.read(resourceAsStream)); + image = ImageIO.read(resourceAsStream); + ImageUtil.waitForImageLoad(image); + // image = image.getScaledInstance(144, 104, Image.SCALE_SMOOTH); // image = image.getScaledInstance(104, 144, Image.SCALE_SMOOTH); image = image.getScaledInstance(144, 144, Image.SCALE_SMOOTH); @@ -168,41 +170,59 @@ class NotifyTest { e.printStackTrace(); } - - for (int i = 0; i < count; i++) { - final int finalI = i; - notify = Notify.create() - .title("Notify title " + i) - .text("This is a notification " + i + " popup message This is a notification popup message This is a " + - "notification popup message") - // .hideAfter(13000) - .position(Pos.BOTTOM_LEFT) + notify = Notify.create() + .title("Notify scaled") + .text("This is a notification popup message scaled This is a notification popup message This is a " + + "notification popup message scaled ") + // .hideAfter(13000) + .position(Pos.BOTTOM_LEFT) // .setScreen(0) // .darkStyle() - // .shake(1300, 4) - // .shake(1300, 10) - // .hideCloseButton() - .onAction(new ActionHandler() { - @Override - public - void handle(final Notify arg0) { - System.err.println("Notification " + finalI + " clicked on!"); - } - }); + // .shake(1300, 4) + // .shake(1300, 10) + // .hideCloseButton() + .onAction(arg0->System.err.println("Notification scaled clicked on!")); - if (i == 0) { - notify.image(image); - notify.show(); - } - else { - notify.showConfirm(); - } + notify.image(image); + notify.show(); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } + + +// +// for (int i = 0; i < count; i++) { +// final int finalI = i; +// notify = Notify.create() +// .title("Notify title " + i) +// .text("This is a notification " + i + " popup message This is a notification popup message This is a " + +// "notification popup message") +// // .hideAfter(13000) +// .position(Pos.BOTTOM_LEFT) +// // .setScreen(0) +// // .darkStyle() +// // .shake(1300, 4) +// // .shake(1300, 10) +// // .hideCloseButton() +// .onAction(new ActionHandler() { +// @Override +// public +// void handle(final Notify arg0) { +// System.err.println("Notification " + finalI + " clicked on!"); +// } +// }); +// +// if (i == 0) { +// notify.image(image); +// notify.show(); +// } +// else { +// notify.showConfirm(); +// } +// +// try { +// Thread.sleep(1000); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } +// } } } diff --git a/test/notify-dark.png b/test/notify-dark.png new file mode 100644 index 0000000..c9478ca Binary files /dev/null and b/test/notify-dark.png differ