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 a91694c..3108ad8 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,8 +82,8 @@ - - + + @@ -146,6 +146,22 @@ + + + + + + + + + + + + + + + + @@ -202,6 +218,22 @@ + + + + + + + + + + + + + + + + @@ -210,7 +242,7 @@ - + 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 4d5caba..1ff3587 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 @@ -53,6 +53,10 @@ public class OverviewForm { private JLabel displayLabel; private JLabel soundCardLabel; private JLabel soundCardInfoLabel; + private JLabel powerSourceLabel; + private JLabel powerSourceInfoLabel; + private JLabel firmwareInfoLabel; + private JLabel firmwareLabel; public static OverviewForm getInstance() { if (overviewForm == null) { @@ -81,6 +85,8 @@ public class OverviewForm { Style.emphaticLabelFont(overviewForm.getDiskStorageLabel()); Style.emphaticLabelFont(overviewForm.getDisplayLabel()); Style.emphaticLabelFont(overviewForm.getSoundCardLabel()); + Style.emphaticLabelFont(overviewForm.getPowerSourceLabel()); + Style.emphaticLabelFont(overviewForm.getFirmwareLabel()); } private static void initInfo() { @@ -101,6 +107,8 @@ public class OverviewForm { overviewForm.getDiskStorageInfoLabel().setText(getDiskStorageInfo(hardware)); overviewForm.getDisplayInfoLabel().setText(getDisplayInfo(hardware)); overviewForm.getSoundCardInfoLabel().setText(getSoundCardInfo(hardware)); + overviewForm.getPowerSourceInfoLabel().setText(getPowerSourceInfo(hardware)); + overviewForm.getFirmwareInfoLabel().setText(getFirmware(hardware)); List networkIFs = hardware.getNetworkIFs(); for (NetworkIF networkIF : networkIFs) { @@ -111,15 +119,6 @@ public class OverviewForm { 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()); - } } /** @@ -263,6 +262,50 @@ public class OverviewForm { return StringUtils.join(detailList, " + "); } + /** + * PowerSourceInfo + * + * @param hardware + * @return + */ + private static String getPowerSourceInfo(HardwareAbstractionLayer hardware) { + List detailList = new ArrayList<>(); + StringBuilder detailBuilder; + List powerSources = hardware.getPowerSources(); + for (PowerSource powerSource : powerSources) { + detailBuilder = new StringBuilder(); + detailBuilder.append(powerSource.getName()); + detailBuilder.append(" ").append(powerSource.getManufacturer()); + if (!"unknown".equals(powerSource.getChemistry())) { + detailBuilder.append(" ").append(powerSource.getChemistry()); + } + detailBuilder.append(" ").append(powerSource.getMaxCapacity()).append("/").append(powerSource.getDesignCapacity()); + + detailList.add(detailBuilder.toString()); + } + + return StringUtils.join(detailList, " + "); + } + + /** + * Firmware + * + * @param hardware + * @return + */ + private static String getFirmware(HardwareAbstractionLayer hardware) { + Firmware firmware = hardware.getComputerSystem().getFirmware(); + + StringBuilder detailBuilder = new StringBuilder(); + detailBuilder.append(firmware.getManufacturer()); + detailBuilder.append(" ").append(firmware.getName()); + detailBuilder.append(" ").append(firmware.getDescription()); + detailBuilder.append(" ").append(firmware.getVersion()); + detailBuilder.append(" ").append(firmware.getReleaseDate()); + + return detailBuilder.toString(); + } + { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< @@ -308,7 +351,7 @@ public class OverviewForm { 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 JPanel panel5 = new JPanel(); - panel5.setLayout(new GridLayoutManager(7, 3, new Insets(10, 10, 10, 10), -1, -1)); + panel5.setLayout(new GridLayoutManager(9, 3, new Insets(10, 20, 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"); @@ -331,6 +374,12 @@ public class OverviewForm { 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)); + powerSourceLabel = new JLabel(); + powerSourceLabel.setText("PowerSource"); + panel5.add(powerSourceLabel, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + firmwareLabel = new JLabel(); + firmwareLabel.setText("Firmware"); + panel5.add(firmwareLabel, new GridConstraints(8, 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)); @@ -352,10 +401,16 @@ public class OverviewForm { 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)); + powerSourceInfoLabel = new JLabel(); + powerSourceInfoLabel.setText("PowerSource info"); + panel5.add(powerSourceInfoLabel, new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + firmwareInfoLabel = new JLabel(); + firmwareInfoLabel.setText("Firmware info"); + panel5.add(firmwareInfoLabel, new GridConstraints(8, 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)); + panel6.setLayout(new GridLayoutManager(1, 1, new Insets(0, 10, 0, 10), -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));