source: AE/installer2/src/net/oni2/aeinstaller/gui/packageinfobox/PackageInfoBox.java@ 707

Last change on this file since 707 was 658, checked in by alloc, 12 years ago

AEI2 0.99i:

  • Lots of refactorings for the GUI:
    • Global type for the mod info box (Main, Tools, Core)
    • Same table for Main, Tools, Core
File size: 2.1 KB
Line 
1package net.oni2.aeinstaller.gui.packageinfobox;
2
3import java.awt.Insets;
4import java.util.ResourceBundle;
5
6import javax.swing.JLabel;
7import javax.swing.JPanel;
8
9import net.oni2.aeinstaller.backend.SizeFormatter;
10import net.oni2.aeinstaller.backend.packages.Package;
11import net.oni2.aeinstaller.backend.packages.Type;
12import net.oni2.aeinstaller.gui.HTMLLinkLabel;
13
14import org.javabuilders.BuildResult;
15import org.javabuilders.swing.SwingJavaBuilder;
16
17/**
18 * @author Christian Illy
19 */
20public class PackageInfoBox extends JPanel {
21 private static final long serialVersionUID = 233098603653577693L;
22
23 private ResourceBundle bundle = ResourceBundle
24 .getBundle("net.oni2.aeinstaller.localization."
25 + getClass().getSimpleName());
26 @SuppressWarnings("unused")
27 private BuildResult result = SwingJavaBuilder.build(this, bundle);
28
29 private JLabel lblTitleVal;
30 private JLabel lblCreatorVal;
31 private JLabel lblTypesVal;
32 private JLabel lblPlatformVal;
33 private JLabel lblPackageNumberVal;
34 private JLabel lblVersionNumberVal;
35 private HTMLLinkLabel lblDescriptionVal;
36 private JLabel lblDownloadSizeVal;
37
38 /**
39 * Create a package info box
40 */
41 public PackageInfoBox() {
42 super();
43 lblDescriptionVal.setMargin(new Insets(-15, 0, 0, 0));
44 }
45
46 /**
47 * @param mod
48 * Mod info to show
49 */
50 public void updateInfo(Package mod) {
51 lblTitleVal.setText("");
52 lblCreatorVal.setText("");
53 lblDescriptionVal.setText("");
54 lblTypesVal.setText("");
55 lblPlatformVal.setText("");
56 lblPackageNumberVal.setText("");
57 lblVersionNumberVal.setText("");
58 lblDownloadSizeVal.setText("");
59
60 if (mod != null) {
61 lblTitleVal.setText(mod.getName());
62 lblCreatorVal.setText(mod.getCreator());
63 lblDescriptionVal.setText(mod.getDescription());
64
65 String types = "";
66 for (Type t : mod.getTypes()) {
67 if (types.length() > 0)
68 types += ", ";
69 types += t.getName();
70 }
71 lblTypesVal.setText(types);
72 lblPlatformVal.setText(mod.getPlatform().toString());
73 lblPackageNumberVal.setText(mod.getPackageNumberString());
74 lblVersionNumberVal.setText(mod.getVersion());
75 lblDownloadSizeVal
76 .setText(SizeFormatter.format(mod.getZipSize(), 3));
77 }
78 }
79}
Note: See TracBrowser for help on using the repository browser.