mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
Prepare for publish
This commit is contained in:
parent
b192fd5b09
commit
cd93f934ff
23 changed files with 253 additions and 329 deletions
|
@ -1,35 +1,28 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'signing'
|
||||
id "org.moditect.gradleplugin" version "1.0.0-rc3"
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
apply from: "$rootDir/deps/java.gradle"
|
||||
apply from: "$rootDir/deps/commons.gradle"
|
||||
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 {
|
||||
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 {
|
||||
implementation project(':core')
|
||||
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 {
|
||||
|
@ -39,12 +32,10 @@ test {
|
|||
showStandardStreams = true
|
||||
}
|
||||
|
||||
//workingDir = project(":app").projectDir
|
||||
|
||||
systemProperty 'io.xpipe.beacon.startInProcess', 'true'
|
||||
systemProperty 'io.xpipe.beacon.exec', 'start_test_daemon.bat'
|
||||
systemProperty "io.xpipe.daemon.mode", 'base'
|
||||
systemProperty "io.xpipe.storage.dir", "$projectDir/test_env"
|
||||
systemProperty "io.xpipe.beacon.port", "21722"
|
||||
systemProperty 'io.xpipe.app.writeSysOut', "true"
|
||||
systemProperty 'io.xpipe.app.logLevel', "debug"
|
||||
systemProperty 'io.xpipe.app.logLevel', "trace"
|
||||
}
|
||||
|
|
35
api/publish.gradle
Normal file
35
api/publish.gradle
Normal 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')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,29 +1,27 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'signing'
|
||||
id "org.moditect.gradleplugin" version "1.0.0-rc3"
|
||||
}
|
||||
|
||||
java {
|
||||
modularity.inferModulePath = true
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
apply from: "$rootDir/deps/java.gradle"
|
||||
apply from: "$rootDir/deps/commons.gradle"
|
||||
apply from: "$rootDir/deps/slf4j.gradle"
|
||||
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 {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
apply from: "$rootDir/deps/slf4j.gradle"
|
||||
apply from: "$rootDir/deps/jackson.gradle"
|
||||
|
||||
dependencies {
|
||||
implementation project(':core')
|
||||
implementation project(':extension')
|
||||
|
||||
compileOnly 'org.projectlombok:lombok:1.18.22'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.22'
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
|
@ -1,21 +1,16 @@
|
|||
java {
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
|
||||
pom {
|
||||
name = 'XPipe'
|
||||
description = 'XPipe library.'
|
||||
url = 'https://github.com/xpipe-io/xpipe_java'
|
||||
name = 'X-Pipe beacon'
|
||||
description = 'The socket-based implementation used for the communication with X-Pipe.'
|
||||
url = 'https://github.com/xpipe-io/xpipe_java/beacon'
|
||||
licenses {
|
||||
license {
|
||||
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 {
|
||||
|
@ -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
|
||||
}
|
|
@ -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";
|
||||
|
||||
public static String getCustomExecCommand() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package io.xpipe.beacon;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.ServerSocket;
|
||||
|
||||
|
@ -21,29 +20,12 @@ public class BeaconServer {
|
|||
}
|
||||
|
||||
public static boolean tryStart() throws Exception {
|
||||
if (BeaconConfig.shouldStartInProcess()) {
|
||||
startInProcess();
|
||||
return true;
|
||||
}
|
||||
|
||||
var custom = BeaconConfig.getCustomExecCommand();
|
||||
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 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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
group 'io.xpipe'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
|
@ -1,38 +1,21 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'signing'
|
||||
id "org.moditect.gradleplugin" version "1.0.0-rc3"
|
||||
}
|
||||
|
||||
java {
|
||||
modularity.inferModulePath = true
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
apply from: "$rootDir/deps/java.gradle"
|
||||
apply from: "$rootDir/deps/commons.gradle"
|
||||
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 = 'core'
|
||||
|
||||
repositories {
|
||||
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
31
core/publish.gradle
Normal 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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,18 +1,21 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'signing'
|
||||
id "org.moditect.gradleplugin" version "1.0.0-rc3"
|
||||
}
|
||||
|
||||
java {
|
||||
modularity.inferModulePath = true
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
apply from: "$rootDir/deps/java.gradle"
|
||||
apply from: "$rootDir/deps/javafx.gradle"
|
||||
apply from: "$rootDir/deps/jackson.gradle"
|
||||
apply from: "$rootDir/deps/commons.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 {
|
||||
mavenCentral()
|
||||
|
@ -20,5 +23,5 @@ repositories {
|
|||
|
||||
dependencies {
|
||||
implementation project(':core')
|
||||
compileOnly project(':fxcomps')
|
||||
implementation project(':fxcomps')
|
||||
}
|
||||
|
|
31
extension/publish.gradle
Normal file
31
extension/publish.gradle
Normal 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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,10 @@
|
|||
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.URL;
|
||||
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) {
|
||||
if (ALL == null) {
|
||||
throw new IllegalStateException("Not initialized");
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package io.xpipe.extension.comp;
|
||||
|
||||
import io.xpipe.fxcomps.Comp;
|
||||
import io.xpipe.fxcomps.CompStructure;
|
||||
import io.xpipe.fxcomps.store.DefaultValueStoreComp;
|
||||
import io.xpipe.fxcomps.util.StrongBindings;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.layout.HBox;
|
||||
import org.apache.commons.collections4.BidiMap;
|
||||
|
@ -10,37 +11,33 @@ import org.apache.commons.collections4.bidimap.DualLinkedHashBidiMap;
|
|||
|
||||
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 Supplier<String> customName;
|
||||
|
||||
public CharChoiceComp(Character defaultVal, BidiMap<Character, Supplier<String>> range, Supplier<String> customName) {
|
||||
super(defaultVal);
|
||||
public CharChoiceComp(Property<Character> value, BidiMap<Character, Supplier<String>> range, Supplier<String> customName) {
|
||||
this.value = value;
|
||||
this.range = range;
|
||||
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
|
||||
public CompStructure<HBox> createBase() {
|
||||
var charChoice = new CharComp();
|
||||
StrongBindings.bind(charChoice.valueProperty(), valueProperty());
|
||||
|
||||
var charChoice = new CharComp(value);
|
||||
var rangeCopy = new DualLinkedHashBidiMap<>(range);
|
||||
rangeCopy.put(null, customName);
|
||||
var choice = new ChoiceComp<Character>(value.getValue(), 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 choice = new ChoiceComp<Character>(charChoiceValue, rangeCopy);
|
||||
var charChoiceR = charChoice.createRegion();
|
||||
var choiceR = choice.createRegion();
|
||||
var box = new HBox(charChoiceR, choiceR);
|
||||
|
|
|
@ -1,22 +1,32 @@
|
|||
package io.xpipe.extension.comp;
|
||||
|
||||
import io.xpipe.fxcomps.Comp;
|
||||
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;
|
||||
|
||||
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
|
||||
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.setText(e.getCharacter());
|
||||
});
|
||||
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) -> {
|
||||
text.setText(n != null ? n.toString() : null);
|
||||
value.addListener((c, o, n) -> {
|
||||
PlatformUtil.runLaterIfNeeded(() -> {
|
||||
text.setText(n != null ? n.toString() : null);
|
||||
});
|
||||
});
|
||||
return new CompStructure<>(text);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,30 @@
|
|||
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 java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.LinkedHashMap;
|
||||
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>>();
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package io.xpipe.extension.comp;
|
||||
|
||||
import io.xpipe.fxcomps.Comp;
|
||||
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.scene.control.ChoiceBox;
|
||||
import javafx.util.StringConverter;
|
||||
|
@ -9,33 +11,24 @@ import org.apache.commons.collections4.BidiMap;
|
|||
|
||||
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;
|
||||
|
||||
public ChoiceComp(T defaultVal, BidiMap<T, Supplier<String>> range) {
|
||||
super(defaultVal);
|
||||
public ChoiceComp(Property<T> value, BidiMap<T, Supplier<String>> range) {
|
||||
this.value = value;
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValid(T newValue) {
|
||||
return range.containsKey(newValue);
|
||||
}
|
||||
|
||||
public BidiMap<T, Supplier<String>> getRange() {
|
||||
return range;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompStructure<ChoiceBox<T>> createBase() {
|
||||
var comp = this;
|
||||
var list = FXCollections.observableArrayList(comp.getRange().keySet());
|
||||
var list = FXCollections.observableArrayList(range.keySet());
|
||||
var cb = new ChoiceBox<>(list);
|
||||
cb.setConverter(new StringConverter<>() {
|
||||
@Override
|
||||
public String toString(T object) {
|
||||
return comp.getRange().get(object).get();
|
||||
return range.get(object).get();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,7 +36,7 @@ public class ChoiceComp<T> extends DefaultValueStoreComp<CompStructure<ChoiceBox
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
});
|
||||
cb.valueProperty().bindBidirectional(comp.valueProperty());
|
||||
PlatformUtil.connect(value, cb.valueProperty());
|
||||
cb.getStyleClass().add("choice-comp");
|
||||
return new CompStructure<>(cb);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package io.xpipe.extension.comp;
|
||||
|
||||
import io.xpipe.fxcomps.Comp;
|
||||
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.ToggleGroup;
|
||||
import javafx.scene.layout.HBox;
|
||||
|
@ -9,12 +11,13 @@ import org.apache.commons.collections4.BidiMap;
|
|||
|
||||
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;
|
||||
|
||||
public ToggleGroupComp(T defaultVal, BidiMap<T, Supplier<String>> range) {
|
||||
super(defaultVal);
|
||||
public ToggleGroupComp(Property<T> value, BidiMap<T, Supplier<String>> range) {
|
||||
this.value = value;
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
|
@ -30,15 +33,15 @@ public class ToggleGroupComp<T> extends DefaultValueStoreComp<CompStructure<HBox
|
|||
for (var entry : range.entrySet()) {
|
||||
var b = new ToggleButton(entry.getValue().get());
|
||||
b.setOnAction(e -> {
|
||||
set(entry.getKey());
|
||||
value.setValue(entry.getKey());
|
||||
e.consume();
|
||||
});
|
||||
box.getChildren().add(b);
|
||||
b.setToggleGroup(group);
|
||||
valueProperty().addListener((c, o, n) -> {
|
||||
b.setSelected(entry.equals(n));
|
||||
value.addListener((c, o, n) -> {
|
||||
PlatformUtil.runLaterIfNeeded(() -> b.setSelected(entry.equals(n)));
|
||||
});
|
||||
if (entry.getKey().equals(getValue())) {
|
||||
if (entry.getKey().equals(value.getValue())) {
|
||||
b.setSelected(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,10 @@ public class TrackEvent {
|
|||
this.category("window");
|
||||
return this;
|
||||
}
|
||||
|
||||
public void handle() {
|
||||
build().handle();
|
||||
}
|
||||
}
|
||||
|
||||
public static TrackEventBuilder fromMessage(String type, String message) {
|
||||
|
@ -35,6 +39,10 @@ public class TrackEvent {
|
|||
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) {
|
||||
builder().type("info").message(message).build().handle();
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -12,15 +12,11 @@ repositories {
|
|||
mavenCentral()
|
||||
}
|
||||
apply from: "$rootDir/deps/jackson.gradle"
|
||||
apply from: "$rootDir/deps/slf4j.gradle"
|
||||
|
||||
dependencies {
|
||||
implementation files(project(':library').jar.archivePath)
|
||||
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.0-alpha1'
|
||||
implementation project(':api')
|
||||
}
|
||||
|
||||
compileJava.dependsOn(project(':library').jar)
|
||||
|
||||
application {
|
||||
mainModule = 'io.xpipe.sample'
|
||||
mainClass = 'io.xpipe.sample.HomePricesSample'
|
||||
|
|
|
@ -4,7 +4,6 @@ include 'core'
|
|||
include 'beacon'
|
||||
include 'api'
|
||||
include 'extension'
|
||||
include 'library'
|
||||
|
||||
include 'sample_extension'
|
||||
project(":sample_extension").projectDir = file("samples/sample_extension")
|
||||
|
|
1
version
Normal file
1
version
Normal file
|
@ -0,0 +1 @@
|
|||
0.1
|
Loading…
Reference in a new issue