ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/java/installer2/src/net/oni2/aeinstaller/gui/packageinfobox/PackageInfoBox.java
Revision: 840
Committed: Tue Apr 30 00:05:15 2013 UTC (12 years, 5 months ago) by alloc
Content type: text/x-java
File size: 2311 byte(s)
Log Message:
AEI2.07:
- Allow for non-ISO-8859-1 characters in properties files (more exactly require them to be UTF8)

File Contents

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