Changeset 658 for AE/installer2/src/net/oni2/aeinstaller/gui/corepackages
- Timestamp:
- Jan 29, 2013, 1:34:16 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller/gui/corepackages
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/gui/corepackages/CorePackagesDialog.java
r655 r658 1 1 package net.oni2.aeinstaller.gui.corepackages; 2 2 3 import java.awt.Dimension;4 import java.awt.Insets;5 3 import java.awt.event.ActionEvent; 6 4 import java.awt.event.KeyEvent; 7 import java.text.SimpleDateFormat;8 import java.util.Date;9 5 import java.util.ResourceBundle; 10 import java.util.TreeSet;11 6 12 7 import javax.swing.AbstractAction; 13 import javax.swing.DefaultListModel;14 8 import javax.swing.JComponent; 15 9 import javax.swing.JDialog; 16 import javax.swing.JLabel; 17 import javax.swing.JList; 10 import javax.swing.JScrollPane; 18 11 import javax.swing.JSplitPane; 19 12 import javax.swing.KeyStroke; 20 import javax.swing.ListSelectionModel;21 import javax.swing.event.ListSelectionEvent;22 import javax.swing.event.ListSelectionListener;23 13 24 import net.oni2.aeinstaller.backend.SizeFormatter;25 14 import net.oni2.aeinstaller.backend.packages.Package; 26 import net.oni2.aeinstaller.backend.packages.PackageManager; 27 import net.oni2.aeinstaller.backend.packages.Type; 28 import net.oni2.aeinstaller.gui.HTMLLinkLabel; 15 import net.oni2.aeinstaller.gui.modtable.ModSelectionListener; 16 import net.oni2.aeinstaller.gui.modtable.ModTable; 17 import net.oni2.aeinstaller.gui.modtable.ModTable.ETableContentType; 18 import net.oni2.aeinstaller.gui.packageinfobox.PackageInfoBox; 29 19 30 20 import org.javabuilders.BuildResult; … … 34 24 * @author Christian Illy 35 25 */ 36 public class CorePackagesDialog extends JDialog implements 37 ListSelectionListener { 26 public class CorePackagesDialog extends JDialog implements ModSelectionListener { 38 27 private static final long serialVersionUID = -5444213842599816301L; 39 28 … … 46 35 private JSplitPane contents; 47 36 48 private JList lstTools; 37 private JScrollPane scrollTools; 38 private ModTable tblTools; 49 39 50 private JLabel lblTitleVal; 51 private JLabel lblCreatorVal; 52 private JLabel lblTypesVal; 53 private JLabel lblPlatformVal; 54 private JLabel lblPackageNumberVal; 55 private JLabel lblVersionNumberVal; 56 private JLabel lblLastChangeVal; 57 private HTMLLinkLabel lblDescriptionVal; 58 private JLabel lblDownloadSizeVal; 59 60 private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 40 private PackageInfoBox pkgInfo; 61 41 62 42 /** … … 64 44 */ 65 45 public CorePackagesDialog() { 66 setMinimumSize(new Dimension(getWidth() + 100, getHeight() + 100));67 68 46 AbstractAction closeAction = new AbstractAction() { 69 47 … … 81 59 getRootPane().getActionMap().put("close", closeAction); 82 60 83 contents.setDividerLocation( 200);61 contents.setDividerLocation(550); 84 62 contents.setResizeWeight(0.4); 85 63 86 lstTools.addListSelectionListener(this); 87 lstTools.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 64 tblTools = new ModTable(ETableContentType.CORE); 65 tblTools.reloadData(); 66 scrollTools.setViewportView(tblTools); 88 67 89 DefaultListModel dlm = new DefaultListModel(); 90 TreeSet<Package> tools = PackageManager.getInstance().getCoreTools(); 91 for (Package m : tools) 92 dlm.addElement(m); 93 TreeSet<Package> mods = PackageManager.getInstance().getCoreMods(); 94 for (Package m : mods) 95 dlm.addElement(m); 96 lstTools.setModel(dlm); 68 tblTools.addModSelectionListener(this); 97 69 98 70 setLocationRelativeTo(null); 99 lblDescriptionVal.setMargin(new Insets(-15, 0, 0, 0));100 71 } 101 72 102 73 @Override 103 public void valueChanged(ListSelectionEvent evt) { 104 lblTitleVal.setText(""); 105 lblCreatorVal.setText(""); 106 lblDescriptionVal.setText(""); 107 lblTypesVal.setText(""); 108 lblPlatformVal.setText(""); 109 lblPackageNumberVal.setText(""); 110 lblVersionNumberVal.setText(""); 111 lblLastChangeVal.setText(""); 112 lblDownloadSizeVal.setText(""); 113 114 if (lstTools.getSelectedValue() instanceof Package) { 115 Package m = (Package) lstTools.getSelectedValue(); 116 lblTitleVal.setText(m.getName()); 117 lblCreatorVal.setText(m.getCreator()); 118 lblDescriptionVal.setText(m.getDescription()); 119 120 String types = ""; 121 for (Type t : m.getTypes()) { 122 if (types.length() > 0) 123 types += ", "; 124 types += t.getName(); 125 } 126 lblTypesVal.setText(types); 127 lblPlatformVal.setText(m.getPlatform().toString()); 128 lblPackageNumberVal.setText(m.getPackageNumberString()); 129 lblVersionNumberVal.setText(m.getVersion()); 130 if (m.getFile() != null) 131 lblLastChangeVal.setText(sdf.format(new Date(m.getFile() 132 .getTimestamp() * 1000))); 133 lblDownloadSizeVal.setText(SizeFormatter.format(m.getZipSize(), 3)); 134 } 74 public void modSelectionChanged(ModTable source, Package mod) { 75 pkgInfo.updateInfo(mod); 135 76 } 136 77 } -
AE/installer2/src/net/oni2/aeinstaller/gui/corepackages/CorePackagesDialog.yml
r648 r658 2 2 name: frame 3 3 title: frame.title 4 size: packed4 size: 900x500 5 5 locationRelativeTo: null 6 6 defaultCloseOperation: disposeOnClose … … 10 10 - JSplitPane(name=contents, orientation=horizontalSplit, continuousLayout=true): 11 11 - JPanel(name=panTools): 12 - JScrollPane(name=scrollTools, vScrollBar=always, hScrollBar=asNeeded): 13 JList(name=lstTools) 12 - JScrollPane(name=scrollTools, vScrollBar=always, hScrollBar=never) 14 13 - MigLayout: | 15 14 [grow] 16 15 scrollTools [grow] 17 - JPanel(name=panInfo): 18 - JLabel(name=lblTitle, text=lblTitle.text) 19 - JLabel(name=lblTitleVal) 20 - JLabel(name=lblCreator, text=lblCreator.text) 21 - JLabel(name=lblCreatorVal) 22 - JLabel(name=lblTypes, text=lblTypes.text) 23 - JLabel(name=lblTypesVal) 24 - JLabel(name=lblPlatform, text=lblPlatform.text) 25 - JLabel(name=lblPlatformVal) 26 - JLabel(name=lblPackageNumber, text=lblPackageNumber.text) 27 - JLabel(name=lblPackageNumberVal) 28 - JLabel(name=lblVersionNumber, text=lblVersionNumber.text) 29 - JLabel(name=lblVersionNumberVal) 30 - JLabel(name=lblLastChange, text=lblLastChange.text) 31 - JLabel(name=lblLastChangeVal) 32 - JLabel(name=lblDescription, text=lblDescription.text) 33 - JScrollPane(name=scrollDescription, vScrollBar=always, hScrollBar=asNeeded): 34 HTMLLinkLabel(name=lblDescriptionVal) 35 - JLabel(name=lblDownloadSize, text=lblDownloadSize.text) 36 - JLabel(name=lblDownloadSizeVal) 37 - MigLayout: | 38 [min] [grow] 39 >lblTitle lblTitleVal [min] 40 >lblCreator lblCreatorVal [min] 41 >lblTypes lblTypesVal [min] 42 >lblPlatform lblPlatformVal [min] 43 >lblPackageNumber lblPackageNumberVal [min] 44 >lblVersionNumber lblVersionNumberVal [min] 45 >lblLastChange lblLastChangeVal [min] 46 >^lblDescription scrollDescription [grow] 47 >lblDownloadSize lblDownloadSizeVal [min] 16 - PackageInfoBox(name=pkgInfo) 48 17 - MigLayout: | 49 18 [grow]
Note:
See TracChangeset
for help on using the changeset viewer.