diff --git a/build.gradle b/build.gradle index 1f5fe6d..3160580 100644 --- a/build.gradle +++ b/build.gradle @@ -1,104 +1,132 @@ -group 'com.onexip' -version '0.1.5.3-SNAPSHOT' - -task wrapper(type: Wrapper) { - gradleVersion = '4.2.1' +plugins { + id 'java-library' } -apply plugin: 'java' +dependencies { + compile('org.apache.commons:commons-collections4:4.1') -sourceCompatibility = 1.8 + implementation 'org.apache.commons:commons-collections4:4.1' -repositories { - mavenCentral() - maven { - url "http://mix-software.com:8081/nexus/content/repositories/onexip-snapshots" - } + testCompile('com.miglayout:miglayout-javafx:5.1.1-SNAPSHOT') + testCompile group: 'junit', name: 'junit', version: '4.12' + testCompile("org.testfx:testfx-core:4.0.8-alpha") + testCompile("org.testfx:testfx-junit:4.0.8-alpha") } -dependencies { - compile('org.apache.commons:commons-collections4:4.1') - testCompile('com.miglayout:miglayout-javafx:5.1.1-SNAPSHOT') - testCompile group: 'junit', name: 'junit', version: '4.12' - testCompile("org.testfx:testfx-core:4.0.8-alpha") - testCompile("org.testfx:testfx-junit:4.0.8-alpha") +// tag::compileJava[] +ext.moduleName = 'com.onexip.flexboxfx' +compileJava { + inputs.property("moduleName", moduleName) + doFirst { + options.compilerArgs = [ + '--module-path', classpath.asPath, + ] + classpath = files() + } +} +// end::compileJava[] + + +group 'com.onexip' +version '0.1.5.4-SNAPSHOT' + +task wrapper(type: Wrapper) { + gradleVersion = '4.9' } +apply plugin: 'java' +sourceCompatibility = 1.9 +targetCompatibility = 1.9 +repositories { + mavenCentral() + mavenLocal() + maven { + url "http://mix-software.com:8081/nexus/content/repositories/onexip-snapshots" + } +} apply plugin: 'maven' -apply plugin: 'signing' +/*apply plugin: 'signing'*/ + +if (project.hasProperty("signing.keyId")) { + apply plugin: 'signing' + signing { + sign configurations.archives + } +} task javadocJar(type: Jar) { - classifier = 'javadoc' - from javadoc + classifier = 'javadoc' +/* from javadoc*/ + from javadoc.destinationDir } task sourcesJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allSource + classifier = 'sources' + from sourceSets.main.allSource } artifacts { - archives javadocJar, sourcesJar + archives javadocJar, sourcesJar } -signing { - sign configurations.archives -} +/*signing { + sign configurations.archives +}*/ def isReleaseBuild() { - return version.contains("SNAPSHOT") == false + return version.contains("SNAPSHOT") == false } uploadArchives { - repositories { - mavenDeployer { - - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { - authentication(userName: ossrhUsername, password: ossrhPassword) - } - - snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { - authentication(userName: ossrhUsername, password: ossrhPassword) - } - - pom.project { - name 'FlexBoxFX' - packaging 'jar' - // optionally artifactId can be defined here - description 'port of CSS3 FlexBox' - //url 'http://www.example.com/example-application' - - scm { - connection 'scm:git:git@github.com:UltraMixer/FlexBoxFX.git' - developerConnection 'scm:git:https://github.com/UltraMixer/FlexBoxFX.git' - url 'https://github.com/UltraMixer/FlexBoxFX' - } - - licenses { - license { - name 'The Apache License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - - developers { - developer { - id 'tobiasbley' - name 'Tobias Bley' - email 'info@onexip.com' - } + repositories { + mavenDeployer { + + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: findProperty('ossrhUsername'), password: findProperty('ossrhPassword')) + } + + snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { + authentication(userName: findProperty('ossrhUsername'), password: findProperty('ossrhPassword')) + } + + pom.project { + name 'FlexBoxFX' + packaging 'jar' + // optionally artifactId can be defined here + description 'port of CSS3 FlexBox' + //url 'http://www.example.com/example-application' + + scm { + connection 'scm:git:git@github.com:UltraMixer/FlexBoxFX.git' + developerConnection 'scm:git:https://github.com/UltraMixer/FlexBoxFX.git' + url 'https://github.com/UltraMixer/FlexBoxFX' + } + + licenses { + license { + name 'The Apache License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + + developers { + developer { + id 'tobiasbley' + name 'Tobias Bley' + email 'info@onexip.com' + } + } + } } - } } - } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ed88a04..0d4a951 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 74bb778..94948c3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Wed Aug 08 09:23:46 BRT 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip diff --git a/src/main/java/com/onexip/flexboxfx/FlexBox.java b/src/main/java/com/onexip/flexboxfx/FlexBox.java index 9e338f2..6a83dac 100644 --- a/src/main/java/com/onexip/flexboxfx/FlexBox.java +++ b/src/main/java/com/onexip/flexboxfx/FlexBox.java @@ -345,8 +345,10 @@ public int compare(FlexBoxItem item1, FlexBoxItem item2) for (FlexBoxItem flexBoxItem : nodesList) { - double nodeWidth = Math.max(growWidth, flexBoxItem.minWidth); - nodeWidth = flexBoxItem.minWidth; + + //double nodeWidth = Math.max(growWidth, flexBoxItem.minWidth); + double nodeWidth = flexBoxItem.minWidth; + minWidthSum += nodeWidth; //is there one more node? @@ -360,7 +362,7 @@ public int compare(FlexBoxItem item1, FlexBoxItem item2) row++; flexBoxRow = new FlexBoxRow(); addToGrid(row, flexBoxRow); - minWidthSum = 0; + minWidthSum = nodeWidth; //0; bug with 0 } flexBoxRow.rowMinWidth += flexBoxItem.minWidth; flexBoxRow.flexGrowSum += flexBoxItem.grow; diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..8abf176 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module com.onexip.flexboxfx { + requires javafx.graphics; + requires transitive commons.collections4; + + exports com.onexip.flexboxfx; +} \ No newline at end of file diff --git a/src/test/java/com/onexip/flexboxfx/test/TestItemsGrowPercents.java b/src/test/java/com/onexip/flexboxfx/test/TestItemsGrowPercents.java new file mode 100644 index 0000000..2a53b59 --- /dev/null +++ b/src/test/java/com/onexip/flexboxfx/test/TestItemsGrowPercents.java @@ -0,0 +1,29 @@ +package com.onexip.flexboxfx.test; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +/** + * Created by TB on 11.10.16. + */ +public class TestItemsGrowPercents extends Application +{ + public void start(Stage primaryStage) throws Exception + { + Parent root = null; + FXMLLoader loader = new FXMLLoader(getClass().getResource("TestItemsGrowPercents.fxml")); + root = loader.load(); + Scene scene = new Scene(root); + + primaryStage.setScene(scene); + primaryStage.show(); + } + + public static void main(String[] args) + { + launch(args); + } +} diff --git a/src/test/resources/com/onexip/flexboxfx/test/TestItemsGrowPercents.fxml b/src/test/resources/com/onexip/flexboxfx/test/TestItemsGrowPercents.fxml new file mode 100644 index 0000000..1f599da --- /dev/null +++ b/src/test/resources/com/onexip/flexboxfx/test/TestItemsGrowPercents.fxml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + \ No newline at end of file