1 /*
2 * Created on Sep 13, 2004
3 *
4 */
5 package ubc.midp.mobilephoto.core.ui.screens;
6
7 import javax.microedition.lcdui.Choice;
8 import javax.microedition.lcdui.Command;
9 import javax.microedition.lcdui.Image;
10 import javax.microedition.lcdui.List;
11
12
13 /**
14 * @author trevor
15 *
16 * This screen displays a list of photo albums available to select.
17 * A user can also create a new album on this screen.
18 * TODO: Add delete photo album option
19 *
20 */
21 public class AlbumListScreen extends List {
22
23 public static final Command exitCommand = new Command("Exit", Command.STOP, 2);
24 public static final Command selectCommand = new Command("Select", Command.ITEM, 1);
25 public static final Command createAlbumCommand = new Command("New Photo Album", Command.ITEM, 1);
26 public static final Command deleteAlbumCommand = new Command("Delete Album", Command.ITEM, 1);
27 public static final Command resetCommand = new Command("Reset", Command.ITEM, 1);
28
29
30 /**
31 * Constructor
32 */
33 public AlbumListScreen() {
34 super("Select Album", Choice.IMPLICIT);
35 }
36
37
38 /**
39 * Constructor
40 * @param arg0
41 * @param arg1
42 */
43 public AlbumListScreen(String arg0, int arg1) {
44 super(arg0, arg1);
45 }
46
47 /**
48 * Constructor
49 * @param arg0
50 * @param arg1
51 * @param arg2
52 * @param arg3
53 */
54 public AlbumListScreen(String arg0, int arg1, String[] arg2, Image[] arg3) {
55 super(arg0, arg1, arg2, arg3);
56 }
57
58 /**
59 * Initialize the menu items for this screen
60 *
61 */
62 public void initMenu() {
63 this.addCommand(exitCommand);
64 this.addCommand(selectCommand);
65 this.addCommand(createAlbumCommand);
66 this.addCommand(deleteAlbumCommand);
67 this.addCommand(resetCommand);
68 }
69
70 /* (non-Javadoc)
71 * @see javax.microedition.lcdui.List#deleteAll()
72 */
73 public void deleteAll(){
74 for (int i = 0; i < this.size(); i++) {
75 this.delete(i);
76 }
77 }
78
79 /**
80 * @param names
81 */
82 public void repaintListAlbum(String[] names){
83 String[] albumNames = names;
84 this.deleteAll();
85 for (int i = 0; i < albumNames.length; i++) {
86 if (albumNames[i] != null) {
87 //Add album name to menu list
88 this.append(albumNames[i], null);
89 }
90 }
91 }
92
93 }
|