Changeset 25


Ignore:
Timestamp:
07/27/07 18:45:48 (6 years ago)
Author:
saua
Message:
  • add (boring and wrong) icon
  • don't silently fail when nothing is selected
  • return to tracks form when exporting tracks
File:
1 edited

Legend:

Unmodified
Added
Removed
  • bbtracker/trunk/src/org/bbtracker/mobile/gui/TracksForm.java

    r17 r25  
    1212import javax.microedition.lcdui.CommandListener; 
    1313import javax.microedition.lcdui.Displayable; 
     14import javax.microedition.lcdui.Image; 
    1415import javax.microedition.lcdui.List; 
    1516import javax.microedition.rms.RecordStoreException; 
     
    1718import org.bbtracker.Track; 
    1819import org.bbtracker.mobile.BBTracker; 
     20import org.bbtracker.mobile.IconManager; 
    1921import org.bbtracker.mobile.Preferences; 
    2022import org.bbtracker.mobile.TrackManager; 
     
    6365        private void loadNames() throws RecordStoreException { 
    6466                deleteAll(); 
     67                final Image icon = IconManager.getInstance().getListImage("track"); 
    6568                final TrackStore store = TrackStore.getInstance(); 
    6669                final String[] trackNames = store.getTrackNames(); 
    6770                for (int i = 0; i < trackNames.length; i++) { 
    68                         append(trackNames[i], null); 
     71                        append(trackNames[i], icon); 
    6972                } 
    7073        } 
    7174 
    7275        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) { 
    7485                        try { 
    75                                 TrackStore.getInstance().deleteTrack(getSelectedIndex()); 
     86                                TrackStore.getInstance().deleteTrack(index); 
    7687                                loadNames(); 
    7788                        } catch (final RecordStoreException e) { 
     
    8091                        } 
    8192                        return; 
    82                 } else if (command == cancelCommand) { 
    83                         BBTracker.getInstance().showMainCanvas(); 
    8493                } else { 
    8594                        final Track track; 
    8695                        try { 
    87                                 track = TrackStore.getInstance().getTrack(getSelectedIndex()); 
     96                                track = TrackStore.getInstance().getTrack(index); 
    8897                        } catch (final RecordStoreException e) { 
    8998                                BBTracker.nonFatal(e, "loading track", this); 
Note: See TracChangeset for help on using the changeset viewer.