Changeset 73
- Timestamp:
- 05/26/07 02:37:54 (1 year ago)
- Files:
-
- trunk/src/main/org/lastpod/UI.java (modified) (10 diffs)
- trunk/src/main/org/lastpod/action/SubmitTracks.java (modified) (7 diffs)
- trunk/src/main/org/lastpod/action/UnselectAll.java (modified) (1 diff)
- trunk/src/main/org/lastpod/action/ViewLog.java (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/org/lastpod/UI.java
r71 r73 24 24 import org.lastpod.action.SubmitTracks; 25 25 import org.lastpod.action.UnselectAll; 26 import org.lastpod.action.ViewLog; 26 27 27 28 import org.lastpod.util.SwingUtils; … … 48 49 import javax.swing.JPanel; 49 50 import javax.swing.JProgressBar; 50 import javax.swing.JScrollPane;51 51 import javax.swing.JTextArea; 52 52 import javax.swing.JToolBar; … … 62 62 public class UI implements ChunkProgress { 63 63 private RecentPanel recentpanel; 64 private JTextArea logtextarea; 64 65 /** 66 * A status label for the submission. 67 */ 68 private JLabel submitStatus = null; 65 69 66 70 /** … … 91 95 92 96 /** 97 * The action that views the log. 98 */ 99 private final Action actionViewLog; 100 101 /** 93 102 * The action that deletes the iPod's play counts file. 94 103 */ … … 105 114 public UI(Model model) { 106 115 frame = new JFrame("LastPod"); 116 117 submitStatus = new JLabel(); 107 118 108 119 ImageIcon idleIcon = SwingUtils.createImageIcon(UI.class, "images/busyicons/idle-icon.png"); … … 123 134 actionUnselectAll = new UnselectAll(frame, model, "Unselect All", iconUnselectAll, 124 135 "Unselects All Tracks", KeyEvent.VK_A); 125 actionSubmitTracks = new SubmitTracks(this, model, statusAnimationLabel, "Submit Tracks", 126 iconSubmitTracks, "Submits the selected tracks to Last.fm", KeyEvent.VK_S); 136 actionSubmitTracks = new SubmitTracks(this, model, "Submit Tracks", iconSubmitTracks, 137 "Submits the selected tracks to Last.fm", KeyEvent.VK_S); 138 actionViewLog = new ViewLog(this, "View Log", iconOpenPreferences, 139 "Opens Preferences Editor", KeyEvent.VK_L); 127 140 actionDeletePlayCounts = new DeletePlayCounts(this, model, "Delete Play Counts", 128 141 iconDeletePlayCounts, "Removes the play counts file from the iPod.", KeyEvent.VK_D); … … 207 220 toolBar.addSeparator(); 208 221 222 button = new JButton(actionViewLog); 223 layout.setConstraints(button, c); 224 toolBar.add(button); 225 226 toolBar.addSeparator(); 227 209 228 button = new JButton(actionDeletePlayCounts); 210 229 layout.setConstraints(button, c); … … 229 248 frame.getContentPane().add(this.recentpanel); 230 249 231 c.gridy = 2;232 c.weighty = 0.5;233 this.logtextarea = new JTextArea("=====LOG=====\n");234 this.logtextarea.setLineWrap(true);235 this.logtextarea.setWrapStyleWord(true);236 this.logtextarea.setEditable(false);237 238 JScrollPane scrollpane = new JScrollPane(this.logtextarea);239 layout.setConstraints(scrollpane, c);240 frame.getContentPane().add(scrollpane);241 242 250 c.gridwidth = 1; 243 251 c.weightx = 0.0; 244 252 c.weighty = 0.0; 245 246 253 c.fill = GridBagConstraints.NONE; 254 c.anchor = GridBagConstraints.WEST; 255 c.gridx = 0; 256 c.gridy = 2; 257 c.insets = new Insets(3, 10, 4, 5); 258 layout.setConstraints(submitStatus, c); 259 frame.getContentPane().add(submitStatus); 260 247 261 c.gridx = 2; 248 c.gridy = 3;249 262 c.anchor = GridBagConstraints.LAST_LINE_END; 250 263 … … 258 271 c.gridx = 0; 259 272 c.gridy = 0; 260 c.insets = new Insets(3, 10, 4, 5);261 273 layout.setConstraints(progressBar, c); 262 274 statusBar.add(progressBar); … … 279 291 280 292 public JTextArea getLogtextarea() { 281 return this.logtextarea; 293 return ((ViewLog) actionViewLog).getLogTextArea(); 294 } 295 296 public UnselectAll getUnselectAll() { 297 return (UnselectAll) actionUnselectAll; 298 } 299 300 public JLabel getStatusAnimationLabel() { 301 return statusAnimationLabel; 302 } 303 304 public JLabel getSubmitStatus() { 305 return submitStatus; 282 306 } 283 307 trunk/src/main/org/lastpod/action/SubmitTracks.java
r71 r73 31 31 import javax.swing.Icon; 32 32 import javax.swing.ImageIcon; 33 import javax.swing.JLabel;34 33 import javax.swing.Timer; 35 34 … … 76 75 77 76 /** 78 * The label used to display the idle and busy icons.79 */80 private JLabel statusAnimationLabel;81 82 /**83 77 * This worker is used to perform the submission and is a nice threaded 84 78 * implementation. … … 95 89 * @param mnemonic The action's mnemonic. 96 90 */ 97 public SubmitTracks(UI userInterface, Model model, JLabel statusAnimationLabel, String text,98 ImageIcon icon, String desc,int mnemonic) {91 public SubmitTracks(UI userInterface, Model model, String text, ImageIcon icon, String desc, 92 int mnemonic) { 99 93 super(text, icon); 100 94 putValue(SHORT_DESCRIPTION, desc); … … 102 96 this.userInterface = userInterface; 103 97 this.model = model; 104 this.statusAnimationLabel = statusAnimationLabel;105 98 106 99 idleIcon = SwingUtils.createImageIcon(UI.class, "images/busyicons/idle-icon.png"); … … 121 114 public void actionPerformed(ActionEvent e) { 122 115 busyIconIndex = (busyIconIndex + 1) % busyIcons.length; 123 statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);116 userInterface.getStatusAnimationLabel().setIcon(busyIcons[busyIconIndex]); 124 117 } 125 118 }); … … 142 135 new SwingWorker() { 143 136 public Object construct() { 144 statusAnimationLabel.setIcon(busyIcons[0]); 137 userInterface.getSubmitStatus().setText("Transferring Data..."); 138 userInterface.getStatusAnimationLabel().setIcon(busyIcons[0]); 145 139 busyIconIndex = 0; 146 140 busyIconTimer.start(); … … 150 144 151 145 public void finished() { 146 userInterface.getSubmitStatus().setText("Done"); 152 147 busyIconTimer.stop(); 153 statusAnimationLabel.setIcon(idleIcon); 148 userInterface.getStatusAnimationLabel().setIcon(idleIcon); 149 userInterface.getUnselectAll().reset(); 154 150 setEnabled(true); 155 151 } trunk/src/main/org/lastpod/action/UnselectAll.java
r71 r73 72 72 73 73 /** 74 * Resets this button. 75 */ 76 public void reset() { 77 setSelectAllType(Boolean.FALSE); 78 putValue(NAME, "Unselect All"); 79 putValue(SHORT_DESCRIPTION, "Unselects All Tracks"); 80 } 81 82 /** 74 83 * Gets the action's select all type. 75 84 * @return The action's select all type.
