add(_view);
// Menu item to create a new meeting
final MenuItem newMeetingItem =
new MenuItem(new StringProvider("New Meeting"), 0x230010, 0);
newMeetingItem.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
final Meeting meeting = new Meeting();
_uiApp.pushScreen(new MeetingScreen(meeting, -1, true));
}
}));
viewItem = new MenuItem(new StringProvider("View"), 0x230020, 1);
viewItem.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
displayMeeting(false);
}
}));
editItem = new MenuItem(new StringProvider("Edit"), 0x230030, 2);
editItem.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
displayMeeting(true);
}
}));
deleteItem = new MenuItem(new StringProvider("Delete"), 0x230040, 3);
deleteItem.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
// Retrieve the highlighted Meeting object and remove it from
// the
// vector, then update the list field to reflect the change.
final int i = _view.getRowNumberWithFocus();
final String meetingName =
((Meeting) _uiApp.getMeetings().elementAt(i))
.getField(Meeting.MEETING_NAME);
final int result =
Dialog.ask(Dialog.DELETE, "Delete " + meetingName + "?");
if (result == Dialog.YES) {
_model.removeRowAt(i);
}
}
}));
// Menu item to gain access to the controlled object
final MenuItem retrieveItem =
new MenuItem(new StringProvider("Access controlled object"),
0x230050, 0);
retrieveItem.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,