Display subType.

This commit is contained in:
Mark Nellemann 2023-08-09 18:00:56 +02:00
parent 5408a125f1
commit 5c9069f441
4 changed files with 16 additions and 7 deletions

View file

@ -45,7 +45,7 @@ public class NetworkServiceCell extends CharmListCell<NetworkService> {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null && !empty) { if (item != null && !empty) {
tile.textProperty().setAll(item.getName(), tile.textProperty().setAll(item.getName(),
"App: " + item.getApp(), "URL: " + item.getUrl() item.getApp() + " (" + item.getSubType() + ") - " + item.getUrl()
); );
icon.setFill(item.getColor()); icon.setFill(item.getColor());
setGraphic(tile); setGraphic(tile);

View file

@ -37,7 +37,7 @@ public class NetworkServiceListener implements ServiceListener {
if (serviceInfo != null) { if (serviceInfo != null) {
String name = serviceInfo.getName(); String name = serviceInfo.getName();
log.info("serviceRemoved() - Service: " + name); log.info("serviceRemoved() - Service: " + name);
NetworkService oldNetworkService = new NetworkService(name, service, serviceInfo.getApplication(), serviceInfo.getURLs()[0], color); NetworkService oldNetworkService = new NetworkService(name, service, serviceInfo.getSubtype(), serviceInfo.getApplication(), serviceInfo.getURLs()[0], color);
Platform.runLater(() -> { Platform.runLater(() -> {
observableList.remove(oldNetworkService); observableList.remove(oldNetworkService);
}); });
@ -52,7 +52,7 @@ public class NetworkServiceListener implements ServiceListener {
String name = serviceInfo.getName(); String name = serviceInfo.getName();
String app = serviceInfo.getApplication(); String app = serviceInfo.getApplication();
log.info("serviceResolved() - Service: {} - {} with url {}", app, name, url); log.info("serviceResolved() - Service: {} - {} with url {}", app, name, url);
NetworkService newNetworkService = new NetworkService(name, service, app, url, color); NetworkService newNetworkService = new NetworkService(name, service, serviceInfo.getSubtype(), app, url, color);
Platform.runLater(() -> { Platform.runLater(() -> {
if(!observableList.contains(newNetworkService)) { if(!observableList.contains(newNetworkService)) {
observableList.add(newNetworkService); observableList.add(newNetworkService);

View file

@ -6,13 +6,15 @@ public class NetworkService {
private String name; private String name;
private String type; private String type;
private String subType;
private String app; private String app;
private String url; private String url;
private Color color; private Color color;
public NetworkService(String name, String type, String app, String url, Color color) { public NetworkService(String name, String type, String subType, String app, String url, Color color) {
this.name = name; this.name = name;
this.type = type; this.type = type;
this.subType = subType;
this.app = app; this.app = app;
this.url = url; this.url = url;
this.color = color; this.color = color;
@ -34,6 +36,14 @@ public class NetworkService {
this.type = type; this.type = type;
} }
public String getSubType() {
return subType;
}
public void setSubType(String subType) {
this.subType = subType;
}
public String getApp() { public String getApp() {
return app; return app;
} }

View file

@ -11,9 +11,8 @@ import javax.annotation.PostConstruct;
import javax.inject.Singleton; import javax.inject.Singleton;
import javax.jmdns.JmDNS; import javax.jmdns.JmDNS;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.net.InetAddress;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@ -72,7 +71,7 @@ public class DiscoveryService {
public void initialize() { public void initialize() {
log.info("initialize()"); log.info("initialize()");
try { try {
jmdns = JmDNS.create(null, "mdnsExplorer"); jmdns = JmDNS.create(InetAddress.getByName("0.0.0.0"), "mdnsExplorer");
} catch (IOException e) { } catch (IOException e) {
log.error("initialize() - {}", e.getMessage()); log.error("initialize() - {}", e.getMessage());
} }