Merge remote-tracking branch 'origin/main'

This commit is contained in:
Mark Nellemann 2023-08-10 14:33:14 +02:00
commit f80b1af19a
3 changed files with 16 additions and 5 deletions

View File

@ -33,10 +33,8 @@ public class NetworkServiceCell extends CharmListCell<NetworkService> {
icon.setWidth(25);
tile.setPrimaryGraphic(icon);
tile.setOnMouseClicked(e -> {
System.out.println("Selected -> " + itemProperty().get().getName() );
clipboardContent.putString(itemProperty().get().getUrl());
clipboard.setContent(clipboardContent);
// TODO: Copy to iOS / Android clipboard
});
setText(null);
}

View File

@ -8,6 +8,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Singleton;
import javax.jmdns.JmDNS;
import java.io.IOException;
@ -81,6 +82,18 @@ public class DiscoveryService {
}
@PreDestroy
public void destroy() {
if(jmdns != null) {
try {
jmdns.close();
} catch (IOException e) {
log.error("destroy() - {}", e.getMessage());
}
}
}
public void setObservableList(ObservableList<NetworkService> list) {
this.observableList = list;
services.forEach((item, color) -> {
@ -90,4 +103,5 @@ public class DiscoveryService {
});
}
}

View File

@ -39,9 +39,9 @@ public class MainPresenter {
private ResourceBundle resources;
@FXML
private CharmListView charmListView;
private CharmListView<NetworkService, Integer> charmListView;
private ObservableList<NetworkService> devicesList = FXCollections.observableArrayList();
private final ObservableList<NetworkService> devicesList = FXCollections.observableArrayList();
@FXML
@ -62,7 +62,6 @@ public class MainPresenter {
});
discoveryService.setObservableList(devicesList);
charmListView.setItems(devicesList);
charmListView.setCellFactory(p -> new NetworkServiceCell());
}