Example #1
0
  public void showCategory(int selectedCategory) {
    if (selectedCategory == PARENT_CATEGORY_ROOT_FILE) {
      level = ROOT_FILE;
      selectedCategory = PARENT_CATEGORY_TOP;
    }
    if (level == ROOT_FILE) {
      setRootContent();
      displayedCategory = (Category) categoriesIndex.elementAt(0);
      level = NON_ROOT_FILE;
      lastSelectedCategoryIndex = PARENT_CATEGORY_TOP;
    } else if (level == NON_ROOT_FILE) {
      createContentObjectAndInitCategory(selectedCategory);
      level = IN_NON_ROOT_FILE;
      lastSelectedCategoryIndex = PARENT_CATEGORY_TOP;
    } else if (level == IN_NON_ROOT_FILE) {
      displayedCategory = (Category) categoriesIndex.elementAt(selectedCategory);
      lastSelectedCategoryIndex = selectedCategory;
    }
    subCategories = displayedCategory.subcategories;
    items = displayedCategory.items;

    String[] sArray = new String[subCategories.size() + items.size()];
    fillCategories(sArray);
    fillItems(sArray);
    List tmpList = showList(tr.t("CATEGORIES"), sArray);
    tmpList.setSelectedIndex(displayedCategory.lastSelectedPosition, true);

    display.setCurrent(tmpList);
  }
Example #2
0
  public void show() {
    contacts.deleteAll();
    //		contacts.removeCommand(selectCommand);

    Vector contactslist = Engine.getEngine().getContacts();
    if (contactslist.size() > 0) {
      //			contacts.addCommand(selectCommand);
      contacts.setSelectCommand(selectCommand);
    }
    for (Enumeration e = contactslist.elements(); e.hasMoreElements(); ) {
      Contact c = (Contact) e.nextElement();
      contacts.append(c.getContact(), null);
    }
    ContactsBean bean = (ContactsBean) Engine.getEngine().getBean(getId());
    if (bean.getContact() != null) {
      int index = contactslist.indexOf(bean.getContact());
      if (index > 0) {
        contacts.setSelectedIndex(index, true);
      }
    }
    getDisplay().setCurrent(contacts);
  }
Example #3
0
  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);
  }