source: java/installer2/src/net/oni2/aeinstaller/gui/corepackages/CorePackagesDialog.java

Last change on this file 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.7 KB
Line 
1package net.oni2.aeinstaller.gui.corepackages;
2
3import java.awt.event.ActionEvent;
4import java.awt.event.KeyEvent;
5import java.util.ResourceBundle;
6
7import javax.swing.AbstractAction;
8import javax.swing.JComponent;
9import javax.swing.JDialog;
10import javax.swing.JScrollPane;
11import javax.swing.JSplitPane;
12import javax.swing.KeyStroke;
13
14import net.oni2.SettingsManager;
15import net.oni2.aeinstaller.backend.packages.Package;
16import net.oni2.aeinstaller.gui.modtable.ModSelectionListener;
17import net.oni2.aeinstaller.gui.modtable.ModTable;
18import net.oni2.aeinstaller.gui.modtable.ModTable.ETableContentType;
19import net.oni2.aeinstaller.gui.packageinfobox.PackageInfoBox;
20import net.oni2.resourcebundle.UTF8ResourceBundleLoader;
21
22import org.javabuilders.BuildResult;
23import org.javabuilders.swing.SwingJavaBuilder;
24
25/**
26 * @author Christian Illy
27 */
28public class CorePackagesDialog extends JDialog implements ModSelectionListener {
29 private static final long serialVersionUID = -5444213842599816301L;
30
31 private ResourceBundle bundle = UTF8ResourceBundleLoader
32 .getBundle("net.oni2.aeinstaller.localization."
33 + getClass().getSimpleName());
34 @SuppressWarnings("unused")
35 private BuildResult result = SwingJavaBuilder.build(this, bundle);
36
37 private JSplitPane contents;
38
39 private JScrollPane scrollTools;
40 private ModTable tblTools;
41
42 private PackageInfoBox pkgInfo;
43
44 /**
45 * Open the dialog
46 */
47 public CorePackagesDialog() {
48 AbstractAction closeAction = new AbstractAction() {
49
50 private static final long serialVersionUID = 1L;
51
52 public void actionPerformed(ActionEvent arg0) {
53 dispose();
54 }
55 };
56 KeyStroke ksCtrlW = KeyStroke
57 .getKeyStroke('W', KeyEvent.CTRL_DOWN_MASK);
58 getRootPane()
59 .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
60 .put(ksCtrlW, "close");
61 getRootPane().getActionMap().put("close", closeAction);
62
63 contents.setDividerLocation(SettingsManager.getInstance().get(
64 "win_core_divloc", 550));
65 contents.setResizeWeight(0.4);
66
67 tblTools = new ModTable(ETableContentType.CORE);
68 tblTools.reloadData();
69 scrollTools.setViewportView(tblTools);
70
71 tblTools.addModSelectionListener(this);
72
73 setSize(SettingsManager.getInstance().get("win_core_width", 950),
74 SettingsManager.getInstance().get("win_core_height", 600));
75 setLocationRelativeTo(null);
76 }
77
78 @Override
79 public void modSelectionChanged(ModTable source, Package mod) {
80 pkgInfo.updateInfo(mod);
81 }
82
83 @SuppressWarnings("unused")
84 private void closing() {
85 SettingsManager.getInstance().put("win_core_divloc",
86 contents.getDividerLocation());
87 SettingsManager.getInstance().put("win_core_width", getWidth());
88 SettingsManager.getInstance().put("win_core_height", getHeight());
89 }
90}
Note: See TracBrowser for help on using the repository browser.