Prepare for publish

This commit is contained in:
Christopher Schnick 2022-01-10 07:10:44 +01:00
parent b192fd5b09
commit cd93f934ff
23 changed files with 253 additions and 329 deletions

View file

@ -1,35 +1,28 @@
plugins { plugins {
id 'java' id 'java-library'
id 'maven-publish'
id 'signing'
id "org.moditect.gradleplugin" version "1.0.0-rc3" id "org.moditect.gradleplugin" version "1.0.0-rc3"
} }
java { apply from: "$rootDir/deps/java.gradle"
sourceCompatibility = JavaVersion.VERSION_17 apply from: "$rootDir/deps/commons.gradle"
targetCompatibility = JavaVersion.VERSION_17 apply from: "$rootDir/deps/jackson.gradle"
} apply from: "$rootDir/deps/junit.gradle"
apply from: 'publish.gradle'
apply from: "$rootDir/deps/publish-base.gradle"
version = file('../version').text
group = 'io.xpipe'
archivesBaseName = 'api'
repositories { repositories {
mavenCentral() mavenCentral()
maven { url "https://jitpack.io" }
} }
plugins.withType(JavaPlugin).configureEach {
java {
modularity.inferModulePath = true
}
}
apply from: "$rootDir/deps/commons.gradle"
apply from: "$rootDir/deps/jackson.gradle"
dependencies { dependencies {
implementation project(':core') implementation project(':core')
implementation project(':beacon') implementation project(':beacon')
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
//testRuntimeOnly project(':app')
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
} }
test { test {
@ -39,12 +32,10 @@ test {
showStandardStreams = true showStandardStreams = true
} }
//workingDir = project(":app").projectDir systemProperty 'io.xpipe.beacon.exec', 'start_test_daemon.bat'
systemProperty 'io.xpipe.beacon.startInProcess', 'true'
systemProperty "io.xpipe.daemon.mode", 'base' systemProperty "io.xpipe.daemon.mode", 'base'
systemProperty "io.xpipe.storage.dir", "$projectDir/test_env" systemProperty "io.xpipe.storage.dir", "$projectDir/test_env"
systemProperty "io.xpipe.beacon.port", "21722" systemProperty "io.xpipe.beacon.port", "21722"
systemProperty 'io.xpipe.app.writeSysOut', "true" systemProperty 'io.xpipe.app.writeSysOut', "true"
systemProperty 'io.xpipe.app.logLevel', "debug" systemProperty 'io.xpipe.app.logLevel', "trace"
} }

35
api/publish.gradle Normal file
View file

@ -0,0 +1,35 @@
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'X-Pipe API'
description = 'Contains everything necessary to use and interact with X-Pipe.'
url = 'https://github.com/xpipe-io/xpipe_java/api'
licenses {
license {
name = 'The MIT License (MIT)'
url = 'https://github.com/xpipe-io/xpipe_java/LICENSE.md'
}
}
developers {
developer {
id = 'crschnick'
name = 'Christopher Schnick'
email = 'crschnick@xpipe.io'
}
}
scm {
connection = 'scm:git:git://github.com/xpipe-io/xpipe_java.git'
developerConnection = 'scm:git:ssh://github.com/xpipe-io/xpipe_java.git'
url = 'https://github.com/xpipe-io/xpipe_java'
}
withXml {
//asNode().appendNode('dependencies').appendNode('dependency').appendNode('my-property', 'my-value')
}
}
}
}
}

View file

@ -1,29 +1,27 @@
plugins { plugins {
id 'java' id 'java-library'
id 'maven-publish'
id 'signing'
id "org.moditect.gradleplugin" version "1.0.0-rc3" id "org.moditect.gradleplugin" version "1.0.0-rc3"
} }
java { apply from: "$rootDir/deps/java.gradle"
modularity.inferModulePath = true apply from: "$rootDir/deps/commons.gradle"
sourceCompatibility = JavaVersion.VERSION_17 apply from: "$rootDir/deps/slf4j.gradle"
targetCompatibility = JavaVersion.VERSION_17 apply from: "$rootDir/deps/jackson.gradle"
} apply from: "$rootDir/deps/lombok.gradle"
apply from: 'publish.gradle'
apply from: "$rootDir/deps/publish-base.gradle"
version = file('../version').text
group = 'io.xpipe'
archivesBaseName = 'beacon'
repositories { repositories {
mavenCentral() mavenCentral()
} }
apply from: "$rootDir/deps/slf4j.gradle"
apply from: "$rootDir/deps/jackson.gradle"
dependencies { dependencies {
implementation project(':core') implementation project(':core')
implementation project(':extension') implementation project(':extension')
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
}
test {
useJUnitPlatform()
} }

