public StudyListView() { screen = new List(MenuText.SELECT_STUDY() + " - " + title, Choice.IMPLICIT); ((List) screen).setFitPolicy(List.TEXT_WRAP_ON); screen.setCommandListener(this); if (!GeneralSettings.isMainMenu()) { screen.addCommand(DefaultCommands.cmdExit); screen.addCommand(DefaultCommands.cmdSel); screen.addCommand(DefaultCommands.cmdDownloadStudy); screen.addCommand(DefaultCommands.cmdUploadData); screen.addCommand(DefaultCommands.cmdSettings); } else { screen.addCommand(DefaultCommands.cmdSel); screen.addCommand(DefaultCommands.cmdCancel); } }
public void showStudyList(Vector studyList) { this.studyList = studyList; screen.setTitle(MenuText.SELECT_STUDY() + " - " + title); ((List) screen).deleteAll(); StudyDef study; int selectedIndex = OpenXdataConstants.NO_SELECTION; Settings settings = new Settings(OpenXdataConstants.STORAGE_NAME_EPIHANDY_SETTINGS, true); String val = settings.getSetting(OpenXdataConstants.KEY_LAST_SELECTED_STUDY); for (int i = 0; i < studyList.size(); i++) { study = (StudyDef) studyList.elementAt(i); if (selectedIndex == OpenXdataConstants.NO_SELECTION && val != null) { if (study.getId() == Byte.parseByte(val)) selectedIndex = i; } ((List) screen).append(study.getName(), null); } if (selectedIndex != OpenXdataConstants.NO_SELECTION) ((List) screen).setSelectedIndex(selectedIndex, true); display.setCurrent(screen); }