Merge remote-tracking branch 'origin/main'

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

View file

@ -94,7 +94,7 @@ gluonfx {
//providedKeyAlias = "" //providedKeyAlias = ""
//providedKeyAliasPassword = "" //providedKeyAliasPassword = ""
// iOS // iOS
//bundleName = "" //bundleName = "mDNS Explorer"
//bundleVersion = "" //bundleVersion = ""
//bundleShortVersion = "" //bundleShortVersion = ""
//providedSigningIdentity = "" //providedSigningIdentity = ""

View file

@ -18,6 +18,7 @@ public class NetworkServiceCell extends CharmListCell<NetworkService> {
private final Clipboard clipboard; private final Clipboard clipboard;
private final ClipboardContent clipboardContent; private final ClipboardContent clipboardContent;
public NetworkServiceCell() { public NetworkServiceCell() {
clipboard = Clipboard.getSystemClipboard(); clipboard = Clipboard.getSystemClipboard();
clipboardContent = new ClipboardContent(); clipboardContent = new ClipboardContent();
@ -38,6 +39,7 @@ public class NetworkServiceCell extends CharmListCell<NetworkService> {
setText(null); setText(null);
} }
@Override @Override
public void updateItem(NetworkService item, boolean empty) { public void updateItem(NetworkService item, boolean empty) {
super.updateItem(item, empty); super.updateItem(item, empty);

View file

@ -29,6 +29,8 @@ public class NetworkServiceListener implements ServiceListener {
@Override @Override
public void serviceAdded(ServiceEvent event) { public void serviceAdded(ServiceEvent event) {
ServiceInfo serviceInfo = event.getInfo();
log.info("serviceRemoved() - Service: " + serviceInfo.getName());
} }
@Override @Override
@ -37,10 +39,12 @@ 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.getSubtype(), serviceInfo.getApplication(), serviceInfo.getURLs()[0], color); NetworkService networkService = new NetworkService(name, service, serviceInfo.getSubtype(), serviceInfo.getApplication(), serviceInfo.getURLs()[0], color);
Platform.runLater(() -> { while (observableList.contains(networkService)) {
observableList.remove(oldNetworkService); Platform.runLater(() -> {
}); observableList.remove(networkService);
});
}
} }
} }
@ -52,10 +56,10 @@ 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, serviceInfo.getSubtype(), app, url, color); NetworkService networkService = new NetworkService(name, service, serviceInfo.getSubtype(), app, url, color);
Platform.runLater(() -> { Platform.runLater(() -> {
if(!observableList.contains(newNetworkService)) { if(!observableList.contains(networkService)) {
observableList.add(newNetworkService); observableList.add(networkService);
} }
}); });
} }

View file

@ -2,6 +2,8 @@ package biz.nellemann.mdexpl.model;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import java.util.Objects;
public class NetworkService { public class NetworkService {
private String name; private String name;
@ -75,13 +77,23 @@ public class NetworkService {
return name + " (" + type + "), app=" + app + ", url=" + url; return name + " (" + type + "), app=" + app + ", url=" + url;
} }
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (o == this) return true; if (this == o)
if (!(o instanceof NetworkService networkService)) { return true;
if (o == null || getClass() != o.getClass())
return false; return false;
} NetworkService networkService = (NetworkService) o;
return networkService.name.equals(name) && networkService.type.equals(type) && networkService.url.equals(url); return Objects.equals(type, networkService.type) && Objects.equals(name, networkService.name) && Objects.equals(url, networkService.url);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((url == null) ? 0 : url.hashCode());
return result;
} }
} }

View file

@ -52,6 +52,7 @@ public class DiscoveryService {
put("ipp", Color.LIGHTGRAY); put("ipp", Color.LIGHTGRAY);
put("ipps", Color.LIGHTGRAY); put("ipps", Color.LIGHTGRAY);
put("printer", Color.LIGHTGRAY); put("printer", Color.LIGHTGRAY);
put("scanner", Color.LIGHTGRAY);
put("nfs", Color.CORAL); put("nfs", Color.CORAL);
put("smb", Color.CORAL); put("smb", Color.CORAL);
@ -59,7 +60,9 @@ public class DiscoveryService {
put("webdav", Color.CORAL); put("webdav", Color.CORAL);
put("smartenergy", Color.LIGHTGREEN); put("smartenergy", Color.LIGHTGREEN);
put("hap", Color.LIGHTGREEN);
put("homekit", Color.LIGHTGREEN); put("homekit", Color.LIGHTGREEN);
put("homebridge", Color.LIGHTGREEN);
put("sip", Color.YELLOW); put("sip", Color.YELLOW);
put("skype", Color.YELLOW); put("skype", Color.YELLOW);