Copy to clipboard on select.
This commit is contained in:
parent
43ad3afe55
commit
3994af2b15
|
@ -63,7 +63,7 @@ gluonfx {
|
|||
|
||||
attachConfig {
|
||||
version = "4.0.18"
|
||||
services 'storage', 'display', 'lifecycle', 'statusbar', 'cache'
|
||||
services 'storage', 'display', 'lifecycle', 'statusbar'
|
||||
}
|
||||
|
||||
reflectionList = [
|
||||
|
|
|
@ -1,19 +1,27 @@
|
|||
package biz.nellemann.mdexpl;
|
||||
|
||||
import biz.nellemann.mdexpl.model.NetworkService;
|
||||
import com.gluonhq.attach.util.impl.ClipboardUtils;
|
||||
import com.gluonhq.charm.glisten.control.CharmListCell;
|
||||
import com.gluonhq.charm.glisten.control.ListTile;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.input.ClipboardContent;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
import javafx.scene.input.Clipboard;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class NetworkServiceCell extends CharmListCell<NetworkService> {
|
||||
|
||||
private final ListTile tile;
|
||||
//private final ImageView imageView;
|
||||
private final Rectangle icon;
|
||||
|
||||
private final Clipboard clipboard;
|
||||
private final ClipboardContent clipboardContent;
|
||||
|
||||
public NetworkServiceCell() {
|
||||
clipboard = Clipboard.getSystemClipboard();
|
||||
clipboardContent = new ClipboardContent();
|
||||
|
||||
this.tile = new ListTile();
|
||||
//imageView = new ImageView();
|
||||
//imageView.setFitHeight(15);
|
||||
|
@ -23,7 +31,12 @@ public class NetworkServiceCell extends CharmListCell<NetworkService> {
|
|||
icon.setHeight(25);
|
||||
icon.setWidth(25);
|
||||
tile.setPrimaryGraphic(icon);
|
||||
tile.setOnMouseClicked(e -> { System.out.println("Selected -> " + itemProperty().get().getName() ); });
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,26 +32,39 @@ public class DiscoveryService {
|
|||
"googlecast", "sonos", "airplay", "smartenergy", "skype", "bittorrent"
|
||||
);*/
|
||||
|
||||
// From: http://www.dns-sd.org/serviceTypes.html + some guesses
|
||||
// From: http://www.dns-sd.org/serviceTypes.html +
|
||||
// https://jonathanmumm.com/tech-it/mdns-bonjour-bible-common-service-strings-for-various-vendors/ + some guesses
|
||||
private final Map<String, Color> services = new HashMap<>() {{
|
||||
put("http", Color.BLUE);
|
||||
put("https", Color.DARKBLUE);
|
||||
|
||||
put("googlecast", Color.RED);
|
||||
//put("googlezone", Color.RED);
|
||||
put("googlerpc", Color.RED);
|
||||
put("airplay", Color.SLATEGRAY);
|
||||
put("sonos", Color.SANDYBROWN);
|
||||
//put("spotify-connect", Color.SANDYBROWN);
|
||||
|
||||
put("ssh", Color.GOLD);
|
||||
put("rdp", Color.GOLD);
|
||||
put("teamviewer", Color.GOLD);
|
||||
|
||||
put("ipp", Color.LIGHTGRAY);
|
||||
put("ipps", Color.LIGHTGRAY);
|
||||
put("printer", Color.LIGHTGRAY);
|
||||
|
||||
put("nfs", Color.CORAL);
|
||||
put("smb", Color.CORAL);
|
||||
put("cifs", Color.CORAL);
|
||||
put("webdav", Color.CORAL);
|
||||
|
||||
put("smartenergy", Color.LIGHTGREEN);
|
||||
put("homekit", Color.LIGHTGREEN);
|
||||
|
||||
put("sip", Color.YELLOW);
|
||||
put("skype", Color.YELLOW);
|
||||
|
||||
//put("rdlink", Color.KHAKI);
|
||||
}};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue