mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-31 02:39:08 -04:00
Cleanup
This commit is contained in:
parent
540f49f1e1
commit
fc1ab8a346
11 changed files with 140 additions and 53 deletions
|
@ -28,7 +28,6 @@ import io.bitsquare.gui.util.BSFormatter;
|
|||
import io.bitsquare.p2p.NodeAddress;
|
||||
import io.bitsquare.p2p.P2PService;
|
||||
import io.bitsquare.p2p.P2PServiceListener;
|
||||
import io.bitsquare.p2p.network.LocalhostNetworkNode;
|
||||
import io.bitsquare.user.Preferences;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.collections.FXCollections;
|
||||
|
@ -84,9 +83,6 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
|
|||
this.p2PService = p2PService;
|
||||
this.preferences = preferences;
|
||||
this.formatter = formatter;
|
||||
BitcoinNetwork bitcoinNetwork = preferences.getBitcoinNetwork();
|
||||
|
||||
boolean useLocalhost = p2PService.getNetworkNode() instanceof LocalhostNetworkNode;
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
|
|
|
@ -34,32 +34,32 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.time.Duration;
|
||||
|
||||
public class NetworkStatisticListItem {
|
||||
class NetworkStatisticListItem {
|
||||
private static final Logger log = LoggerFactory.getLogger(NetworkStatisticListItem.class);
|
||||
|
||||
final Statistic statistic;
|
||||
private final Statistic statistic;
|
||||
private final Connection connection;
|
||||
private final Subscription sentBytesSubscription, receivedBytesSubscription;
|
||||
private final Timer timer;
|
||||
private BSFormatter formatter;
|
||||
private final BSFormatter formatter;
|
||||
|
||||
private StringProperty lastActivity = new SimpleStringProperty();
|
||||
private StringProperty sentBytes = new SimpleStringProperty();
|
||||
private StringProperty receivedBytes = new SimpleStringProperty();
|
||||
private final StringProperty lastActivity = new SimpleStringProperty();
|
||||
private final StringProperty sentBytes = new SimpleStringProperty();
|
||||
private final StringProperty receivedBytes = new SimpleStringProperty();
|
||||
|
||||
public NetworkStatisticListItem(Connection connection, BSFormatter formatter) {
|
||||
this.connection = connection;
|
||||
this.formatter = formatter;
|
||||
this.statistic = connection.getStatistic();
|
||||
|
||||
sentBytesSubscription = EasyBind.subscribe(statistic.sentBytesProperty,
|
||||
sentBytesSubscription = EasyBind.subscribe(statistic.sentBytesProperty(),
|
||||
e -> sentBytes.set(formatter.formatBytes((int) e)));
|
||||
receivedBytesSubscription = EasyBind.subscribe(statistic.receivedBytesProperty,
|
||||
receivedBytesSubscription = EasyBind.subscribe(statistic.receivedBytesProperty(),
|
||||
e -> receivedBytes.set(formatter.formatBytes((int) e)));
|
||||
|
||||
timer = FxTimer.runPeriodically(Duration.ofMillis(1000),
|
||||
() -> UserThread.execute(() -> onLastActivityChanged(statistic.lastActivityTimestampProperty.get())));
|
||||
onLastActivityChanged(statistic.lastActivityTimestampProperty.get());
|
||||
() -> UserThread.execute(() -> onLastActivityChanged(statistic.getLastActivityTimestamp())));
|
||||
onLastActivityChanged(statistic.getLastActivityTimestamp());
|
||||
}
|
||||
|
||||
private void onLastActivityChanged(long timeStamp) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue