From 2371ae06ac81d68af669a9c5e953ae8c9b164d6b Mon Sep 17 00:00:00 2001 From: Gerrit Grunwald Date: Mon, 28 Oct 2024 10:46:49 +0100 Subject: [PATCH] Fix for issue #158 --- build.gradle | 74 +++++++++++-------- src/main/java/eu/hansolo/tilesfx/Demo.java | 3 + .../tilesfx/skins/CalendarTileSkin.java | 2 +- .../hansolo/tilesfx/skins/ClockTileSkin.java | 4 +- .../hansolo/tilesfx/skins/DateTileSkin.java | 2 +- .../tilesfx/skins/TimelineTileSkin.java | 2 +- .../java/eu/hansolo/tilesfx/tools/Helper.java | 6 +- 7 files changed, 53 insertions(+), 40 deletions(-) diff --git a/build.gradle b/build.gradle index 6f91d6d3..969cd894 100644 --- a/build.gradle +++ b/build.gradle @@ -16,26 +16,51 @@ * limitations under the License. */ +import java.text.SimpleDateFormat import groovy.json.JsonOutput import groovy.json.JsonSlurper import java.text.SimpleDateFormat +buildscript { + repositories { + mavenCentral() + maven { + url "https://plugins.gradle.org/m2/" + } + } + dependencies { + classpath 'com.google.gradle:osdetector-gradle-plugin:1.7.3' + classpath 'org.javamodularity:moduleplugin:1.8.15' + } +} + plugins { - id 'idea' + id 'java' id 'java-library' - id 'maven-publish' id 'signing' + id 'maven-publish' id 'com.google.osdetector' version '1.7.3' id 'org.javamodularity.moduleplugin' version '1.8.15' - id 'org.beryx.jlink' version '3.0.1' id 'net.nemerosa.versioning' version '3.1.0' + id 'org.beryx.jlink' version '3.0.1' } -apply plugin: 'maven-publish' apply plugin: 'signing' +apply plugin: 'maven-publish' -description = 'TilesFX is a JavaFX library containing tiles for dashboards' +normalization { + runtimeClasspath { + ignore('/META-INF/MANIFEST.MF') + } +} + +repositories { + mavenCentral() + flatDir { + dirs 'libs' + } +} Date buildTimeAndDate = new Date() ext { @@ -51,10 +76,6 @@ ext { gpgpassphrase = System.getenv("PASSPHRASE") } -repositories { - mavenCentral() -} - dependencies { api "eu.hansolo.fx:countries:21.0.17" implementation "org.openjfx:javafx-base:${javafxVersion}:${platform}" @@ -65,25 +86,22 @@ dependencies { implementation "org.openjfx:javafx-media:${javafxVersion}:${platform}" } -application { - mainClass = "eu.hansolo.tilesfx.DemoLauncher" - mainModule = moduleName -} +application.mainModule = 'eu.hansolo.tilesfx' +mainClassName = 'eu.hansolo.tilesfx.DemoLauncher' +description = 'TilesFX is a JavaFX library containing tiles for dashboards' -java { - // Set to false per https://github.com/java9-modularity/gradle-modules-plugin - modularity.inferModulePath.set(false) -} jar { + from { - //duplicatesStrategy = DuplicatesStrategy.EXCLUDE - //configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } { exclude "META-INF/*.SF" exclude "META-INF/*.DSA" exclude "META-INF/*.RSA" } + manifest { attributes( 'Built-By' : System.properties['user.name'], @@ -97,28 +115,20 @@ jar { 'Implementation-Version': project.version, 'Bundle-Name' : project.name, 'Bundle-License' : 'https://www.apache.org/licenses/LICENSE-2.0;description=Apache License Version 2.0;link=https://spdx.org/licenses/Apache-2.0.html', - 'Bundle-Description' : project.description, + 'Bundle-Description' : description, 'Bundle-Version' : project.version, 'Bundle-SymbolicName' : 'eu.hansolo.tilesfx', 'Export-Package' : 'eu.hansolo.tilesfx, eu.hansolo.tilesfx.chart, eu.hansolo.tilesfx.colors, eu.hansolo.tilesfx.events, eu.hansolo.tilesfx.fonts, eu.hansolo.tilesfx.icons, eu.hansolo.tilesfx.skins,eu.hansolo.tilesfx.tools', - 'Class-Path' : "${project.name}-${project.version}.jar", - 'Main-Class' : application.mainClass + 'Class-Path' : '${project.name}-${project.version}.jar', + 'Main-Class' : 'eu.hansolo.tilesfx.DemoLauncher' ) } } -if (JavaVersion.current().isJava8Compatible()) { - allprojects { - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } - } -} - - +// start demo from gradle task Demo(type: JavaExec) { - mainClass = 'eu.hansolo.tilesfx.DemoLauncher' + mainClass = "eu.hansolo.tilesfx.DemoLauncher" classpath = sourceSets.main.runtimeClasspath } diff --git a/src/main/java/eu/hansolo/tilesfx/Demo.java b/src/main/java/eu/hansolo/tilesfx/Demo.java index b34bb019..16f16f12 100644 --- a/src/main/java/eu/hansolo/tilesfx/Demo.java +++ b/src/main/java/eu/hansolo/tilesfx/Demo.java @@ -351,6 +351,9 @@ public class Demo extends Application { .skinType(SkinType.GAUGE) .prefSize(TILE_WIDTH, TILE_HEIGHT) .title("Gauge Tile") + .sections(SectionBuilder.create().start(0).stop(20).color(Dark.GREEN).build(), + SectionBuilder.create().start(80).stop(100).color(Dark.RED).build()) + .sectionsVisible(true) .unit("V") .threshold(75) .build(); diff --git a/src/main/java/eu/hansolo/tilesfx/skins/CalendarTileSkin.java b/src/main/java/eu/hansolo/tilesfx/skins/CalendarTileSkin.java index 6056c160..8c7df7e2 100644 --- a/src/main/java/eu/hansolo/tilesfx/skins/CalendarTileSkin.java +++ b/src/main/java/eu/hansolo/tilesfx/skins/CalendarTileSkin.java @@ -54,7 +54,7 @@ public class CalendarTileSkin extends TileSkin { private static final DateTimeFormatter DAY_FORMATTER = DateTimeFormatter.ofPattern("EEEE"); - private static final DateTimeFormatter MONTH_YEAR_FORMATTER = DateTimeFormatter.ofPattern("MMMM YYYY"); + private static final DateTimeFormatter MONTH_YEAR_FORMATTER = DateTimeFormatter.ofPattern("MMMM yyyy"); private Border weekBorder; private Text titleText; private Text text; diff --git a/src/main/java/eu/hansolo/tilesfx/skins/ClockTileSkin.java b/src/main/java/eu/hansolo/tilesfx/skins/ClockTileSkin.java index 935793d9..939cb160 100644 --- a/src/main/java/eu/hansolo/tilesfx/skins/ClockTileSkin.java +++ b/src/main/java/eu/hansolo/tilesfx/skins/ClockTileSkin.java @@ -63,7 +63,7 @@ public ClockTileSkin(final Tile TILE) { timeListener = o -> updateTime(tile.getTime()); timeFormatter = DateTimeFormatter.ofPattern("HH:mm", tile.getLocale()); - dateFormatter = DateTimeFormatter.ofPattern("dd MMM YYYY", tile.getLocale()); + dateFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy", tile.getLocale()); dayOfWeekFormatter = DateTimeFormatter.ofPattern("EEEE", tile.getLocale()); titleText = new Text(""); @@ -190,7 +190,7 @@ public void updateTime(final ZonedDateTime TIME) { titleText.setText(tile.getTitle()); text.setText(tile.getText()); timeFormatter = DateTimeFormatter.ofPattern("HH:mm", tile.getLocale()); - dateFormatter = DateTimeFormatter.ofPattern("dd MMM YYYY", tile.getLocale()); + dateFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy", tile.getLocale()); dayOfWeekFormatter = DateTimeFormatter.ofPattern("EEEE", tile.getLocale()); ZonedDateTime time = tile.getTime(); diff --git a/src/main/java/eu/hansolo/tilesfx/skins/DateTileSkin.java b/src/main/java/eu/hansolo/tilesfx/skins/DateTileSkin.java index 956c8cd6..389cd79f 100644 --- a/src/main/java/eu/hansolo/tilesfx/skins/DateTileSkin.java +++ b/src/main/java/eu/hansolo/tilesfx/skins/DateTileSkin.java @@ -33,7 +33,7 @@ public class DateTileSkin extends TileSkin { private static final DateTimeFormatter DAY_FORMATTER = DateTimeFormatter.ofPattern("EEEE"); - private static final DateTimeFormatter MONTH_YEAR_FORMATTER = DateTimeFormatter.ofPattern("MMMM YYYY"); + private static final DateTimeFormatter MONTH_YEAR_FORMATTER = DateTimeFormatter.ofPattern("MMMM yyyy"); private Text titleText; private Text text; private Label description; diff --git a/src/main/java/eu/hansolo/tilesfx/skins/TimelineTileSkin.java b/src/main/java/eu/hansolo/tilesfx/skins/TimelineTileSkin.java index 6545070d..e9d3b065 100644 --- a/src/main/java/eu/hansolo/tilesfx/skins/TimelineTileSkin.java +++ b/src/main/java/eu/hansolo/tilesfx/skins/TimelineTileSkin.java @@ -98,7 +98,7 @@ public class TimelineTileSkin extends TileSkin { private static final DateTimeFormatter HOUR_FORMATTER = DateTimeFormatter.ofPattern("HH:mm"); private static final DateTimeFormatter MINUTE_FORMATTER = DateTimeFormatter.ofPattern("HH:mm"); private static final DateTimeFormatter SECOND_FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss"); - private DateTimeFormatter DTF = DateTimeFormatter.ofPattern("dd.YY HH:mm"); + private DateTimeFormatter DTF = DateTimeFormatter.ofPattern("dd.yy HH:mm"); private DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm"); private Text titleText; private Text valueText; diff --git a/src/main/java/eu/hansolo/tilesfx/tools/Helper.java b/src/main/java/eu/hansolo/tilesfx/tools/Helper.java index 1b160659..53c148fb 100644 --- a/src/main/java/eu/hansolo/tilesfx/tools/Helper.java +++ b/src/main/java/eu/hansolo/tilesfx/tools/Helper.java @@ -371,11 +371,11 @@ public static final void fitNodeWidth(final Node NODE, final double MAX_WIDTH) { public static final DateTimeFormatter getDateFormat(final Locale LOCALE) { if (Locale.US == LOCALE) { - return DateTimeFormatter.ofPattern("MM/dd/YYYY"); + return DateTimeFormatter.ofPattern("MM/dd/yyyy"); } else if (Locale.CHINA == LOCALE) { - return DateTimeFormatter.ofPattern("YYYY.MM.dd"); + return DateTimeFormatter.ofPattern("yyyy.MM.dd"); } else { - return DateTimeFormatter.ofPattern("dd.MM.getY()YYY"); + return DateTimeFormatter.ofPattern("dd.MM.yyyy"); } } public static final DateTimeFormatter getLocalizedDateFormat(final Locale LOCALE) {