Changeset 25
- Timestamp:
- 07/27/07 18:45:48 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
bbtracker/trunk/src/org/bbtracker/mobile/gui/TracksForm.java
r17 r25 12 12 import javax.microedition.lcdui.CommandListener; 13 13 import javax.microedition.lcdui.Displayable; 14 import javax.microedition.lcdui.Image; 14 15 import javax.microedition.lcdui.List; 15 16 import javax.microedition.rms.RecordStoreException; … … 17 18 import org.bbtracker.Track; 18 19 import org.bbtracker.mobile.BBTracker; 20 import org.bbtracker.mobile.IconManager; 19 21 import org.bbtracker.mobile.Preferences; 20 22 import org.bbtracker.mobile.TrackManager; … … 63 65 private void loadNames() throws RecordStoreException { 64 66 deleteAll(); 67 final Image icon = IconManager.getInstance().getListImage("track"); 65 68 final TrackStore store = TrackStore.getInstance(); 66 69 final String[] trackNames = store.getTrackNames(); 67 70 for (int i = 0; i < trackNames.length; i++) { 68 append(trackNames[i], null);71 append(trackNames[i], icon); 69 72 } 70 73 } 71 74 72 75 public void commandAction(final Command command, final Displayable displayable) { 73 if (command == deleteCommand) { 76 if (command == cancelCommand) { 77 BBTracker.getInstance().showMainCanvas(); 78 return; 79 } 80 final int index = getSelectedIndex(); 81 if (index == -1) { 82 BBTracker.alert(new Alert("No Track selected", "A track has to be selected for this action", null, 83 AlertType.INFO), this); 84 } else if (command == deleteCommand) { 74 85 try { 75 TrackStore.getInstance().deleteTrack( getSelectedIndex());86 TrackStore.getInstance().deleteTrack(index); 76 87 loadNames(); 77 88 } catch (final RecordStoreException e) { … … 80 91 } 81 92 return; 82 } else if (command == cancelCommand) {83 BBTracker.getInstance().showMainCanvas();84 93 } else { 85 94 final Track track; 86 95 try { 87 track = TrackStore.getInstance().getTrack( getSelectedIndex());96 track = TrackStore.getInstance().getTrack(index); 88 97 } catch (final RecordStoreException e) { 89 98 BBTracker.nonFatal(e, "loading track", this);
Note: See TracChangeset
for help on using the changeset viewer.