mirror of
https://github.com/wownero/i2p-zero.git
synced 2026-10-17 23:31:42 +02:00
Added state column to tunnels table
This commit is contained in:
@@ -41,6 +41,7 @@ public class Controller {
|
||||
@FXML private Button tunnelRemoveButton;
|
||||
@FXML private TableView<Tunnel> tunnelsTableView;
|
||||
@FXML private TableColumn typeCol;
|
||||
@FXML private TableColumn stateCol;
|
||||
@FXML private TableColumn hostCol;
|
||||
@FXML private TableColumn portCol;
|
||||
@FXML private TableColumn i2PCol;
|
||||
@@ -64,11 +65,12 @@ public class Controller {
|
||||
@FXML private void initialize() {
|
||||
|
||||
typeCol.setCellValueFactory(new PropertyValueFactory<Tunnel,String>("type"));
|
||||
stateCol.setCellValueFactory(new PropertyValueFactory<Tunnel,String>("state"));
|
||||
hostCol.setCellValueFactory(new PropertyValueFactory<Tunnel,String>("host"));
|
||||
portCol.setCellValueFactory(new PropertyValueFactory<Tunnel,String>("port"));
|
||||
i2PCol.setCellValueFactory(new PropertyValueFactory<Tunnel,String>("I2P"));
|
||||
|
||||
DoubleBinding usedWidth = typeCol.widthProperty().add(hostCol.widthProperty()).add(portCol.widthProperty());
|
||||
DoubleBinding usedWidth = typeCol.widthProperty().add(stateCol.widthProperty()).add(hostCol.widthProperty()).add(portCol.widthProperty());
|
||||
i2PCol.prefWidthProperty().bind(tunnelsTableView.widthProperty().subtract(usedWidth).subtract(2));
|
||||
|
||||
tunnelsTableView.setItems(tunnelTableList);
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.getmonero.i2p.zero.gui;
|
||||
|
||||
import java.awt.Taskbar;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.List;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
<TableView fx:id="tunnelsTableView" prefHeight="139.0" prefWidth="318.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="typeCol" prefWidth="93.0" text="Type" />
|
||||
<TableColumn fx:id="stateCol" prefWidth="93.0" text="State" />
|
||||
<TableColumn fx:id="hostCol" prefWidth="186.0" text="Host" />
|
||||
<TableColumn fx:id="portCol" minWidth="0.0" prefWidth="70.0" text="Port" />
|
||||
<TableColumn fx:id="i2PCol" prefWidth="280.0" text="I2P address" />
|
||||
|
||||
@@ -43,6 +43,7 @@ public class TunnelControl implements Runnable {
|
||||
public String getHost();
|
||||
public String getPort();
|
||||
public String getI2P();
|
||||
public String getState();
|
||||
public void destroy();
|
||||
}
|
||||
|
||||
@@ -59,6 +60,7 @@ public class TunnelControl implements Runnable {
|
||||
}
|
||||
public void destroy() {
|
||||
new Thread(()->{
|
||||
while(tunnel==null) { try { Thread.sleep(100); } catch (InterruptedException e) {} } // wait for tunnel to be established before closing it
|
||||
tunnel.runClose(new String[]{"forced", "all"}, tunnel);
|
||||
}).start();
|
||||
}
|
||||
@@ -67,6 +69,7 @@ public class TunnelControl implements Runnable {
|
||||
@Override public String getHost() { return "localhost"; }
|
||||
@Override public String getPort() { return port+""; }
|
||||
@Override public String getI2P() { return dest; }
|
||||
@Override public String getState() { return tunnel==null ? "opening..." : "open"; }
|
||||
}
|
||||
public static class ServerTunnel implements Tunnel {
|
||||
public String dest;
|
||||
@@ -92,6 +95,7 @@ public class TunnelControl implements Runnable {
|
||||
}
|
||||
public void destroy() {
|
||||
new Thread(()->{
|
||||
while(tunnel==null) { try { Thread.sleep(100); } catch (InterruptedException e) {} } // wait for tunnel to be established before closing it
|
||||
tunnel.runClose(new String[]{"forced", "all"}, tunnel);
|
||||
}).start();
|
||||
}
|
||||
@@ -99,6 +103,7 @@ public class TunnelControl implements Runnable {
|
||||
@Override public String getHost() { return host; }
|
||||
@Override public String getPort() { return port+""; }
|
||||
@Override public String getI2P() { return dest; }
|
||||
@Override public String getState() { return tunnel==null ? "opening..." : "open"; }
|
||||
|
||||
}
|
||||
public static class SocksTunnel implements Tunnel {
|
||||
@@ -112,6 +117,7 @@ public class TunnelControl implements Runnable {
|
||||
}
|
||||
public void destroy() {
|
||||
new Thread(()->{
|
||||
while(tunnel==null) { try { Thread.sleep(100); } catch (InterruptedException e) {} } // wait for tunnel to be established before closing it
|
||||
tunnel.runClose(new String[]{"forced", "all"}, tunnel);
|
||||
}).start();
|
||||
}
|
||||
@@ -119,6 +125,7 @@ public class TunnelControl implements Runnable {
|
||||
@Override public String getHost() { return "localhost"; }
|
||||
@Override public String getPort() { return port+""; }
|
||||
@Override public String getI2P() { return "n/a"; }
|
||||
@Override public String getState() { return tunnel==null ? "opening..." : "open"; }
|
||||
}
|
||||
|
||||
public List<Tunnel> getTunnels() {
|
||||
|
||||
Reference in New Issue
Block a user