View file

@ -1,21 +1,16 @@
java {
withJavadocJar()
withSourcesJar()
}
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
from components.java from components.java
pom { pom {
name = 'XPipe' name = 'X-Pipe beacon'
description = 'XPipe library.' description = 'The socket-based implementation used for the communication with X-Pipe.'
url = 'https://github.com/xpipe-io/xpipe_java' url = 'https://github.com/xpipe-io/xpipe_java/beacon'
licenses { licenses {
license { license {
name = 'The MIT License (MIT)' name = 'The MIT License (MIT)'
url = 'https://github.com/xpipe-io/xpipe_java/LICENSE' url = 'https://github.com/xpipe-io/xpipe_java/LICENSE.md'
} }
} }
developers { developers {
@ -33,18 +28,4 @@ publishing {
} }
} }
} }
repositories {
maven {
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
credentials {
setUsername "${project.hasProperty('sonatypeUsername') ? project.property('sonatypeUsername') : ''}"
setPassword "${project.hasProperty('sonatypePassword') ? project.property('sonatypePassword') : ''}"
}
}
}
}
signing {
sign publishing.publications.mavenJava
} }

View file

@ -29,17 +29,6 @@ public class BeaconConfig {
private static final String IN_PROCESS_PROP = "io.xpipe.beacon.startInProcess";
public static boolean shouldStartInProcess() {
if (System.getProperty(IN_PROCESS_PROP) != null) {
return Boolean.parseBoolean(System.getProperty(IN_PROCESS_PROP));
}
return false;
}
private static final String EXEC_PROCESS_PROP = "io.xpipe.beacon.exec"; private static final String EXEC_PROCESS_PROP = "io.xpipe.beacon.exec";
public static String getCustomExecCommand() { public static String getCustomExecCommand() {

View file

@ -1,7 +1,6 @@
package io.xpipe.beacon; package io.xpipe.beacon;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.DatagramSocket; import java.net.DatagramSocket;
import java.net.ServerSocket; import java.net.ServerSocket;
@ -21,29 +20,12 @@ public class BeaconServer {
} }
public static boolean tryStart() throws Exception { public static boolean tryStart() throws Exception {
if (BeaconConfig.shouldStartInProcess()) {
startInProcess();
return true;
}
var custom = BeaconConfig.getCustomExecCommand(); var custom = BeaconConfig.getCustomExecCommand();
if (custom != null) { if (custom != null) {
var proc = new ProcessBuilder("cmd", "/c", "CALL", "C:\\Projects\\xpipe\\xpipe\\gradlew.bat", ":app:run").inheritIO().start(); new ProcessBuilder("cmd", "/c", "CALL", custom).inheritIO().start();
return true; return true;
} }
return false; return false;
} }
private static void startInProcess() throws Exception {
var mainClass = Class.forName("io.xpipe.app.Main");
var method = mainClass.getDeclaredMethod("main", String[].class);
new Thread(() -> {
try {
method.invoke(null, (Object) new String[0]);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}).start();
}
} }

View file

@ -1,9 +0,0 @@
plugins {
id 'java'
}
group 'io.xpipe'
repositories {
mavenCentral()
}

View file

@ -1,38 +1,21 @@
plugins { plugins {
id 'java' id 'java-library'
id 'maven-publish'
id 'signing'
id "org.moditect.gradleplugin" version "1.0.0-rc3" id "org.moditect.gradleplugin" version "1.0.0-rc3"
} }
java { apply from: "$rootDir/deps/java.gradle"
modularity.inferModulePath = true apply from: "$rootDir/deps/commons.gradle"
sourceCompatibility = JavaVersion.VERSION_17 apply from: "$rootDir/deps/jackson.gradle"
targetCompatibility = JavaVersion.VERSION_17 apply from: "$rootDir/deps/lombok.gradle"
} apply from: 'publish.gradle'
apply from: "$rootDir/deps/publish-base.gradle"
version = file('../version').text
group = 'io.xpipe'
archivesBaseName = 'core'
repositories { repositories {
mavenCentral() mavenCentral()
} }
apply from: "$rootDir/deps/commons.gradle"
apply from: "$rootDir/deps/jackson.gradle"
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
testCompileOnly 'org.projectlombok:lombok:1.18.22'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
}
test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
showStandardStreams = true
}
}

