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

Last change on this file since 846 was 840, checked in by alloc, 12 years ago

AEI2.07:

  • Allow for non-ISO-8859-1 characters in properties files (more exactly require them to be UTF8)
File size: 2.3 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;
13import net.oni2.resourcebundle.UTF8ResourceBundleLoader;
14
15import org.javabuilders.BuildResult;
16import org.javabuilders.swing.SwingJavaBuilder;
17
18/**
19 * @author Christian Illy
20 */
21public 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}
Note: See TracBrowser for help on using the repository browser.