diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/CpuForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/CpuForm.java
index b1ee035..42f7d0c 100644
--- a/src/main/java/com/luoboduner/moo/info/ui/form/CpuForm.java
+++ b/src/main/java/com/luoboduner/moo/info/ui/form/CpuForm.java
@@ -17,6 +17,9 @@ import java.awt.*;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
/**
* CpuForm
@@ -58,10 +61,9 @@ public class CpuForm {
initUi();
initCpuInfo();
- Timer timer = new Timer(UiConsts.REFRESH_FAST, e -> {
- initInfo();
- });
- timer.start();
+ ScheduledExecutorService serviceStartPerSecond = Executors.newSingleThreadScheduledExecutor();
+ serviceStartPerSecond.scheduleAtFixedRate(CpuForm::initInfo, 0, 1, TimeUnit.SECONDS);
+
}
private static void initUi() {
diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/MemoryForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/MemoryForm.java
index 0d13e21..889d1f2 100644
--- a/src/main/java/com/luoboduner/moo/info/ui/form/MemoryForm.java
+++ b/src/main/java/com/luoboduner/moo/info/ui/form/MemoryForm.java
@@ -17,6 +17,9 @@ import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.util.List;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
/**
* MemoryForm
@@ -61,10 +64,10 @@ public class MemoryForm {
initUi();
initPhysicalMemoryInfo();
- Timer timer = new Timer(UiConsts.REFRESH_FAST, e -> {
- initMemoryProgressInfo();
- });
- timer.start();
+
+ ScheduledExecutorService serviceStartPerSecond = Executors.newSingleThreadScheduledExecutor();
+ serviceStartPerSecond.scheduleAtFixedRate(MemoryForm::initMemoryProgressInfo, 0, 1, TimeUnit.SECONDS);
+
}
private static void initPhysicalMemoryInfo() {
diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/NetworkForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/NetworkForm.java
index 1a3109c..e91c282 100644
--- a/src/main/java/com/luoboduner/moo/info/ui/form/NetworkForm.java
+++ b/src/main/java/com/luoboduner/moo/info/ui/form/NetworkForm.java
@@ -26,6 +26,9 @@ import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.List;
import java.util.*;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
/**
* NetworkForm
@@ -79,10 +82,8 @@ public class NetworkForm {
initParameters();
initInterfaces();
- Timer timer = new Timer(UiConsts.REFRESH_FAST, e -> {
- initNetworkSpeed();
- });
- timer.start();
+ ScheduledExecutorService serviceStartPerSecond = Executors.newSingleThreadScheduledExecutor();
+ serviceStartPerSecond.scheduleAtFixedRate(NetworkForm::initNetworkSpeed, 0, 1, TimeUnit.SECONDS);
}
private static void initInterfaces() {
diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.form b/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.form
index b8f85f6..e366148 100644
--- a/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.form
+++ b/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.form
@@ -88,7 +88,7 @@
-
+
@@ -136,6 +136,14 @@
+
+
+
+
+
+
+
+
@@ -176,6 +184,14 @@
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.java
index 80072e7..a5ad294 100644
--- a/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.java
+++ b/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.java
@@ -49,6 +49,8 @@ public class OverviewForm {
private JLabel baseBoardInfoLabel;
private JLabel diskStorageLabel;
private JLabel diskStorageInfoLabel;
+ private JLabel displayInfoLabel;
+ private JLabel displayLabel;
public static OverviewForm getInstance() {
if (overviewForm == null) {
@@ -75,6 +77,7 @@ public class OverviewForm {
Style.emphaticLabelFont(overviewForm.getGraphicsCardLabel());
Style.emphaticLabelFont(overviewForm.getBaseBoardLabel());
Style.emphaticLabelFont(overviewForm.getDiskStorageLabel());
+ Style.emphaticLabelFont(overviewForm.getDisplayLabel());
}
private static void initInfo() {
@@ -93,27 +96,9 @@ public class OverviewForm {
overviewForm.getGraphicsCardInfo().setText(getGraphicsCardInfo(hardware));
overviewForm.getBaseBoardInfoLabel().setText(getBaseBoardInfo(hardware.getComputerSystem().getBaseboard()));
overviewForm.getDiskStorageInfoLabel().setText(getDiskStorageInfo(hardware));
+ overviewForm.getDisplayInfoLabel().setText(getDisplayInfo(hardware));
- List displays = hardware.getDisplays();
- for (Display display : displays) {
- byte[] edid = display.getEdid();
- byte[][] desc = EdidUtil.getDescriptors(edid);
- Map infoMap = Maps.newHashMap();
- for (byte[] b : desc) {
- int descriptorType = EdidUtil.getDescriptorType(b);
- if (descriptorType == 0xff || descriptorType == 0xfe || descriptorType == 0xfd || descriptorType == 0xfb || descriptorType == 0xfa) {
- } else if (descriptorType == 0xfc) {
- infoMap.put("name", EdidUtil.getDescriptorText(b));
- } else {
- if (EdidUtil.getDescriptorType(b) > 0x0f || EdidUtil.getDescriptorType(b) < 0x00) {
- infoMap.put("size", EdidUtil.getTimingDescriptor(b));
- }
- }
- }
- System.err.println(infoMap);
-
- }
}
/**
@@ -200,6 +185,44 @@ public class OverviewForm {
return StringUtils.join(detailList, " + ");
}
+ /**
+ * Display Info
+ *
+ * @param hardware
+ * @return
+ */
+ private static String getDisplayInfo(HardwareAbstractionLayer hardware) {
+ List detailList = new ArrayList<>();
+ StringBuilder detailBuilder;
+
+ List displays = hardware.getDisplays();
+ for (Display display : displays) {
+ detailBuilder = new StringBuilder();
+ byte[] edid = display.getEdid();
+ byte[][] desc = EdidUtil.getDescriptors(edid);
+ Map infoMap = Maps.newHashMap();
+ for (byte[] b : desc) {
+ int descriptorType = EdidUtil.getDescriptorType(b);
+ if (descriptorType == 0xff || descriptorType == 0xfe || descriptorType == 0xfd || descriptorType == 0xfb || descriptorType == 0xfa) {
+ } else if (descriptorType == 0xfc) {
+ infoMap.put("name", EdidUtil.getDescriptorText(b));
+ } else {
+ if (EdidUtil.getDescriptorType(b) > 0x0f || EdidUtil.getDescriptorType(b) < 0x00) {
+ infoMap.put("size", EdidUtil.getTimingDescriptor(b));
+ }
+ }
+ }
+
+ detailBuilder.append(infoMap.get("name"));
+ detailBuilder.append(" ").append(infoMap.get("size"));
+
+ detailList.add(detailBuilder.toString());
+
+ }
+
+ return StringUtils.join(detailList, " + ");
+ }
+
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
@@ -247,7 +270,7 @@ public class OverviewForm {
final JSeparator separator1 = new JSeparator();
panel1.add(separator1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final JPanel panel5 = new JPanel();
- panel5.setLayout(new GridLayoutManager(5, 3, new Insets(10, 10, 10, 10), -1, -1));
+ panel5.setLayout(new GridLayoutManager(6, 3, new Insets(10, 10, 10, 10), -1, -1));
panel1.add(panel5, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
cpuLabel = new JLabel();
cpuLabel.setText("CPU");
@@ -264,6 +287,9 @@ public class OverviewForm {
diskStorageLabel = new JLabel();
diskStorageLabel.setText("DiskStorage");
panel5.add(diskStorageLabel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ displayLabel = new JLabel();
+ displayLabel.setText("Display");
+ panel5.add(displayLabel, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cpuInfo = new JLabel();
cpuInfo.setText("CPU info");
panel5.add(cpuInfo, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
@@ -279,6 +305,9 @@ public class OverviewForm {
diskStorageInfoLabel = new JLabel();
diskStorageInfoLabel.setText("DiskStorage info");
panel5.add(diskStorageInfoLabel, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ displayInfoLabel = new JLabel();
+ displayInfoLabel.setText("Display info");
+ panel5.add(displayInfoLabel, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer4 = new Spacer();
panel5.add(spacer4, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
}