31
core/publish.gradle Normal file
View file

@ -0,0 +1,31 @@
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'X-Pipe core'
description = 'Core classes ued by all X-Pipe components.'
url = 'https://github.com/xpipe-io/xpipe_java/core'
licenses {
license {
name = 'The MIT License (MIT)'
url = 'https://github.com/xpipe-io/xpipe_java/LICENSE.md'
}
}
developers {
developer {
id = 'crschnick'
name = 'Christopher Schnick'
email = 'crschnick@xpipe.io'
}
}
scm {
connection = 'scm:git:git://github.com/xpipe-io/xpipe_java.git'
developerConnection = 'scm:git:ssh://github.com/xpipe-io/xpipe_java.git'
url = 'https://github.com/xpipe-io/xpipe_java'
}
}
}
}
}

View file

@ -1,18 +1,21 @@
plugins { plugins {
id 'java' id 'java-library'
id 'maven-publish'
id 'signing'
id "org.moditect.gradleplugin" version "1.0.0-rc3" id "org.moditect.gradleplugin" version "1.0.0-rc3"
} }
java { apply from: "$rootDir/deps/java.gradle"
modularity.inferModulePath = true
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
apply from: "$rootDir/deps/javafx.gradle" apply from: "$rootDir/deps/javafx.gradle"
apply from: "$rootDir/deps/jackson.gradle" apply from: "$rootDir/deps/jackson.gradle"
apply from: "$rootDir/deps/commons.gradle" apply from: "$rootDir/deps/commons.gradle"
apply from: "$rootDir/deps/lombok.gradle" apply from: "$rootDir/deps/lombok.gradle"
apply from: 'publish.gradle'
apply from: "$rootDir/deps/publish-base.gradle"
version = file('../version').text
group = 'io.xpipe'
archivesBaseName = 'core'
repositories { repositories {
mavenCentral() mavenCentral()
@ -20,5 +23,5 @@ repositories {
dependencies { dependencies {
implementation project(':core') implementation project(':core')
compileOnly project(':fxcomps') implementation project(':fxcomps')
} }

31
extension/publish.gradle Normal file
View file

@ -0,0 +1,31 @@
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'X-Pipe extension base'
description = 'Classes required to create X-Pipe extensions.'
url = 'https://github.com/xpipe-io/xpipe_java/extension'
licenses {
license {
name = 'The MIT License (MIT)'
url = 'https://github.com/xpipe-io/xpipe_java/LICENSE.md'
}
}
developers {
developer {
id = 'crschnick'
name = 'Christopher Schnick'
email = 'crschnick@xpipe.io'
}
}
scm {
connection = 'scm:git:git://github.com/xpipe-io/xpipe_java.git'
developerConnection = 'scm:git:ssh://github.com/xpipe-io/xpipe_java.git'
url = 'https://github.com/xpipe-io/xpipe_java'
}
}
}
}
}

View file

