From 5ced53273cc4b20f9ee3b78ce3d90cdb9069751f Mon Sep 17 00:00:00 2001 From: rememberber Date: Sun, 21 Nov 2021 14:49:11 +0800 Subject: [PATCH] overview form --- .../moo/info/ui/form/OverviewForm.form | 40 +++++++++++--- .../moo/info/ui/form/OverviewForm.java | 55 ++++++++++++++++++- 2 files changed, 85 insertions(+), 10 deletions(-) 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 e366148..a91694c 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 @@ -82,13 +82,7 @@ - - - - - - - + @@ -144,6 +138,14 @@ + + + + + + + + @@ -192,6 +194,14 @@ + + + + + + + + @@ -199,6 +209,22 @@ + + + + + + + + + + + + + + + + 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 a5ad294..4d5caba 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 @@ -51,6 +51,8 @@ public class OverviewForm { private JLabel diskStorageInfoLabel; private JLabel displayInfoLabel; private JLabel displayLabel; + private JLabel soundCardLabel; + private JLabel soundCardInfoLabel; public static OverviewForm getInstance() { if (overviewForm == null) { @@ -78,6 +80,7 @@ public class OverviewForm { Style.emphaticLabelFont(overviewForm.getBaseBoardLabel()); Style.emphaticLabelFont(overviewForm.getDiskStorageLabel()); Style.emphaticLabelFont(overviewForm.getDisplayLabel()); + Style.emphaticLabelFont(overviewForm.getSoundCardLabel()); } private static void initInfo() { @@ -97,8 +100,26 @@ public class OverviewForm { overviewForm.getBaseBoardInfoLabel().setText(getBaseBoardInfo(hardware.getComputerSystem().getBaseboard())); overviewForm.getDiskStorageInfoLabel().setText(getDiskStorageInfo(hardware)); overviewForm.getDisplayInfoLabel().setText(getDisplayInfo(hardware)); + overviewForm.getSoundCardInfoLabel().setText(getSoundCardInfo(hardware)); + List networkIFs = hardware.getNetworkIFs(); + for (NetworkIF networkIF : networkIFs) { + System.err.println(networkIF.toString()); + System.err.println(networkIF.getName()); + } + Firmware firmware = hardware.getComputerSystem().getFirmware(); + System.err.println(firmware.toString()); + + List soundCards = hardware.getSoundCards(); + for (SoundCard soundCard : soundCards) { + System.err.println(soundCard.toString()); + } + + List powerSources = hardware.getPowerSources(); + for (PowerSource powerSource : powerSources) { + System.err.println(powerSource.toString()); + } } /** @@ -223,6 +244,25 @@ public class OverviewForm { return StringUtils.join(detailList, " + "); } + /** + * @param hardware + * @return + */ + private static String getSoundCardInfo(HardwareAbstractionLayer hardware) { + List detailList = new ArrayList<>(); + StringBuilder detailBuilder; + List soundCards = hardware.getSoundCards(); + for (SoundCard soundCard : soundCards) { + detailBuilder = new StringBuilder(); + detailBuilder.append(soundCard.getName()); + detailBuilder.append(" ").append(soundCard.getCodec()); + + detailList.add(detailBuilder.toString()); + } + + return StringUtils.join(detailList, " + "); + } + { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< @@ -267,10 +307,8 @@ public class OverviewForm { panel4.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final Spacer spacer3 = new Spacer(); panel1.add(spacer3, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - 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(6, 3, new Insets(10, 10, 10, 10), -1, -1)); + panel5.setLayout(new GridLayoutManager(7, 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"); @@ -290,6 +328,9 @@ public class OverviewForm { 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)); + soundCardLabel = new JLabel(); + soundCardLabel.setText("SoundCard"); + panel5.add(soundCardLabel, new GridConstraints(6, 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)); @@ -308,8 +349,16 @@ public class OverviewForm { 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)); + soundCardInfoLabel = new JLabel(); + soundCardInfoLabel.setText("SoundCard info"); + panel5.add(soundCardInfoLabel, new GridConstraints(6, 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)); + final JPanel panel6 = new JPanel(); + panel6.setLayout(new GridLayoutManager(1, 1, new Insets(0, 10, 0, 0), -1, -1)); + panel1.add(panel6, 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 JSeparator separator1 = new JSeparator(); + panel6.add(separator1, new GridConstraints(0, 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)); } /**