From 5c9069f441c720a05049d3f3bc354555efd769ef Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Wed, 9 Aug 2023 18:00:56 +0200 Subject: [PATCH] Display subType. --- .../biz/nellemann/mdexpl/NetworkServiceCell.java | 2 +- .../biz/nellemann/mdexpl/NetworkServiceListener.java | 4 ++-- .../biz/nellemann/mdexpl/model/NetworkService.java | 12 +++++++++++- .../nellemann/mdexpl/service/DiscoveryService.java | 5 ++--- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/biz/nellemann/mdexpl/NetworkServiceCell.java b/src/main/java/biz/nellemann/mdexpl/NetworkServiceCell.java index 296b7b7..0276316 100644 --- a/src/main/java/biz/nellemann/mdexpl/NetworkServiceCell.java +++ b/src/main/java/biz/nellemann/mdexpl/NetworkServiceCell.java @@ -45,7 +45,7 @@ public class NetworkServiceCell extends CharmListCell { super.updateItem(item, empty); if (item != null && !empty) { tile.textProperty().setAll(item.getName(), - "App: " + item.getApp(), "URL: " + item.getUrl() + item.getApp() + " (" + item.getSubType() + ") - " + item.getUrl() ); icon.setFill(item.getColor()); setGraphic(tile); diff --git a/src/main/java/biz/nellemann/mdexpl/NetworkServiceListener.java b/src/main/java/biz/nellemann/mdexpl/NetworkServiceListener.java index 44a9751..1f73ac4 100644 --- a/src/main/java/biz/nellemann/mdexpl/NetworkServiceListener.java +++ b/src/main/java/biz/nellemann/mdexpl/NetworkServiceListener.java @@ -37,7 +37,7 @@ public class NetworkServiceListener implements ServiceListener { if (serviceInfo != null) { String name = serviceInfo.getName(); 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(() -> { observableList.remove(oldNetworkService); }); @@ -52,7 +52,7 @@ public class NetworkServiceListener implements ServiceListener { String name = serviceInfo.getName(); String app = serviceInfo.getApplication(); 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(() -> { if(!observableList.contains(newNetworkService)) { observableList.add(newNetworkService); diff --git a/src/main/java/biz/nellemann/mdexpl/model/NetworkService.java b/src/main/java/biz/nellemann/mdexpl/model/NetworkService.java index 465c2d5..bdee01c 100644 --- a/src/main/java/biz/nellemann/mdexpl/model/NetworkService.java +++ b/src/main/java/biz/nellemann/mdexpl/model/NetworkService.java @@ -6,13 +6,15 @@ public class NetworkService { private String name; private String type; + private String subType; private String app; private String url; 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.type = type; + this.subType = subType; this.app = app; this.url = url; this.color = color; @@ -34,6 +36,14 @@ public class NetworkService { this.type = type; } + public String getSubType() { + return subType; + } + + public void setSubType(String subType) { + this.subType = subType; + } + public String getApp() { return app; } diff --git a/src/main/java/biz/nellemann/mdexpl/service/DiscoveryService.java b/src/main/java/biz/nellemann/mdexpl/service/DiscoveryService.java index e4dd045..e17da8a 100644 --- a/src/main/java/biz/nellemann/mdexpl/service/DiscoveryService.java +++ b/src/main/java/biz/nellemann/mdexpl/service/DiscoveryService.java @@ -11,9 +11,8 @@ import javax.annotation.PostConstruct; import javax.inject.Singleton; import javax.jmdns.JmDNS; import java.io.IOException; -import java.util.Arrays; +import java.net.InetAddress; import java.util.HashMap; -import java.util.List; import java.util.Map; @@ -72,7 +71,7 @@ public class DiscoveryService { public void initialize() { log.info("initialize()"); try { - jmdns = JmDNS.create(null, "mdnsExplorer"); + jmdns = JmDNS.create(InetAddress.getByName("0.0.0.0"), "mdnsExplorer"); } catch (IOException e) { log.error("initialize() - {}", e.getMessage()); }