@ -1,5 +1,10 @@
package io.xpipe.extension; package io.xpipe.extension;
import io.xpipe.core.data.type.TupleType;
import io.xpipe.core.source.TableDataSourceDescriptor;
import io.xpipe.core.store.LocalFileDataStore;
import io.xpipe.extension.event.ErrorEvent;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.nio.file.Path; import java.nio.file.Path;
@ -19,6 +24,18 @@ public class DataSourceProviders {
} }
} }
@SuppressWarnings("unchecked")
public static TableDataSourceDescriptor<LocalFileDataStore> createLocalTableDescriptor(TupleType type) {
try {
return (TableDataSourceDescriptor<LocalFileDataStore>)
DataSourceProviders.byId("xpbt").orElseThrow().getType()
.getDeclaredConstructors()[0].newInstance(type);
} catch (Exception ex) {
ErrorEvent.fromThrowable(ex).terminal(true).build().handle();
return null;
}
}
public static Optional<DataSourceProvider> byDataSourceClass(Class<?> clazz) { public static Optional<DataSourceProvider> byDataSourceClass(Class<?> clazz) {
if (ALL == null) { if (ALL == null) {
throw new IllegalStateException("Not initialized"); throw new IllegalStateException("Not initialized");

View file

@ -1,8 +1,9 @@
package io.xpipe.extension.comp; package io.xpipe.extension.comp;
import io.xpipe.fxcomps.Comp;
import io.xpipe.fxcomps.CompStructure; import io.xpipe.fxcomps.CompStructure;
import io.xpipe.fxcomps.store.DefaultValueStoreComp; import javafx.beans.property.Property;
import io.xpipe.fxcomps.util.StrongBindings; import javafx.beans.property.SimpleObjectProperty;
import javafx.geometry.Pos; import javafx.geometry.Pos;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import org.apache.commons.collections4.BidiMap; import org.apache.commons.collections4.BidiMap;
@ -10,37 +11,33 @@ import org.apache.commons.collections4.bidimap.DualLinkedHashBidiMap;
import java.util.function.Supplier; import java.util.function.Supplier;
public class CharChoiceComp extends DefaultValueStoreComp<CompStructure<HBox>, Character> { public class CharChoiceComp extends Comp<CompStructure<HBox>> {
private final Property<Character> value;
private final Property<Character> charChoiceValue;
private final BidiMap<Character, Supplier<String>> range; private final BidiMap<Character, Supplier<String>> range;
private final Supplier<String> customName; private final Supplier<String> customName;
public CharChoiceComp(Character defaultVal, BidiMap<Character, Supplier<String>> range, Supplier<String> customName) { public CharChoiceComp(Property<Character> value, BidiMap<Character, Supplier<String>> range, Supplier<String> customName) {
super(defaultVal); this.value = value;
this.range = range; this.range = range;
this.customName = customName; this.customName = customName;
this.charChoiceValue = new SimpleObjectProperty<>(range.containsKey(value.getValue()) ? value.getValue() : null);
value.addListener((c, o, n) -> {
if (!range.containsKey(n)) {
charChoiceValue.setValue(null);
} else {
charChoiceValue.setValue(n);
}
});
} }
@Override @Override
public CompStructure<HBox> createBase() { public CompStructure<HBox> createBase() {
var charChoice = new CharComp(); var charChoice = new CharComp(value);
StrongBindings.bind(charChoice.valueProperty(), valueProperty());
var rangeCopy = new DualLinkedHashBidiMap<>(range); var rangeCopy = new DualLinkedHashBidiMap<>(range);
rangeCopy.put(null, customName); rangeCopy.put(null, customName);
var choice = new ChoiceComp<Character>(value.getValue(), rangeCopy); var choice = new ChoiceComp<Character>(charChoiceValue, rangeCopy);
choice.set(getValue());
choice.valueProperty().addListener((c, o, n) -> {
set(n);
});
valueProperty().addListener((c, o, n) -> {
if (n != null && !range.containsKey(n)) {
choice.set(null);
} else {
choice.set(n);
}
});
var charChoiceR = charChoice.createRegion(); var charChoiceR = charChoice.createRegion();
var choiceR = choice.createRegion(); var choiceR = choice.createRegion();
var box = new HBox(charChoiceR, choiceR); var box = new HBox(charChoiceR, choiceR);

View file

@ -1,23 +1,33 @@
package io.xpipe.extension.comp; package io.xpipe.extension.comp;
import io.xpipe.fxcomps.Comp;
import io.xpipe.fxcomps.CompStructure; import io.xpipe.fxcomps.CompStructure;
import io.xpipe.fxcomps.store.ValueStoreComp; import io.xpipe.fxcomps.util.PlatformUtil;
import javafx.beans.property.Property;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
public class CharComp extends ValueStoreComp<CompStructure<TextField>, Character> { public class CharComp extends Comp<CompStructure<TextField>> {
private final Property<Character> value;
public CharComp(Property<Character> value) {
this.value = value;
}
@Override @Override
public CompStructure<TextField> createBase() { public CompStructure<TextField> createBase() {
var text = new TextField(getValue() != null ? getValue().toString() : null); var text = new TextField(value.getValue() != null ? value.getValue().toString() : null);
text.setOnKeyTyped(e -> { text.setOnKeyTyped(e -> {
text.setText(e.getCharacter()); text.setText(e.getCharacter());
}); });
text.textProperty().addListener((c, o, n) -> { text.textProperty().addListener((c, o, n) -> {
this.set(n != null && n.length() > 0 ? n.charAt(0) : null); value.setValue(n != null && n.length() > 0 ? n.charAt(0) : null);
}); });
valueProperty().addListener((c, o, n) -> { value.addListener((c, o, n) -> {
PlatformUtil.runLaterIfNeeded(() -> {
text.setText(n != null ? n.toString() : null); text.setText(n != null ? n.toString() : null);
}); });
});
return new CompStructure<>(text); return new CompStructure<>(text);
} }
} }

View file

@ -1,19 +1,30 @@
package io.xpipe.extension.comp; package io.xpipe.extension.comp;
import io.xpipe.fxcomps.Comp;
import io.xpipe.fxcomps.CompStructure;
import io.xpipe.fxcomps.comp.ReplacementComp;
import javafx.beans.property.Property;
import javafx.scene.control.ChoiceBox;
import org.apache.commons.collections4.bidimap.DualLinkedHashBidiMap; import org.apache.commons.collections4.bidimap.DualLinkedHashBidiMap;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.function.Supplier; import java.util.function.Supplier;
public class CharsetChoiceComp { public class CharsetChoiceComp extends ReplacementComp<CompStructure<ChoiceBox<Charset>>> {
public static ChoiceComp<Charset> create() { private final Property<Charset> charset;
public CharsetChoiceComp(Property<Charset> charset) {
this.charset = charset;
}
@Override
protected Comp<CompStructure<ChoiceBox<Charset>>> createComp() {
var map = new LinkedHashMap<Charset, Supplier<String>>(); var map = new LinkedHashMap<Charset, Supplier<String>>();
for (var e : Charset.availableCharsets().entrySet()) { for (var e : Charset.availableCharsets().entrySet()) {
map.put(e.getValue(), () -> e.getKey()); map.put(e.getValue(), e::getKey);
} }
return new ChoiceComp<>(StandardCharsets.UTF_8, new DualLinkedHashBidiMap<>(map)); return new ChoiceComp<>(charset, new DualLinkedHashBidiMap<>(map));
} }
} }

View file

@ -1,7 +1,9 @@
package io.xpipe.extension.comp; package io.xpipe.extension.comp;
import io.xpipe.fxcomps.Comp;
import io.xpipe.fxcomps.CompStructure; import io.xpipe.fxcomps.CompStructure;
import io.xpipe.fxcomps.store.DefaultValueStoreComp; import io.xpipe.fxcomps.util.PlatformUtil;
import javafx.beans.property.Property;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.scene.control.ChoiceBox; import javafx.scene.control.ChoiceBox;
import javafx.util.StringConverter; import javafx.util.StringConverter;
@ -9,33 +11,24 @@ import org.apache.commons.collections4.BidiMap;
import java.util.function.Supplier; import java.util.function.Supplier;
public class ChoiceComp<T> extends DefaultValueStoreComp<CompStructure<ChoiceBox<T>>, T> { public class ChoiceComp<T> extends Comp<CompStructure<ChoiceBox<T>>> {
private final Property<T> value;
private final BidiMap<T, Supplier<String>> range; private final BidiMap<T, Supplier<String>> range;
public ChoiceComp(T defaultVal, BidiMap<T, Supplier<String>> range) { public ChoiceComp(Property<T> value, BidiMap<T, Supplier<String>> range) {
super(defaultVal); this.value = value;
this.range = range; this.range = range;
} }
@Override
protected boolean isValid(T newValue) {
return range.containsKey(newValue);
}
public BidiMap<T, Supplier<String>> getRange() {
return range;
}
@Override @Override
public CompStructure<ChoiceBox<T>> createBase() { public CompStructure<ChoiceBox<T>> createBase() {
var comp = this; var list = FXCollections.observableArrayList(range.keySet());
var list = FXCollections.observableArrayList(comp.getRange().keySet());
var cb = new ChoiceBox<>(list); var cb = new ChoiceBox<>(list);
cb.setConverter(new StringConverter<>() { cb.setConverter(new StringConverter<>() {
@Override @Override
public String toString(T object) { public String toString(T object) {
return comp.getRange().get(object).get(); return range.get(object).get();
} }
@Override @Override
@ -43,7 +36,7 @@ public class ChoiceComp<T> extends DefaultValueStoreComp<CompStructure<ChoiceBox
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
}); });
cb.valueProperty().bindBidirectional(comp.valueProperty()); PlatformUtil.connect(value, cb.valueProperty());
cb.getStyleClass().add("choice-comp"); cb.getStyleClass().add("choice-comp");
return new CompStructure<>(cb); return new CompStructure<>(cb);
} }

View file

@ -1,7 +1,9 @@
package io.xpipe.extension.comp; package io.xpipe.extension.comp;
import io.xpipe.fxcomps.Comp;
import io.xpipe.fxcomps.CompStructure; import io.xpipe.fxcomps.CompStructure;
import io.xpipe.fxcomps.store.DefaultValueStoreComp; import io.xpipe.fxcomps.util.PlatformUtil;
import javafx.beans.property.Property;
import javafx.scene.control.ToggleButton; import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup; import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
@ -9,12 +11,13 @@ import org.apache.commons.collections4.BidiMap;
import java.util.function.Supplier; import java.util.function.Supplier;
public class ToggleGroupComp<T> extends DefaultValueStoreComp<CompStructure<HBox>, T> { public class ToggleGroupComp<T> extends Comp<CompStructure<HBox>> {
private final Property<T> value;
private final BidiMap<T, Supplier<String>> range; private final BidiMap<T, Supplier<String>> range;
public ToggleGroupComp(T defaultVal, BidiMap<T, Supplier<String>> range) { public ToggleGroupComp(Property<T> value, BidiMap<T, Supplier<String>> range) {
super(defaultVal); this.value = value;
this.range = range; this.range = range;
} }
@ -30,15 +33,15 @@ public class ToggleGroupComp<T> extends DefaultValueStoreComp<CompStructure<HBox
for (var entry : range.entrySet()) { for (var entry : range.entrySet()) {
var b = new ToggleButton(entry.getValue().get()); var b = new ToggleButton(entry.getValue().get());
b.setOnAction(e -> { b.setOnAction(e -> {
set(entry.getKey()); value.setValue(entry.getKey());
e.consume(); e.consume();
}); });
box.getChildren().add(b); box.getChildren().add(b);
b.setToggleGroup(group); b.setToggleGroup(group);
valueProperty().addListener((c, o, n) -> { value.addListener((c, o, n) -> {
b.setSelected(entry.equals(n)); PlatformUtil.runLaterIfNeeded(() -> b.setSelected(entry.equals(n)));
}); });
if (entry.getKey().equals(getValue())) { if (entry.getKey().equals(value.getValue())) {
b.setSelected(true); b.setSelected(true);
} }
} }

View file

@ -17,6 +17,10 @@ public class TrackEvent {
this.category("window"); this.category("window");
return this; return this;
} }
public void handle() {
build().handle();
}
} }
public static TrackEventBuilder fromMessage(String type, String message) { public static TrackEventBuilder fromMessage(String type, String message) {
@ -35,6 +39,10 @@ public class TrackEvent {
return builder().type("trace").message(message); return builder().type("trace").message(message);
} }
public static TrackEventBuilder withTrace(String cat, String message) {
return builder().category(cat).type("trace").message(message);
}
public static void info(String message) { public static void info(String message) {
builder().type("info").message(message).build().handle(); builder().type("info").message(message).build().handle();
} }

View file

@ -1,68 +0,0 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id "org.moditect.gradleplugin" version "1.0.0-rc3"
}
apply from: 'publish.gradle'
apply from: "$rootDir/deps/jackson.gradle"
apply from: "$rootDir/deps/slf4j.gradle"
apply from: "$rootDir/deps/lombok.gradle"
apply from: "$rootDir/deps/commons.gradle"
apply from: "$rootDir/deps/javafx.gradle"
apply from: "$rootDir/deps/javafx-static.gradle"
version '0.1'
group 'io.xpipe'
archivesBaseName = 'xpipe'
java {
modularity.inferModulePath = true
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
dependencies {
compileOnly project(':fxcomps')
}
repositories {
mavenCentral()
}
javadoc{
source = sourceSets.main.allJava
options {
addStringOption('-release', '17')
addStringOption('link', 'https://docs.oracle.com/en/java/javase/17/docs/api/')
}
}
sourceSets {
main {
java {
srcDir(projectDir)
srcDir("../api/src/main/java")
exclude {
return it.getFile() == file("../api/src/main/java/module-info.java")
}
srcDir("../core/src/main/java")
exclude {
return it.getFile() == file("../core/src/main/java/module-info.java")
}
srcDir("../beacon/src/main/java")
exclude {
return it.getFile() == file("../beacon/src/main/java/module-info.java")
}
srcDir("../extension/src/main/java")
exclude {
return it.getFile() == file("../extension/src/main/java/module-info.java")
}
}
}
}

View file

@ -1,58 +0,0 @@
module io.xpipe {
// api
exports io.xpipe.api;
// beacon
exports io.xpipe.beacon;
exports io.xpipe.beacon.exchange;
exports io.xpipe.beacon.message;
opens io.xpipe.beacon;
opens io.xpipe.beacon.exchange;
opens io.xpipe.beacon.message;
uses io.xpipe.beacon.exchange.MessageExchange;
provides io.xpipe.beacon.exchange.MessageExchange with
io.xpipe.beacon.exchange.ListCollectionsExchange,
io.xpipe.beacon.exchange.ListEntriesExchange,
io.xpipe.beacon.exchange.ReadTableDataExchange,
io.xpipe.beacon.exchange.ReadInfoExchange,
io.xpipe.beacon.exchange.StatusExchange,
io.xpipe.beacon.exchange.StopExchange,
io.xpipe.beacon.exchange.StoreResourceExchange,
io.xpipe.beacon.exchange.VersionExchange;
// core
exports io.xpipe.core.store;
exports io.xpipe.core.source;
exports io.xpipe.core.data.generic;
exports io.xpipe.core.data.type;
exports io.xpipe.core.data.node;
exports io.xpipe.core.util;
exports io.xpipe.core.data.typed;
opens io.xpipe.core.store;
opens io.xpipe.core.source;
opens io.xpipe.core.data.typed;
opens io.xpipe.core.data.type;
// core services
uses com.fasterxml.jackson.databind.Module;
provides com.fasterxml.jackson.databind.Module with io.xpipe.core.util.CoreJacksonModule;
// extension
requires static io.xpipe.fxcomps;
requires static javafx.base;
requires static javafx.graphics;
requires static javafx.controls;
requires static org.apache.commons.collections4;
exports io.xpipe.extension;
exports io.xpipe.extension.comp;
uses io.xpipe.extension.DataSourceProvider;
uses io.xpipe.extension.DataSourceGuiProvider;
uses io.xpipe.extension.SupportedApplicationProvider;
uses io.xpipe.extension.I18n;
requires com.fasterxml.jackson.core;
requires com.fasterxml.jackson.databind;
requires com.fasterxml.jackson.module.paramnames;
requires org.slf4j;
requires static lombok;
}

View file

@ -12,15 +12,11 @@ repositories {
mavenCentral() mavenCentral()
} }
apply from: "$rootDir/deps/jackson.gradle" apply from: "$rootDir/deps/jackson.gradle"
apply from: "$rootDir/deps/slf4j.gradle"
dependencies { dependencies {
implementation files(project(':library').jar.archivePath) implementation project(':api')
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.0-alpha1'
} }
compileJava.dependsOn(project(':library').jar)
application { application {
mainModule = 'io.xpipe.sample' mainModule = 'io.xpipe.sample'
mainClass = 'io.xpipe.sample.HomePricesSample' mainClass = 'io.xpipe.sample.HomePricesSample'

View file

@ -4,7 +4,6 @@ include 'core'
include 'beacon' include 'beacon'
include 'api' include 'api'
include 'extension' include 'extension'
include 'library'
include 'sample_extension' include 'sample_extension'
project(":sample_extension").projectDir = file("samples/sample_extension") project(":sample_extension").projectDir = file("samples/sample_extension")

1
version Normal file
View file

@ -0,0 +1 @@
0.1