Changeset 639 for AE/installer2/src/net
- Timestamp:
- Jan 20, 2013, 6:02:07 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r638 r639 1 1 appname=AE Installer 2 2 appversion=0.9 52 appversion=0.96 -
AE/installer2/src/net/oni2/aeinstaller/backend/mods/Mod.java
r637 r639 31 31 private ECompatiblePlatform platform = null; 32 32 private String version = ""; 33 private String submitter = ""; 33 34 private String creator = ""; 34 35 private EBSLInstallType bslInstallType = EBSLInstallType.NORMAL; … … 68 69 } 69 70 version = nm.getVersion(); 71 submitter = nm.getName(); 70 72 creator = nm.getCreator(); 71 73 if (nm.getBody() != null) … … 256 258 257 259 /** 260 * @return Submitter of mod 261 */ 262 public String getSubmitter() { 263 return submitter; 264 } 265 266 /** 258 267 * @return Creator of mod 259 268 */ … … 389 398 return getPackageNumber() - o.getPackageNumber(); 390 399 } 400 391 401 } -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r638 r639 8 8 import java.awt.event.ItemListener; 9 9 import java.io.File; 10 import java.io.IOException;11 10 import java.net.URL; 12 11 import java.util.Date; … … 94 93 private JLabel lblDownloadSizeVal; 95 94 95 private JLabel lblTitleVal; 96 96 private JLabel lblSubmitterVal; 97 97 private JLabel lblCreatorVal; … … 560 560 @Override 561 561 public void modSelectionChanged(ModTable source, Mod m) { 562 lblTitleVal.setText(""); 562 563 lblSubmitterVal.setText(""); 563 564 lblCreatorVal.setText(""); … … 568 569 lblVersionNumberVal.setText(""); 569 570 if (m != null) { 570 lblSubmitterVal.setText(m.getName()); 571 lblTitleVal.setText(m.getName()); 572 lblSubmitterVal.setText(m.getSubmitter()); 571 573 lblCreatorVal.setText(m.getCreator()); 572 574 lblDescriptionVal.setText(m.getDescription()); … … 706 708 try { 707 709 Desktop.getDesktop().open(Paths.getEditionBasePath()); 708 } catch ( IOException e) {710 } catch (Exception e) { 709 711 e.printStackTrace(); 710 712 } -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.yml
r638 r639 69 69 lblDownloadSize,lblDownloadSizeVal [min] 70 70 - JPanel(name=panInfo): 71 - JLabel(name=lblTitle, text=lblTitle.text) 72 - JLabel(name=lblTitleVal) 71 73 - JLabel(name=lblSubmitter, text=lblSubmitter.text) 72 74 - JLabel(name=lblSubmitterVal) … … 86 88 - MigLayout: | 87 89 [min] [grow] 90 >lblTitle lblTitleVal [min] 88 91 >lblSubmitter lblSubmitterVal [min] 89 92 >lblCreator lblCreatorVal [min] -
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTable.java
r637 r639 2 2 3 3 import java.awt.Desktop; 4 import java.awt.Rectangle; 4 5 import java.awt.event.ActionEvent; 5 6 import java.awt.event.ActionListener; 7 import java.awt.event.KeyAdapter; 8 import java.awt.event.KeyEvent; 6 9 import java.awt.event.MouseAdapter; 7 10 import java.awt.event.MouseEvent; … … 18 21 import javax.swing.JPopupMenu; 19 22 import javax.swing.JTable; 23 import javax.swing.JViewport; 20 24 import javax.swing.ListSelectionModel; 21 25 import javax.swing.RowSorter; 22 26 import javax.swing.SortOrder; 23 27 import javax.swing.event.ListSelectionEvent; 24 import javax.swing.event.ListSelectionListener;25 28 import javax.swing.table.TableRowSorter; 26 29 … … 49 52 50 53 setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 51 getSelectionModel().addListSelectionListener( 52 new ListSelectionListener() { 53 @Override 54 public void valueChanged(ListSelectionEvent e) { 55 int viewRow = getSelectedRow(); 56 if (viewRow < 0) { 57 notifyModSelectionListeners(null); 58 } else { 59 Mod mod = (Mod) getValueAt(viewRow, -1); 60 notifyModSelectionListeners(mod); 61 } 62 } 63 }); 64 addMouseListener(new MouseAdapter() { 65 private void common(MouseEvent e) { 66 int r = rowAtPoint(e.getPoint()); 67 if (r >= 0 && r < getRowCount()) 68 setRowSelectionInterval(r, r); 69 else 70 clearSelection(); 71 72 int rowindex = getSelectedRow(); 73 if (rowindex >= 0) { 74 if (e.isPopupTrigger() 75 && e.getComponent() instanceof JTable) { 76 final Mod mod = (Mod) getValueAt(rowindex, -1); 77 78 JPopupMenu popup = new JPopupMenu(); 79 80 if (mod.isLocalAvailable()) { 81 // Open package folder item 82 JMenuItem openModFolder = new JMenuItem( 83 bundle.getString("openModFolder.text")); 84 openModFolder 85 .addActionListener(new ActionListener() { 86 @Override 87 public void actionPerformed( 88 ActionEvent arg0) { 89 try { 90 Desktop.getDesktop().open( 91 mod.getLocalPath()); 92 } catch (IOException e) { 93 e.printStackTrace(); 94 } 95 } 96 }); 97 popup.add(openModFolder); 98 } 99 100 if (mod.getUrl() != null) { 101 // Open Depot page item 102 JMenuItem openDepotPage = new JMenuItem( 103 bundle.getString("openDepotPage.text")); 104 openDepotPage 105 .addActionListener(new ActionListener() { 106 @Override 107 public void actionPerformed( 108 ActionEvent arg0) { 109 try { 110 Desktop.getDesktop().browse( 111 mod.getUrl()); 112 } catch (IOException e) { 113 e.printStackTrace(); 114 } 115 } 116 }); 117 popup.add(openDepotPage); 118 } 119 120 if (popup.getSubElements().length > 0) 121 popup.show(e.getComponent(), e.getX(), e.getY()); 122 } 123 } 124 } 125 126 @Override 127 public void mousePressed(MouseEvent e) { 128 common(e); 129 } 130 131 @Override 132 public void mouseReleased(MouseEvent e) { 133 common(e); 134 } 135 }); 54 getSelectionModel().addListSelectionListener(this); 55 addMouseListener(new MouseEventHandler()); 56 addKeyListener(new KeyEventHandler()); 136 57 // To get checkbox-cells with background of row 137 58 ((JComponent) getDefaultRenderer(Boolean.class)).setOpaque(true); … … 260 181 sorter.setRowFilter(new ModTableFilter(type, downloadState)); 261 182 } 183 184 @Override 185 public void valueChanged(ListSelectionEvent e) { 186 super.valueChanged(e); 187 int viewRow = getSelectedRow(); 188 if (viewRow < 0) { 189 notifyModSelectionListeners(null); 190 } else { 191 Mod mod = (Mod) getValueAt(viewRow, -1); 192 notifyModSelectionListeners(mod); 193 } 194 } 195 196 private class MouseEventHandler extends MouseAdapter { 197 private void mouseEventProcessing(MouseEvent e) { 198 int r = rowAtPoint(e.getPoint()); 199 if (r >= 0 && r < getRowCount()) 200 setRowSelectionInterval(r, r); 201 else 202 clearSelection(); 203 204 int rowindex = getSelectedRow(); 205 if (rowindex >= 0) { 206 if (e.isPopupTrigger() && e.getComponent() instanceof JTable) { 207 final Mod mod = (Mod) getValueAt(rowindex, -1); 208 209 JPopupMenu popup = new JPopupMenu(); 210 211 if (mod.isLocalAvailable()) { 212 // Open package folder item 213 JMenuItem openModFolder = new JMenuItem( 214 bundle.getString("openModFolder.text")); 215 openModFolder.addActionListener(new ActionListener() { 216 @Override 217 public void actionPerformed(ActionEvent arg0) { 218 try { 219 Desktop.getDesktop().open( 220 mod.getLocalPath()); 221 } catch (IOException e) { 222 e.printStackTrace(); 223 } 224 } 225 }); 226 popup.add(openModFolder); 227 } 228 229 if (mod.getUrl() != null) { 230 // Open Depot page item 231 JMenuItem openDepotPage = new JMenuItem( 232 bundle.getString("openDepotPage.text")); 233 openDepotPage.addActionListener(new ActionListener() { 234 @Override 235 public void actionPerformed(ActionEvent arg0) { 236 try { 237 Desktop.getDesktop().browse(mod.getUrl()); 238 } catch (IOException e) { 239 e.printStackTrace(); 240 } 241 } 242 }); 243 popup.add(openDepotPage); 244 } 245 246 if (popup.getSubElements().length > 0) 247 popup.show(e.getComponent(), e.getX(), e.getY()); 248 } 249 } 250 } 251 252 @Override 253 public void mousePressed(MouseEvent e) { 254 mouseEventProcessing(e); 255 } 256 257 @Override 258 public void mouseReleased(MouseEvent e) { 259 mouseEventProcessing(e); 260 } 261 } 262 263 private class KeyEventHandler extends KeyAdapter { 264 @Override 265 public void keyTyped(KeyEvent e) { 266 super.keyTyped(e); 267 268 if (e.getModifiers() == 0) { 269 String key = String.valueOf(e.getKeyChar()).toLowerCase(); 270 for (int i = 0; i < getRowCount(); i++) { 271 Mod m = (Mod) getValueAt(i, -1); 272 if (m.getName().toLowerCase().startsWith(key)) { 273 setRowSelectionInterval(i, i); 274 JViewport viewport = (JViewport) getParent(); 275 Rectangle rect = getCellRect(i, 0, 276 true); 277 Rectangle r2 = viewport.getVisibleRect(); 278 scrollRectToVisible(new Rectangle(rect.x, rect.y, 279 (int) r2.getWidth(), (int) r2.getHeight())); 280 break; 281 } 282 } 283 } 284 } 285 } 262 286 } -
AE/installer2/src/net/oni2/aeinstaller/localization/MainWin.properties
r638 r639 42 42 lblDownloadSize.text=Size of files to download: 43 43 44 lblTitle.text=Name: 44 45 lblSubmitter.text=Submitter: 45 46 lblCreator.text=Creator:
Note:
See TracChangeset
for help on using the changeset viewer.