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

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

AEI2.08:

File size: 2.4 KB
RevLine 
[658]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;
[840]10import net.oni2.resourcebundle.UTF8ResourceBundleLoader;
[849]11import net.oni2.swingcomponents.HTMLLinkLabel;
[658]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
[840]22 private ResourceBundle bundle = UTF8ResourceBundleLoader
[658]23 .getBundle("net.oni2.aeinstaller.localization."
24 + getClass().getSimpleName());
25 @SuppressWarnings("unused")
26 private BuildResult result = SwingJavaBuilder.build(this, bundle);
27
[849]28 private HTMLLinkLabel lblTitleVal;
29 private HTMLLinkLabel lblCreatorVal;
30 private HTMLLinkLabel lblTypesVal;
31 private HTMLLinkLabel lblPlatformVal;
32 private HTMLLinkLabel lblPackageNumberVal;
33 private HTMLLinkLabel lblVersionNumberVal;
[658]34 private HTMLLinkLabel lblDescriptionVal;
[849]35 private HTMLLinkLabel lblDownloadSizeVal;
[658]36
37 /**
38 * Create a package info box
39 */
40 public PackageInfoBox() {
41 super();
[849]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);
[658]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) {
[849]66 lblTitleVal.setText(mod.getName());
67 lblCreatorVal.setText(mod.getCreator());
[658]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 }
[849]76 lblTypesVal.setText(types);
[658]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.