mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 12:09:22 +00:00
show available monero nodes in network settings
This commit is contained in:
parent
1f385328de
commit
dc8d854709
22 changed files with 100 additions and 95 deletions
|
@ -40,7 +40,6 @@ import java.util.Collection;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
|
||||
|
@ -64,7 +63,6 @@ import monero.common.MoneroRpcConnection;
|
|||
import monero.common.TaskLooper;
|
||||
import monero.daemon.MoneroDaemonRpc;
|
||||
import monero.daemon.model.MoneroDaemonInfo;
|
||||
import monero.daemon.model.MoneroPeer;
|
||||
|
||||
@Slf4j
|
||||
@Singleton
|
||||
|
@ -85,9 +83,9 @@ public final class XmrConnectionService {
|
|||
private final XmrLocalNode xmrLocalNode;
|
||||
private final MoneroConnectionManager connectionManager;
|
||||
private final EncryptedConnectionList connectionList;
|
||||
private final ObjectProperty<List<MoneroPeer>> peers = new SimpleObjectProperty<>();
|
||||
private final ObjectProperty<List<MoneroRpcConnection>> connections = new SimpleObjectProperty<>();
|
||||
private final IntegerProperty numConnections = new SimpleIntegerProperty(0);
|
||||
private final ObjectProperty<MoneroRpcConnection> connectionProperty = new SimpleObjectProperty<>();
|
||||
private final IntegerProperty numPeers = new SimpleIntegerProperty(0);
|
||||
private final LongProperty chainHeight = new SimpleLongProperty(0);
|
||||
private final DownloadListener downloadListener = new DownloadListener();
|
||||
@Getter
|
||||
|
@ -390,12 +388,12 @@ public final class XmrConnectionService {
|
|||
|
||||
// ----------------------------- APP METHODS ------------------------------
|
||||
|
||||
public ReadOnlyIntegerProperty numPeersProperty() {
|
||||
return numPeers;
|
||||
public ReadOnlyIntegerProperty numConnectionsProperty() {
|
||||
return numConnections;
|
||||
}
|
||||
|
||||
public ReadOnlyObjectProperty<List<MoneroPeer>> peerConnectionsProperty() {
|
||||
return peers;
|
||||
public ReadOnlyObjectProperty<List<MoneroRpcConnection>> connectionsProperty() {
|
||||
return connections;
|
||||
}
|
||||
|
||||
public ReadOnlyObjectProperty<MoneroRpcConnection> connectionProperty() {
|
||||
|
@ -403,7 +401,7 @@ public final class XmrConnectionService {
|
|||
}
|
||||
|
||||
public boolean hasSufficientPeersForBroadcast() {
|
||||
return numPeers.get() >= getMinBroadcastConnections();
|
||||
return numConnections.get() >= getMinBroadcastConnections();
|
||||
}
|
||||
|
||||
public LongProperty chainHeightProperty() {
|
||||
|
@ -782,16 +780,15 @@ public final class XmrConnectionService {
|
|||
downloadListener.progress(percent, blocksLeft, null);
|
||||
}
|
||||
|
||||
// set peer connections
|
||||
// TODO: peers often uknown due to restricted RPC call, skipping call to get peer connections
|
||||
// try {
|
||||
// peers.set(getOnlinePeers());
|
||||
// } catch (Exception err) {
|
||||
// // TODO: peers unknown due to restricted RPC call
|
||||
// }
|
||||
// numPeers.set(peers.get().size());
|
||||
numPeers.set(lastInfo.getNumOutgoingConnections() + lastInfo.getNumIncomingConnections());
|
||||
peers.set(new ArrayList<MoneroPeer>());
|
||||
// set available connections
|
||||
List<MoneroRpcConnection> availableConnections = new ArrayList<>();
|
||||
for (MoneroRpcConnection connection : connectionManager.getConnections()) {
|
||||
if (Boolean.TRUE.equals(connection.isOnline()) && Boolean.TRUE.equals(connection.isAuthenticated())) {
|
||||
availableConnections.add(connection);
|
||||
}
|
||||
}
|
||||
connections.set(availableConnections);
|
||||
numConnections.set(availableConnections.size());
|
||||
|
||||
// notify update
|
||||
numUpdates.set(numUpdates.get() + 1);
|
||||
|
@ -821,12 +818,6 @@ public final class XmrConnectionService {
|
|||
}
|
||||
}
|
||||
|
||||
private List<MoneroPeer> getOnlinePeers() {
|
||||
return daemon.getPeers().stream()
|
||||
.filter(peer -> peer.isOnline())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private boolean isFixedConnection() {
|
||||
return !"".equals(config.xmrNode) || preferences.getMoneroNodesOption() == XmrNodes.MoneroNodesOption.CUSTOM;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class AppStartupState {
|
|||
isWalletSynced.set(true);
|
||||
});
|
||||
|
||||
xmrConnectionService.numPeersProperty().addListener((observable, oldValue, newValue) -> {
|
||||
xmrConnectionService.numConnectionsProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (xmrConnectionService.hasSufficientPeersForBroadcast())
|
||||
hasSufficientPeersForBroadcast.set(true);
|
||||
});
|
||||
|
|
|
@ -87,7 +87,7 @@ public class P2PNetworkSetup {
|
|||
BooleanProperty initialP2PNetworkDataReceived = new SimpleBooleanProperty();
|
||||
|
||||
p2PNetworkInfoBinding = EasyBind.combine(bootstrapState, bootstrapWarning, p2PService.getNumConnectedPeers(),
|
||||
xmrConnectionService.numPeersProperty(), hiddenServicePublished, initialP2PNetworkDataReceived,
|
||||
xmrConnectionService.numConnectionsProperty(), hiddenServicePublished, initialP2PNetworkDataReceived,
|
||||
(state, warning, numP2pPeers, numXmrPeers, hiddenService, dataReceived) -> {
|
||||
String result;
|
||||
int p2pPeers = (int) numP2pPeers;
|
||||
|
|
|
@ -1315,6 +1315,8 @@ settings.net.p2pHeader=Haveno network
|
|||
settings.net.onionAddressLabel=My onion address
|
||||
settings.net.xmrNodesLabel=Use custom Monero nodes
|
||||
settings.net.moneroPeersLabel=Connected peers
|
||||
settings.net.connection=Connection
|
||||
settings.net.connected=Connected
|
||||
settings.net.useTorForXmrJLabel=Use Tor for Monero network
|
||||
settings.net.useTorForXmrAfterSyncRadio=After wallet is synchronized
|
||||
settings.net.useTorForXmrOffRadio=Never
|
||||
|
|
|
@ -1043,6 +1043,8 @@ settings.net.p2pHeader=Síť Haveno
|
|||
settings.net.onionAddressLabel=Moje onion adresa
|
||||
settings.net.xmrNodesLabel=Použijte vlastní Monero node
|
||||
settings.net.moneroPeersLabel=Připojené peer uzly
|
||||
settings.net.connection=Připojení
|
||||
settings.net.connected=Připojeno
|
||||
settings.net.useTorForXmrJLabel=Použít Tor pro Monero síť
|
||||
settings.net.moneroNodesLabel=Monero nody, pro připojení
|
||||
settings.net.useProvidedNodesRadio=Použijte nabízené Monero Core nody
|
||||
|
|
|
@ -1043,6 +1043,8 @@ settings.net.p2pHeader=Haveno-Netzwerk
|
|||
settings.net.onionAddressLabel=Meine Onion-Adresse
|
||||
settings.net.xmrNodesLabel=Spezifische Monero-Knoten verwenden
|
||||
settings.net.moneroPeersLabel=Verbundene Peers
|
||||
settings.net.connection=Verbindung
|
||||
settings.net.connected=Verbunden
|
||||
settings.net.useTorForXmrJLabel=Tor für das Monero-Netzwerk verwenden
|
||||
settings.net.moneroNodesLabel=Mit Monero-Knoten verbinden
|
||||
settings.net.useProvidedNodesRadio=Bereitgestellte Monero-Core-Knoten verwenden
|
||||
|
|
|
@ -1044,6 +1044,8 @@ settings.net.p2pHeader=Red Haveno
|
|||
settings.net.onionAddressLabel=Mi dirección onion
|
||||
settings.net.xmrNodesLabel=Utilizar nodos Monero personalizados
|
||||
settings.net.moneroPeersLabel=Pares conectados
|
||||
settings.net.connection=Conexión
|
||||
settings.net.connected=Conectado
|
||||
settings.net.useTorForXmrJLabel=Usar Tor para la red Monero
|
||||
settings.net.moneroNodesLabel=Nodos Monero para conectarse
|
||||
settings.net.useProvidedNodesRadio=Utilizar nodos Monero Core proporcionados
|
||||
|
|
|
@ -1040,6 +1040,8 @@ settings.net.p2pHeader=Haveno network
|
|||
settings.net.onionAddressLabel=آدرس onion من
|
||||
settings.net.xmrNodesLabel=استفاده از گرههای Monero اختصاصی
|
||||
settings.net.moneroPeersLabel=همتایان متصل
|
||||
settings.net.connection=اتصال
|
||||
settings.net.connected=متصل
|
||||
settings.net.useTorForXmrJLabel=استفاده از Tor برای شبکه مونرو
|
||||
settings.net.moneroNodesLabel=گرههای Monero در دسترس
|
||||
settings.net.useProvidedNodesRadio=استفاده از نودهای بیتکوین ارائه شده
|
||||
|
|
|
@ -1045,6 +1045,8 @@ settings.net.p2pHeader=Le réseau Haveno
|
|||
settings.net.onionAddressLabel=Mon adresse onion
|
||||
settings.net.xmrNodesLabel=Utiliser des nœuds Monero personnalisés
|
||||
settings.net.moneroPeersLabel=Pairs connectés
|
||||
settings.net.connection=Connexion
|
||||
settings.net.connected=Connecté
|
||||
settings.net.useTorForXmrJLabel=Utiliser Tor pour le réseau Monero
|
||||
settings.net.moneroNodesLabel=Nœuds Monero pour se connecter à
|
||||
settings.net.useProvidedNodesRadio=Utiliser les nœuds Monero Core fournis
|
||||
|
|
|
@ -1042,6 +1042,8 @@ settings.net.p2pHeader=Rete Haveno
|
|||
settings.net.onionAddressLabel=Il mio indirizzo onion
|
||||
settings.net.xmrNodesLabel=Usa nodi Monero personalizzati
|
||||
settings.net.moneroPeersLabel=Peer connessi
|
||||
settings.net.connection=Connessione
|
||||
settings.net.connected=Connesso
|
||||
settings.net.useTorForXmrJLabel=Usa Tor per la rete Monero
|
||||
settings.net.moneroNodesLabel=Nodi Monero a cui connettersi
|
||||
settings.net.useProvidedNodesRadio=Usa i nodi Monero Core forniti
|
||||
|
|
|
@ -1043,6 +1043,8 @@ settings.net.p2pHeader=Havenoネットワーク
|
|||
settings.net.onionAddressLabel=私のonionアドレス
|
||||
settings.net.xmrNodesLabel=任意のモネロノードを使う
|
||||
settings.net.moneroPeersLabel=接続されたピア
|
||||
settings.net.connection=接続
|
||||
settings.net.connected=接続されました
|
||||
settings.net.useTorForXmrJLabel=MoneroネットワークにTorを使用
|
||||
settings.net.moneroNodesLabel=接続するMoneroノード:
|
||||
settings.net.useProvidedNodesRadio=提供されたMonero Core ノードを使う
|
||||
|
|
|
@ -1044,6 +1044,8 @@ settings.net.p2pHeader=Rede Haveno
|
|||
settings.net.onionAddressLabel=Meu endereço onion
|
||||
settings.net.xmrNodesLabel=Usar nodos personalizados do Monero
|
||||
settings.net.moneroPeersLabel=Pares conectados
|
||||
settings.net.connection=Conexão
|
||||
settings.net.connected=Conectado
|
||||
settings.net.useTorForXmrJLabel=Usar Tor na rede Monero
|
||||
settings.net.moneroNodesLabel=Conexão a nodos do Monero
|
||||
settings.net.useProvidedNodesRadio=Usar nodos do Monero Core fornecidos
|
||||
|
|
|
@ -1041,6 +1041,8 @@ settings.net.p2pHeader=Rede do Haveno
|
|||
settings.net.onionAddressLabel=O meu endereço onion
|
||||
settings.net.xmrNodesLabel=Usar nós de Monero personalizados
|
||||
settings.net.moneroPeersLabel=Pares conectados
|
||||
settings.net.connection=Conexão
|
||||
settings.net.connected=Conectado
|
||||
settings.net.useTorForXmrJLabel=Usar Tor para a rede de Monero
|
||||
settings.net.moneroNodesLabel=Nós de Monero para conectar
|
||||
settings.net.useProvidedNodesRadio=Usar nós de Monero Core providenciados
|
||||
|
|
|
@ -1040,6 +1040,8 @@ settings.net.p2pHeader=Haveno network
|
|||
settings.net.onionAddressLabel=Мой onion-адрес
|
||||
settings.net.xmrNodesLabel=Использовать особые узлы Monero
|
||||
settings.net.moneroPeersLabel=Подключенные пиры
|
||||
settings.net.connection=Соединение
|
||||
settings.net.connected=Подключено
|
||||
settings.net.useTorForXmrJLabel=Использовать Tor для сети Monero
|
||||
settings.net.moneroNodesLabel=Узлы Monero для подключения
|
||||
settings.net.useProvidedNodesRadio=Использовать предоставленные узлы Monero Core
|
||||
|
|
|
@ -1040,6 +1040,8 @@ settings.net.p2pHeader=Haveno network
|
|||
settings.net.onionAddressLabel=ที่อยู่ onion ของฉัน
|
||||
settings.net.xmrNodesLabel=ใช้โหนดเครือข่าย Monero ที่กำหนดเอง
|
||||
settings.net.moneroPeersLabel=เชื่อมต่อกับเน็ตเวิร์ก peers แล้ว
|
||||
settings.net.connection=การเชื่อมต่อ
|
||||
settings.net.connected=เชื่อมต่อ
|
||||
settings.net.useTorForXmrJLabel=ใช้ Tor สำหรับเครือข่าย Monero
|
||||
settings.net.moneroNodesLabel=ใช้โหนดเครือข่าย Monero เพื่อเชื่อมต่อ
|
||||
settings.net.useProvidedNodesRadio=ใช้โหนดเครือข่าย Monero ที่ให้มา
|
||||
|
|
|
@ -1310,6 +1310,8 @@ settings.net.p2pHeader=Haveno ağı
|
|||
settings.net.onionAddressLabel=Onion adresim
|
||||
settings.net.xmrNodesLabel=Özel Monero düğümleri kullan
|
||||
settings.net.moneroPeersLabel=Bağlı eşler
|
||||
settings.net.connection=Bağlantı
|
||||
settings.net.connected=Bağlı
|
||||
settings.net.useTorForXmrJLabel=Monero ağı için Tor kullan
|
||||
settings.net.useTorForXmrAfterSyncRadio=Cüzdan senkronize edildikten sonra
|
||||
settings.net.useTorForXmrOffRadio=Asla
|
||||
|
|
|
@ -1042,6 +1042,8 @@ settings.net.p2pHeader=Haveno network
|
|||
settings.net.onionAddressLabel=Địa chỉ onion của tôi
|
||||
settings.net.xmrNodesLabel=Sử dụng nút Monero thông dụng
|
||||
settings.net.moneroPeersLabel=Các đối tác được kết nối
|
||||
settings.net.connection=Kết nối
|
||||
settings.net.connected=Kết nối
|
||||
settings.net.useTorForXmrJLabel=Sử dụng Tor cho mạng Monero
|
||||
settings.net.moneroNodesLabel=nút Monero để kết nối
|
||||
settings.net.useProvidedNodesRadio=Sử dụng các nút Monero Core đã cung cấp
|
||||
|
|
|
@ -1043,6 +1043,8 @@ settings.net.p2pHeader=Haveno 网络
|
|||
settings.net.onionAddressLabel=我的匿名地址
|
||||
settings.net.xmrNodesLabel=使用自定义比特币主节点
|
||||
settings.net.moneroPeersLabel=已连接节点
|
||||
settings.net.connection=连接
|
||||
settings.net.connected=连接
|
||||
settings.net.useTorForXmrJLabel=使用 Tor 连接 Monero 网络
|
||||
settings.net.moneroNodesLabel=需要连接 Monero
|
||||
settings.net.useProvidedNodesRadio=使用公共比特币核心节点
|
||||
|
|
|
@ -1043,6 +1043,8 @@ settings.net.p2pHeader=Haveno 網絡
|
|||
settings.net.onionAddressLabel=我的匿名地址
|
||||
settings.net.xmrNodesLabel=使用自定义Monero节点
|
||||
settings.net.moneroPeersLabel=已連接節點
|
||||
settings.net.connection=連接
|
||||
settings.net.connected=連接完成
|
||||
settings.net.useTorForXmrJLabel=使用 Tor 連接 Monero 網絡
|
||||
settings.net.moneroNodesLabel=需要連接 Monero
|
||||
settings.net.useProvidedNodesRadio=使用公共比特幣核心節點
|
||||
|
|
|
@ -17,28 +17,23 @@
|
|||
|
||||
package haveno.desktop.main.settings.network;
|
||||
|
||||
import monero.daemon.model.MoneroPeer;
|
||||
import haveno.core.locale.Res;
|
||||
import monero.common.MoneroRpcConnection;
|
||||
|
||||
public class MoneroNetworkListItem {
|
||||
private final MoneroPeer peer;
|
||||
private final MoneroRpcConnection connection;
|
||||
private final boolean connected;
|
||||
|
||||
public MoneroNetworkListItem(MoneroPeer peer) {
|
||||
this.peer = peer;
|
||||
public MoneroNetworkListItem(MoneroRpcConnection connection, boolean connected) {
|
||||
this.connection = connection;
|
||||
this.connected = connected;
|
||||
}
|
||||
|
||||
public String getOnionAddress() {
|
||||
return peer.getHost() + ":" + peer.getPort();
|
||||
public String getAddress() {
|
||||
return connection.getUri();
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getSubVersion() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getHeight() {
|
||||
return String.valueOf(peer.getHeight());
|
||||
public String getConnected() {
|
||||
return connected ? Res.get("settings.net.connected") : "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,27 +45,17 @@
|
|||
|
||||
<TitledGroupBg fx:id="btcHeader" GridPane.rowSpan="5"/>
|
||||
<VBox GridPane.rowIndex="0" GridPane.hgrow="ALWAYS" GridPane.vgrow="SOMETIMES">
|
||||
<AutoTooltipLabel fx:id="moneroPeersLabel" styleClass="small-text"/>
|
||||
<TableView fx:id="moneroPeersTableView">
|
||||
<AutoTooltipLabel fx:id="moneroConnectionsLabel" styleClass="small-text"/>
|
||||
<TableView fx:id="moneroConnectionsTableView">
|
||||
<columns>
|
||||
<TableColumn fx:id="moneroPeerAddressColumn" minWidth="220">
|
||||
<TableColumn fx:id="moneroConnectionAddressColumn" minWidth="220">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="onionAddress"/>
|
||||
<PropertyValueFactory property="address"/>
|
||||
</cellValueFactory>
|
||||
</TableColumn>
|
||||
<TableColumn fx:id="moneroPeerVersionColumn" minWidth="80" maxWidth="90">
|
||||
<TableColumn fx:id="moneroConnectionConnectedColumn" minWidth="80" maxWidth="90">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="version"/>
|
||||
</cellValueFactory>
|
||||
</TableColumn>
|
||||
<TableColumn fx:id="moneroPeerSubVersionColumn" minWidth="180" maxWidth="180">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="subVersion"/>
|
||||
</cellValueFactory>
|
||||
</TableColumn>
|
||||
<TableColumn fx:id="moneroPeerHeightColumn" minWidth="80" maxWidth="80">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="height"/>
|
||||
<PropertyValueFactory property="connected"/>
|
||||
</cellValueFactory>
|
||||
</TableColumn>
|
||||
</columns>
|
||||
|
|
|
@ -44,7 +44,6 @@ import haveno.desktop.main.overlays.windows.TorNetworkSettingsWindow;
|
|||
import haveno.desktop.util.GUIUtil;
|
||||
import haveno.network.p2p.P2PService;
|
||||
import haveno.network.p2p.network.Statistic;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import static javafx.beans.binding.Bindings.createStringBinding;
|
||||
|
@ -63,7 +62,6 @@ import javafx.scene.control.TextField;
|
|||
import javafx.scene.control.Toggle;
|
||||
import javafx.scene.control.ToggleGroup;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import monero.daemon.model.MoneroPeer;
|
||||
import org.fxmisc.easybind.EasyBind;
|
||||
import org.fxmisc.easybind.Subscription;
|
||||
|
||||
|
@ -79,7 +77,7 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
@FXML
|
||||
TextField onionAddress, sentDataTextField, receivedDataTextField, chainHeightTextField;
|
||||
@FXML
|
||||
Label p2PPeersLabel, moneroPeersLabel;
|
||||
Label p2PPeersLabel, moneroConnectionsLabel;
|
||||
@FXML
|
||||
RadioButton useTorForXmrAfterSyncRadio, useTorForXmrOffRadio, useTorForXmrOnRadio;
|
||||
@FXML
|
||||
|
@ -87,13 +85,12 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
@FXML
|
||||
TableView<P2pNetworkListItem> p2pPeersTableView;
|
||||
@FXML
|
||||
TableView<MoneroNetworkListItem> moneroPeersTableView;
|
||||
TableView<MoneroNetworkListItem> moneroConnectionsTableView;
|
||||
@FXML
|
||||
TableColumn<P2pNetworkListItem, String> onionAddressColumn, connectionTypeColumn, creationDateColumn,
|
||||
roundTripTimeColumn, sentBytesColumn, receivedBytesColumn, peerTypeColumn;
|
||||
@FXML
|
||||
TableColumn<MoneroNetworkListItem, String> moneroPeerAddressColumn, moneroPeerVersionColumn,
|
||||
moneroPeerSubVersionColumn, moneroPeerHeightColumn;
|
||||
TableColumn<MoneroNetworkListItem, String> moneroConnectionAddressColumn, moneroConnectionConnectedColumn;
|
||||
@FXML
|
||||
Label rescanOutputsLabel;
|
||||
@FXML
|
||||
|
@ -116,7 +113,7 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
private final SortedList<MoneroNetworkListItem> moneroSortedList = new SortedList<>(moneroNetworkListItems);
|
||||
|
||||
private Subscription numP2PPeersSubscription;
|
||||
private Subscription moneroPeersSubscription;
|
||||
private Subscription moneroConnectionsSubscription;
|
||||
private Subscription moneroBlockHeightSubscription;
|
||||
private Subscription nodeAddressSubscription;
|
||||
private ChangeListener<Boolean> xmrNodesInputTextFieldFocusListener;
|
||||
|
@ -156,17 +153,15 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
p2pHeader.setText(Res.get("settings.net.p2pHeader"));
|
||||
onionAddress.setPromptText(Res.get("settings.net.onionAddressLabel"));
|
||||
xmrNodesLabel.setText(Res.get("settings.net.xmrNodesLabel"));
|
||||
moneroPeersLabel.setText(Res.get("settings.net.moneroPeersLabel"));
|
||||
moneroConnectionsLabel.setText(Res.get("settings.net.moneroPeersLabel"));
|
||||
useTorForXmrLabel.setText(Res.get("settings.net.useTorForXmrJLabel"));
|
||||
useTorForXmrAfterSyncRadio.setText(Res.get("settings.net.useTorForXmrAfterSyncRadio"));
|
||||
useTorForXmrOffRadio.setText(Res.get("settings.net.useTorForXmrOffRadio"));
|
||||
useTorForXmrOnRadio.setText(Res.get("settings.net.useTorForXmrOnRadio"));
|
||||
moneroNodesLabel.setText(Res.get("settings.net.moneroNodesLabel"));
|
||||
moneroPeerAddressColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.onionAddressColumn")));
|
||||
moneroPeerAddressColumn.getStyleClass().add("first-column");
|
||||
moneroPeerVersionColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.versionColumn")));
|
||||
moneroPeerSubVersionColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.subVersionColumn")));
|
||||
moneroPeerHeightColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.heightColumn")));
|
||||
moneroConnectionAddressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));
|
||||
moneroConnectionAddressColumn.getStyleClass().add("first-column");
|
||||
moneroConnectionConnectedColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.connection")));
|
||||
localhostXmrNodeInfoLabel.setText(Res.get("settings.net.localhostXmrNodeInfo"));
|
||||
useProvidedNodesRadio.setText(Res.get("settings.net.useProvidedNodesRadio"));
|
||||
useCustomNodesRadio.setText(Res.get("settings.net.useCustomNodesRadio"));
|
||||
|
@ -192,19 +187,19 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
rescanOutputsLabel.setVisible(false);
|
||||
rescanOutputsButton.setVisible(false);
|
||||
|
||||
GridPane.setMargin(moneroPeersLabel, new Insets(4, 0, 0, 0));
|
||||
GridPane.setValignment(moneroPeersLabel, VPos.TOP);
|
||||
GridPane.setMargin(moneroConnectionsLabel, new Insets(4, 0, 0, 0));
|
||||
GridPane.setValignment(moneroConnectionsLabel, VPos.TOP);
|
||||
|
||||
GridPane.setMargin(p2PPeersLabel, new Insets(4, 0, 0, 0));
|
||||
GridPane.setValignment(p2PPeersLabel, VPos.TOP);
|
||||
|
||||
moneroPeersTableView.setMinHeight(180);
|
||||
moneroPeersTableView.setPrefHeight(180);
|
||||
moneroPeersTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||
moneroPeersTableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
|
||||
moneroPeersTableView.getSortOrder().add(moneroPeerAddressColumn);
|
||||
moneroPeerAddressColumn.setSortType(TableColumn.SortType.ASCENDING);
|
||||
|
||||
moneroConnectionAddressColumn.setSortType(TableColumn.SortType.ASCENDING);
|
||||
moneroConnectionConnectedColumn.setSortType(TableColumn.SortType.DESCENDING);
|
||||
moneroConnectionsTableView.setMinHeight(180);
|
||||
moneroConnectionsTableView.setPrefHeight(180);
|
||||
moneroConnectionsTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||
moneroConnectionsTableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
|
||||
moneroConnectionsTableView.getSortOrder().add(moneroConnectionConnectedColumn);
|
||||
|
||||
p2pPeersTableView.setMinHeight(180);
|
||||
p2pPeersTableView.setPrefHeight(180);
|
||||
|
@ -309,11 +304,11 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
|
||||
rescanOutputsButton.setOnAction(event -> GUIUtil.rescanOutputs(preferences));
|
||||
|
||||
moneroPeersSubscription = EasyBind.subscribe(connectionService.peerConnectionsProperty(),
|
||||
this::updateMoneroPeersTable);
|
||||
moneroConnectionsSubscription = EasyBind.subscribe(connectionService.connectionsProperty(),
|
||||
connections -> updateMoneroConnectionsTable());
|
||||
|
||||
moneroBlockHeightSubscription = EasyBind.subscribe(connectionService.chainHeightProperty(),
|
||||
this::updateChainHeightTextField);
|
||||
height -> updateMoneroConnectionsTable());
|
||||
|
||||
nodeAddressSubscription = EasyBind.subscribe(p2PService.getNetworkNode().nodeAddressProperty(),
|
||||
nodeAddress -> onionAddress.setText(nodeAddress == null ?
|
||||
|
@ -333,8 +328,8 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
Statistic.numTotalReceivedMessagesPerSecProperty().get()),
|
||||
Statistic.numTotalReceivedMessagesPerSecProperty()));
|
||||
|
||||
moneroSortedList.comparatorProperty().bind(moneroPeersTableView.comparatorProperty());
|
||||
moneroPeersTableView.setItems(moneroSortedList);
|
||||
moneroSortedList.comparatorProperty().bind(moneroConnectionsTableView.comparatorProperty());
|
||||
moneroConnectionsTableView.setItems(moneroSortedList);
|
||||
|
||||
p2pSortedList.comparatorProperty().bind(p2pPeersTableView.comparatorProperty());
|
||||
p2pPeersTableView.setItems(p2pSortedList);
|
||||
|
@ -355,8 +350,8 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
if (nodeAddressSubscription != null)
|
||||
nodeAddressSubscription.unsubscribe();
|
||||
|
||||
if (moneroPeersSubscription != null)
|
||||
moneroPeersSubscription.unsubscribe();
|
||||
if (moneroConnectionsSubscription != null)
|
||||
moneroConnectionsSubscription.unsubscribe();
|
||||
|
||||
if (moneroBlockHeightSubscription != null)
|
||||
moneroBlockHeightSubscription.unsubscribe();
|
||||
|
@ -521,13 +516,15 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
private void updateMoneroPeersTable(List<MoneroPeer> peers) {
|
||||
moneroNetworkListItems.clear();
|
||||
if (peers != null) {
|
||||
moneroNetworkListItems.setAll(peers.stream()
|
||||
.map(MoneroNetworkListItem::new)
|
||||
private void updateMoneroConnectionsTable() {
|
||||
UserThread.execute(() -> {
|
||||
if (connectionService.isShutDownStarted()) return; // ignore if shutting down
|
||||
moneroNetworkListItems.clear();
|
||||
moneroNetworkListItems.setAll(connectionService.getConnections().stream()
|
||||
.map(connection -> new MoneroNetworkListItem(connection, Boolean.TRUE.equals(connection.isConnected()) && connection == connectionService.getConnection()))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
updateChainHeightTextField(connectionService.chainHeightProperty().get());
|
||||
});
|
||||
}
|
||||
|
||||
private void updateChainHeightTextField(Number chainHeight) {
|
||||
|
|
Loading…
Reference in a new issue