Serial connect fixes

This commit is contained in:
crschnick 2024-07-31 18:41:44 +00:00
parent b7a3157f30
commit 734d4fdff8
14 changed files with 35 additions and 3 deletions

View file

@ -51,7 +51,7 @@ public class StoreCreationComp extends DialogComp {
Stage window;
BiConsumer<DataStoreEntry, Boolean> consumer;
Property<DataStoreProvider> provider;
Property<DataStore> store;
ObjectProperty<DataStore> store;
Predicate<DataStoreProvider> filter;
BooleanProperty busy = new SimpleBooleanProperty();
Property<Validator> validator = new SimpleObjectProperty<>(new SimpleValidator());
@ -60,6 +60,7 @@ public class StoreCreationComp extends DialogComp {
ObservableValue<DataStoreEntry> entry;
BooleanProperty changedSinceError = new SimpleBooleanProperty();
BooleanProperty skippable = new SimpleBooleanProperty();
BooleanProperty connectable = new SimpleBooleanProperty();
StringProperty name;
DataStoreEntry existingEntry;
boolean staticDisplay;
@ -68,7 +69,7 @@ public class StoreCreationComp extends DialogComp {
Stage window,
BiConsumer<DataStoreEntry, Boolean> consumer,
Property<DataStoreProvider> provider,
Property<DataStore> store,
ObjectProperty<DataStore> store,
Predicate<DataStoreProvider> filter,
String initialName,
DataStoreEntry existingEntry,
@ -96,6 +97,12 @@ public class StoreCreationComp extends DialogComp {
}
});
this.provider.subscribe((n) -> {
if (n != null) {
connectable.setValue(n.canConnectDuringCreation());
}
});
this.apply(r -> {
r.get().setPrefWidth(650);
r.get().setPrefHeight(750);
@ -239,7 +246,16 @@ public class StoreCreationComp extends DialogComp {
finish();
}
})
.visible(skippable));
.visible(skippable),
new ButtonComp(AppI18n.observable("connect"), null, () -> {
var temp = DataStoreEntry.createTempWrapper(store.getValue());
var action = provider.getValue().launchAction(temp);
ThreadHelper.runFailableAsync(() -> {
action.execute();
});
}).visible(connectable.and(Bindings.createBooleanBinding(() -> {
return store.getValue() != null && store.getValue().isComplete();
}, store))));
}
@Override

View file

@ -100,6 +100,10 @@ public interface DataStoreProvider {
return Comp.empty();
}
default boolean canConnectDuringCreation() {
return false;
}
default Comp<?> createInsightsComp(ObservableValue<DataStore> store) {
var content = Bindings.createStringBinding(
() -> {

View file

@ -489,3 +489,4 @@ closeAllTabs=Luk alle faner
closeLeftTabs=Luk faner til venstre
closeRightTabs=Luk faner til højre
addSerial=Seriel ...
connect=Forbind

View file

@ -483,3 +483,4 @@ closeAllTabs=Alle Registerkarten schließen
closeLeftTabs=Tabs nach links schließen
closeRightTabs=Tabs nach rechts schließen
addSerial=Serielle ...
connect=Verbinden

View file

@ -487,3 +487,4 @@ closeAllTabs=Close all tabs
closeLeftTabs=Close tabs to the left
closeRightTabs=Close tabs to the right
addSerial=Serial ...
connect=Connect

View file

@ -470,3 +470,4 @@ closeAllTabs=Cerrar todas las pestañas
closeLeftTabs=Cerrar pestañas a la izquierda
closeRightTabs=Cerrar pestañas a la derecha
addSerial=Serie ...
connect=Conecta

View file

@ -470,3 +470,4 @@ closeAllTabs=Fermer tous les onglets
closeLeftTabs=Ferme les onglets à gauche
closeRightTabs=Ferme les onglets à droite
addSerial=Série ...
connect=Connecter

View file

@ -470,3 +470,4 @@ closeAllTabs=Chiudi tutte le schede
closeLeftTabs=Chiudere le schede a sinistra
closeRightTabs=Chiudere le schede a destra
addSerial=Seriale ...
connect=Collegare

View file

@ -470,3 +470,4 @@ closeAllTabs=すべてのタブを閉じる
closeLeftTabs=タブを左に閉じる
closeRightTabs=タブを右に閉じる
addSerial=シリアル ...
connect=接続する

View file

@ -470,3 +470,4 @@ closeAllTabs=Alle tabbladen sluiten
closeLeftTabs=Tabbladen naar links sluiten
closeRightTabs=Tabbladen naar rechts sluiten
addSerial=Serieel ...
connect=Maak verbinding met

View file

@ -470,3 +470,4 @@ closeAllTabs=Fecha todos os separadores
closeLeftTabs=Fecha os separadores à esquerda
closeRightTabs=Fecha os separadores à direita
addSerial=Série ...
connect=Liga-te

View file

@ -470,3 +470,4 @@ closeAllTabs=Закрыть все вкладки
closeLeftTabs=Закрыть вкладки слева
closeRightTabs=Закрывать вкладки справа
addSerial=Серийный ...
connect=Connect

View file

@ -471,3 +471,4 @@ closeAllTabs=Tüm sekmeleri kapat
closeLeftTabs=Sekmeleri sola doğru kapatın
closeRightTabs=Sekmeleri sağa doğru kapatın
addSerial=Seri ...
connect=Bağlan

View file

@ -470,3 +470,4 @@ closeAllTabs=关闭所有标签页
closeLeftTabs=向左关闭标签
closeRightTabs=向右关闭标签页
addSerial=串行 ...
connect=连接