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

Last change on this file since 853 was 849, checked in by alloc, 12 years ago

AEI2.08:

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