diff --git a/pom.xml b/pom.xml
index b51d9d1425..b1c2046a13 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,7 +54,7 @@
2.5.0
11.4.2
33.0.0-jre
- 2.10.4
+ 2.11.0
3.12.0
2.14.0
1.9.0
diff --git a/ugs-core/src/com/willwinder/universalgcodesender/connection/DefaultConnectionDevice.java b/ugs-core/src/com/willwinder/universalgcodesender/connection/DefaultConnectionDevice.java
index 85095e4585..95eaaec3e3 100644
--- a/ugs-core/src/com/willwinder/universalgcodesender/connection/DefaultConnectionDevice.java
+++ b/ugs-core/src/com/willwinder/universalgcodesender/connection/DefaultConnectionDevice.java
@@ -31,15 +31,17 @@ public class DefaultConnectionDevice extends AbstractConnectionDevice {
private final String address;
private final Integer port;
private final String description;
+ private final String manufacturer;
public DefaultConnectionDevice(String address) {
- this(address, null, "");
+ this(address, null, "", "");
}
- public DefaultConnectionDevice(String address, Integer port, String description) {
+ public DefaultConnectionDevice(String address, Integer port, String description, String manufacturer) {
this.address = address;
this.port = port;
this.description = description;
+ this.manufacturer = manufacturer;
}
@Override
@@ -60,6 +62,14 @@ public Optional getDescription() {
return Optional.of(description);
}
+ @Override
+ public Optional getManufacturer() {
+ if (StringUtils.isEmpty(manufacturer)) {
+ return Optional.empty();
+ }
+ return Optional.of(manufacturer);
+ }
+
@Override
public String toString() {
return super.toString();
diff --git a/ugs-core/src/com/willwinder/universalgcodesender/connection/IConnectionDevice.java b/ugs-core/src/com/willwinder/universalgcodesender/connection/IConnectionDevice.java
index 996198ecf7..1e06cfb492 100644
--- a/ugs-core/src/com/willwinder/universalgcodesender/connection/IConnectionDevice.java
+++ b/ugs-core/src/com/willwinder/universalgcodesender/connection/IConnectionDevice.java
@@ -23,9 +23,16 @@ public interface IConnectionDevice {
Optional getPort();
/**
- * Get the an optional description of the device
+ * Get the optional description of the device
*
* @return the description of the device
*/
Optional getDescription();
+
+ /**
+ * Get the manufacturer of the device
+ *
+ * @return the manufacturer
+ */
+ Optional getManufacturer();
}
diff --git a/ugs-core/src/com/willwinder/universalgcodesender/connection/JSerialCommConnectionDevice.java b/ugs-core/src/com/willwinder/universalgcodesender/connection/JSerialCommConnectionDevice.java
index 90130abfaa..cece57b2c5 100644
--- a/ugs-core/src/com/willwinder/universalgcodesender/connection/JSerialCommConnectionDevice.java
+++ b/ugs-core/src/com/willwinder/universalgcodesender/connection/JSerialCommConnectionDevice.java
@@ -53,4 +53,13 @@ public Optional getDescription() {
public Optional getPort() {
return Optional.empty();
}
+
+ @Override
+ public Optional getManufacturer() {
+ String manufacturer = serialPort.getManufacturer();
+ if (StringUtils.isEmpty(manufacturer)) {
+ return Optional.empty();
+ }
+ return Optional.of(manufacturer);
+ }
}
diff --git a/ugs-core/src/com/willwinder/universalgcodesender/connection/TCPConnection.java b/ugs-core/src/com/willwinder/universalgcodesender/connection/TCPConnection.java
index 25542dd126..07fe4f1346 100644
--- a/ugs-core/src/com/willwinder/universalgcodesender/connection/TCPConnection.java
+++ b/ugs-core/src/com/willwinder/universalgcodesender/connection/TCPConnection.java
@@ -168,7 +168,7 @@ public void run() {
@Override
public List extends IConnectionDevice> getDevices() {
return MdnsService.getInstance().getServices(MDNS_SERVICE).stream()
- .map(service -> new DefaultConnectionDevice(service.getHost(), service.getPort(), service.getName()))
+ .map(service -> new DefaultConnectionDevice(service.getHost(), service.getPort(), service.getName(), "Port " + service.getPort()))
.toList();
}
}
diff --git a/ugs-platform/ugs-platform-ugscore/src/main/java/com/willwinder/ugs/nbp/core/ui/PortCellItem.java b/ugs-platform/ugs-platform-ugscore/src/main/java/com/willwinder/ugs/nbp/core/ui/PortCellItem.java
index 21430619dc..d5198a3dd4 100644
--- a/ugs-platform/ugs-platform-ugscore/src/main/java/com/willwinder/ugs/nbp/core/ui/PortCellItem.java
+++ b/ugs-platform/ugs-platform-ugscore/src/main/java/com/willwinder/ugs/nbp/core/ui/PortCellItem.java
@@ -1,5 +1,5 @@
/*
-Copyright 2023 Will Winder
+Copyright 2023-2024 Will Winder
This file is part of Universal Gcode Sender (UGS).
@@ -19,13 +19,16 @@ This file is part of Universal Gcode Sender (UGS).
package com.willwinder.ugs.nbp.core.ui;
import com.willwinder.universalgcodesender.connection.IConnectionDevice;
+import net.miginfocom.swing.MigLayout;
+import org.openide.util.ImageUtilities;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
-import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Font;
/**
* Renders a connection device
@@ -36,41 +39,40 @@ public class PortCellItem extends JPanel {
private static final Border DEFAULT_BORDER = new EmptyBorder(5, 5, 5, 5);
PortCellItem(JList extends IConnectionDevice> list, IConnectionDevice device, boolean isSelected) {
- super(new BorderLayout());
+ super(new MigLayout());
setOpaque(true);
setBorder(DEFAULT_BORDER);
populatePortInfo(device);
setComponentOrientation(list.getComponentOrientation());
- if (isSelected) {
- setBackground(list.getSelectionBackground());
- setForeground(list.getSelectionForeground());
- } else {
- setBackground(list.getBackground());
- setForeground(list.getForeground());
+ for(Component component : getComponents()) {
+ if (isSelected) {
+ setBackground(list.getSelectionBackground());
+ component.setBackground(list.getSelectionBackground());
+ component.setForeground(list.getSelectionForeground());
+ } else {
+ setBackground(list.getBackground());
+ component.setBackground(list.getBackground());
+ component.setForeground(list.getForeground());
+ }
}
-
setEnabled(list.isEnabled());
- setFont(list.getFont());
}
private void populatePortInfo(IConnectionDevice device) {
- if (!device.getDescription().isPresent()) {
- setTitle(device.getAddress());
- } else {
- setTitleAndDescription(device);
- }
- }
+ add(new JLabel(ImageUtilities.loadImageIcon("resources/icons/device24.svg", false)), "spany");
- private void setTitle(String title) {
- JLabel addressLabel = new JLabel(title);
- add(addressLabel, BorderLayout.CENTER);
- }
+ JLabel label = new JLabel(device.getAddress());
+ Font f = label.getFont();
+ label.setFont(f.deriveFont(Font.BOLD));
+ add(label, "wrap, growx, align left");
- private void setTitleAndDescription(IConnectionDevice device) {
- setTitle(device.getDescription().orElse(device.getAddress()));
- JLabel addressLabel = new JLabel(device.getAddress());
- addressLabel.setFont(addressLabel.getFont().deriveFont(8f));
- add(addressLabel, BorderLayout.SOUTH);
+ if (device.getDescription().isPresent()) {
+ add(new JLabel(device.getDescription().orElse(device.getAddress())), "wrap, growx, align left");
+ }
+
+ if (device.getManufacturer().isPresent()) {
+ add(new JLabel(device.getManufacturer().get()) , "wrap, growx, align left");
+ }
}
-}
+}
\ No newline at end of file
diff --git a/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device.svg b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device.svg
new file mode 100644
index 0000000000..b646dc2ad5
--- /dev/null
+++ b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device.svg
@@ -0,0 +1,5 @@
+
+
+
diff --git a/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device24.svg b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device24.svg
new file mode 100644
index 0000000000..f9a5e98c14
--- /dev/null
+++ b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device24.svg
@@ -0,0 +1,5 @@
+
+
+
diff --git a/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device24_dark.svg b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device24_dark.svg
new file mode 100644
index 0000000000..a246048ba6
--- /dev/null
+++ b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device24_dark.svg
@@ -0,0 +1,5 @@
+
+
+
diff --git a/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device24_disabled_dark.svg b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device24_disabled_dark.svg
new file mode 100644
index 0000000000..2e1a5970fa
--- /dev/null
+++ b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device24_disabled_dark.svg
@@ -0,0 +1,5 @@
+
+
+
diff --git a/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device32.svg b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device32.svg
new file mode 100644
index 0000000000..f798f6cd88
--- /dev/null
+++ b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device32.svg
@@ -0,0 +1,5 @@
+
+
+
diff --git a/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device32_dark.svg b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device32_dark.svg
new file mode 100644
index 0000000000..2d96233dc7
--- /dev/null
+++ b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device32_dark.svg
@@ -0,0 +1,5 @@
+
+
+
diff --git a/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device32_disabled_dark.svg b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device32_disabled_dark.svg
new file mode 100644
index 0000000000..d9bb850009
--- /dev/null
+++ b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device32_disabled_dark.svg
@@ -0,0 +1,5 @@
+
+
+
diff --git a/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device_dark.svg b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device_dark.svg
new file mode 100644
index 0000000000..9caf902ca3
--- /dev/null
+++ b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device_dark.svg
@@ -0,0 +1,5 @@
+
+
+
diff --git a/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device_disabled_dark.svg b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device_disabled_dark.svg
new file mode 100644
index 0000000000..cfc002376a
--- /dev/null
+++ b/ugs-platform/ugs-platform-ugscore/src/main/resources/resources/icons/device_disabled_dark.svg
@@ -0,0 +1,5 @@
+
+
+