public void commandAction(Command command, Displayable displayable) {
   display.setCurrent(parentView);
   if (command == cmdSelect) {
     setString(list.getString(list.getSelectedIndex()));
   }
   if (command == cmdClear) {
     recentList.removeAllElements();
     saveRecentList();
   }
 }
Ejemplo n.º 2
1
  public void startApp() {
    // Create Record Store
    try {
      rs = RecordStore.openRecordStore("myrs", true);
    } catch (RecordStoreException e) {
    }

    dsp = Display.getDisplay(this);
    listMenu.setCommandListener(this);
    listMenu.addCommand(cmdExit);
    dsp.setCurrent(listMenu);
  }
Ejemplo n.º 3
1
  public List getL_vars() {
    if (l_vars == null) {

      l_vars =
          new List("\u041F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435", Choice.IMPLICIT);
      l_vars.addCommand(getC_canvas());
      l_vars.addCommand(getC_insert());
      l_vars.addCommand(getC_delvar());
      l_vars.setCommandListener(this);
    }
    return l_vars;
  }
Ejemplo n.º 4
1
  public List getL_history() {
    if (l_history == null) {

      l_history =
          new List(
              "\u0418\u0441\u0442\u043E\u0440\u0438\u044F \u0432\u044B\u0447\u0438\u0441\u043B\u0435\u043D\u0438\u0439",
              Choice.IMPLICIT);
      l_history.addCommand(getC_canvas());
      l_history.addCommand(getC_insert());
      l_history.setCommandListener(this);
    }
    return l_history;
  }
Ejemplo n.º 5
1
  public void commandAction(Command command, Displayable displayable) {

    if (command == back) {
      controller.MainMenu();
    }
    if (command == viewStages) {
      busNos = busNo.getString().toUpperCase();
      fetchStagesData(busNos);
    }
    if (command == backToNo) {

      controller.getDisp().setCurrent(this);
    }
    if (command == MapStages) {
      controller.pointresultCanvas.busStagesPoints.removeAllElements();
      for (int mapStages = 0; mapStages < PostionAddress.length - 1; mapStages++) {
        String pos = PostionAddress[mapStages];
        String[] point = StringUtil.split(pos, "||");
        System.out.println(point[0] + "== " + point[1]);
        controller.pointBusStages(point[0], point[1]);
      }

      String pos = PostionAddress[Stages.getSelectedIndex()];
      String[] point = StringUtil.split(pos, "||");
      controller.gotoSpot(point[0], point[1]);
      controller.ShowPointingCanvas();
    }
    if (command == backToPlaces) {

      controller.getDisp().setCurrent(Stages);
    }
    if (command == showBuses) {
      controller.showProgressBar();
      fetchBusNoData();
    }
    if (command == showStages) {
      busNos = busesNearMe.getString(busesNearMe.getSelectedIndex()).toUpperCase();
      fetchStagesData(busNos);
    }
    if (command == viewBusPosition) {

      String[] data = GetBusPosition("Tt");
      String Message = "" + data[0] + "\n" + data[1] + "\n" + data[2];
      controller.showBusPosition(Message, data[3], data[4]);
    }
  }
Ejemplo n.º 6
1
  private void LiveCameras() {
    LiveCameras = new List("Live Cameras", Choice.IMPLICIT);
    viewImage = new Command("view", Command.OK, 1);
    camList = new Command("back", Command.BACK, 2);
    refreshList = new Command("refresh List", Command.OK, 0);

    LiveCameras.addCommand(viewImage);
    LiveCameras.addCommand(camList);
    LiveCameras.addCommand(refreshList);
    LiveCameras.setCommandListener(this);

    new Thread() {
      public void run() {
        controller.showProgressBar();
      }
    }.start();
    refreshCamList();
  }
Ejemplo n.º 7
1
  public void startApp() {
    if (mDisplay == null) {
      mDisplay = Display.getDisplay(this);
    }

    if (mMenu == null) {
      mMenu = new List("MohairMIDlet", List.IMPLICIT);
      mMenu.append(kQuerySlots, null);
      mMenu.append(kSignTest, null);

      mBackCommand = new Command("Back", Command.BACK, 0);
      mExitCommand = new Command("Exit", Command.EXIT, 0);

      mMenu.addCommand(mExitCommand);
      mMenu.setCommandListener(this);
    }

    mDisplay.setCurrent(mMenu);
  }
  public void commandAction(Command command, Item item) {
    if (recentList.isEmpty()) return;
    parentView = display.getCurrent();

    cmdBack = new Command(SR.MS_BACK, Command.BACK, 99);
    cmdSelect = new Command(SR.MS_SELECT, Command.OK, 1);
    cmdClear = new Command(SR.MS_CLEAR, command.SCREEN, 2);

    list = new List(label, List.IMPLICIT);
    list.addCommand(cmdBack);
    list.addCommand(cmdClear);
    list.setSelectCommand(cmdSelect);

    for (Enumeration e = recentList.elements(); e.hasMoreElements(); )
      list.append((String) e.nextElement(), null);

    list.setCommandListener(this);
    display.setCurrent(list);
  }
Ejemplo n.º 9
0
  protected void startApp() throws MIDletStateChangeException {
    // TODO Auto-generated method stub

    // mDisplay.setCurrent(mForm);
    CCL.mDisplay.setCurrent(new HomeScreenCanvas());
    mCanvas = new HomeScreenCanvas();
    mCanvas.setTitle("Celebrity Cricket League");
    mCanvas.addCommand(home);
    mCanvas.addCommand(videos);
    mCanvas.addCommand(team);
    mCanvas.addCommand(photos);
    mCanvas.addCommand(schedule);
    mCanvas.addCommand(ownerlounge);
    mCanvas.setCommandListener(this);
    hideOpenKeypadCommand();

    mDisplay.setCurrent(mCanvas);
    // mDisplay.setCurrent(new HomeScreenCanvas());
    Pform = new Form("Photo Albums");
    Pform.addCommand(backCommand);
    Pform.setCommandListener(this);

    Vform = new Form("Video Albums");
    Vform.addCommand(backCommand);
    Vform.setCommandListener(this);

    mList.addCommand(backCommand);
    mList.setCommandListener(this);
  }
Ejemplo n.º 10
0
  private static void List(final String str, final Displayable retd) {

    final List l = new List(str, List.IMPLICIT);
    for (int i = 1; i < st.size(); i += 2) l.append((String) st.elementAt(i), null);
    l.addCommand(Interface.exit);
    //  l.addCommand(MyI.ok);
    l.setSelectCommand(Interface.ok);
    l.setCommandListener(
        new CommandListener() {
          public void commandAction(Command c, Displayable s) {
            if (c == Interface.ok) {
              if (st.size() == 1) MobNav1.display.setCurrent(retd);
              else {
                int i = l.getSelectedIndex();
                list(
                    l,
                    (String) st.elementAt((i << 1) + 1),
                    ((Location) (st.elementAt((i << 1)))).GetPoint());
                // MyCanvas.SetGP(((Location)(st.elementAt((i<<1)+1))).GetPoint());
                // MobNav1.display.setCurrent(MobNav1.gCanvas);
              }
            } else {
              MobNav1.display.setCurrent(retd);
            }
          }
        });

    MobNav1.display.setCurrent(l);
  }
Ejemplo n.º 11
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);
  }
Ejemplo n.º 12
0
 private void enterBooks() {
   booksList = new List("Books", List.IMPLICIT);
   int n = books.length;
   for (int i = 0; i < n; i++) booksList.append(books[i], null);
   booksList.addCommand(cancelCmd);
   booksList.setCommandListener(this);
   display.setCurrent(booksList);
 }
Ejemplo n.º 13
0
 private void enterGoto() {
   gotoList = new List("GoTo", List.IMPLICIT);
   int n = tocSection.length;
   for (int i = 0; i < n; i++) gotoList.append(tocLabel[i], null);
   gotoList.addCommand(cancelCmd);
   gotoList.setCommandListener(this);
   display.setCurrent(gotoList);
 }
Ejemplo n.º 14
0
 /** Constructs client GUI. */
 GUIImageClient(DemoMIDlet parent) {
   this.parent = parent;
   bt_client = new BTImageClient(this);
   mainScreen.addCommand(SCR_MAIN_BACK_CMD);
   mainScreen.addCommand(SCR_MAIN_SEARCH_CMD);
   mainScreen.setCommandListener(this);
   listScreen.addCommand(SCR_IMAGES_BACK_CMD);
   listScreen.addCommand(SCR_IMAGES_LOAD_CMD);
   listScreen.setCommandListener(this);
   imageScreen.addCommand(SCR_SHOW_BACK_CMD);
   imageScreen.setCommandListener(this);
 }
Ejemplo n.º 15
0
 public void commandAction(Command c, Displayable d) {
   if (processorThread.isAlive()) {
     logger.error(Locale.get("fsdiscover.StillBusyTryAgain") /*Still busy, try again later*/);
     return;
   }
   if (c == BACK_CMD) {
     /**
      * Need to call sl.selectedFile() before calling parent.show(), as we need to keep track of
      * state for e.g. GuiDiscover
      */
     sl.selectionCanceled();
     parent.show();
     return;
   }
   if (c == ROOT_CMD) {
     url = "file:///";
     processorThread = new Thread(this);
     processorThread.start();
     return;
   }
   if (list.getSelectedIndex() < 0) {
     logger.error(Locale.get("fsdiscover.NoElementSelected") /*No element selected*/);
     return;
   }
   if (c == OK_CMD) {
     selectEntry();
     return;
   }
   if (c == DOWN_CMD) {
     if (list.getString(list.getSelectedIndex()).equalsIgnoreCase("..")) {
       c = UP_CMD;
     } else {
       url = (String) urlList.elementAt(list.getSelectedIndex());
       processorThread = new Thread(this);
       processorThread.start();
       return;
     }
   }
   if (c == UP_CMD) {
     url = url.substring(0, url.substring(0, url.length() - 1).lastIndexOf('/') + 1);
     // #debug debug
     logger.debug("Moving up directory to :" + url);
     if (url.length() < 9) { // file:///
       url = "file:///";
     }
     processorThread = new Thread(this);
     processorThread.start();
     return;
   }
 }
Ejemplo n.º 16
0
  public void commandAction(Command command, Displayable screen) {
    try {
      if (screen.equals(mainMenuList)) {

        int position = mainMenuList.getSelectedIndex();
        String selected = mainMenuList.getString(position);

        if (selected.equals(tr.t(Translator.CATEGORIES))) {
          level = ROOT_FILE;
          showCategory(0);
        } else if (selected.equals(tr.t(Translator.OPTIONS))) {
          optionForm.fillOptions();
          display.setCurrent(optionForm);
        } else if (selected.equals(tr.t(Translator.HELP))) {
          createHelpForm();
          display.setCurrent(form);
        } else if (selected.equals(tr.t(Translator.ABOUT))) {
          createAboutForm();
          display.setCurrent(form);
        } else if (selected.equals(tr.t(Translator.EXIT))) {
          exitMIDlet();
        }

      } else if (screen.equals(list) && command.equals(List.SELECT_COMMAND)) {
        int position = list.getSelectedIndex();
        displayedCategory.lastSelectedPosition = position;

        if (position < subCategories.size()) {
          showCategory(
              ((Integer) displayedCategory.subcategories.elementAt(position)).intValue()); // level
        } else {
          int itemPosition = position - subCategories.size();
          int itemIndex = ((Integer) displayedCategory.items.elementAt(itemPosition)).intValue();
          showItem((Item) itemsIndex.elementAt(itemIndex));
        }
      } else if (command.equals(backCommand) && screen.equals(list)) {
        if (displayedCategory.parentId != PARENT_CATEGORY_MAIN_SCREEN) {
          showCategory(displayedCategory.parentId);
        } else {
          displayMain();
        }
      } else if (command.equals(backCommand) && screen.equals(form)) {
        displayMain();
      } else if (command.equals(backCommandCanvas) && screen.equals(canvas)) {
        showCategory(lastSelectedCategoryIndex);
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 17
0
 /**
  * @param userManager
  * @param backScreen
  * @param midlet
  */
 public Lists(UserAccountManager userManager, Displayable backScreen, MIDlet midlet) {
   this.userManager = userManager;
   this.midlet = midlet;
   this.backScreen = backScreen;
   //
   listUI = new List("Lists", List.IMPLICIT);
   //
   select = new Command("Select", Command.OK, 0);
   back = new Command("Back", Command.BACK, 0);
   //
   listUI.addCommand(select);
   listUI.addCommand(back);
   listUI.setCommandListener(this);
 }
Ejemplo n.º 18
0
 public void setCommandListener(CommandListener l) {
   if (l == this) {
     super.setCommandListener(l);
   } else {
     externalCommandListener = l;
   }
 }
Ejemplo n.º 19
0
 public void listTweets() {
   com.twapime.app.ui.Timeline ui =
       new com.twapime.app.ui.Timeline("Tweets of List", listUI, midlet);
   ui.show();
   //
   ListManager t = ListManager.getInstance(userManager);
   t.startGetListTweets(lists[listUI.getSelectedIndex()], null, ui);
 }
  /** Creates a new instance of DiscoFeatures */
  public DiscoFeatures(Display display, String entity, Vector features) {
    if (features.isEmpty()) return;

    list = new List(entity, List.IMPLICIT);
    for (Enumeration i = features.elements(); i.hasMoreElements(); ) {
      String feature = (String) (i.nextElement());
      list.append(feature, null);
    }

    list.addCommand(cmdBack);
    list.addCommand(cmdOk);
    parentView = display.getCurrent();
    this.display = display;

    list.setCommandListener(this);
    display.setCurrent(list);
  }
Ejemplo n.º 21
0
 public void setMessage() {
   super.deleteAll();
   for (int i = 0; i < msgs.size(); i++) {
     CallPacket p = (CallPacket) msgs.elementAt(i);
     String s = p.sender + ": " + p.msg;
     append(s, null);
   } // END: for
 } // END: setMsg
Ejemplo n.º 22
0
 private void handleGoto(Command c) {
   if (c != cancelCmd) {
     int i = gotoList.getSelectedIndex();
     curLine = tocSection[i];
     repaint();
   }
   gotoList = null;
   display.setCurrent(this);
 }
Ejemplo n.º 23
0
 private void handleBooks(Command c) {
   if (c != cancelCmd) {
     curBook = booksList.getSelectedIndex();
     state = LOADING;
     repaint();
     enqueMsg(MSG_BOOK);
   }
   booksList = null;
   display.setCurrent(this);
 }
Ejemplo n.º 24
0
  public ContactsScreen(String id, Resoursable resoursable) {
    super(id, resoursable);
    contacts = new List(getLocalizedText(LocaleUI.CONTACTS_COMMAND_TITLE), List.IMPLICIT);
    selectCommand =
        new Command(getLocalizedText(LocaleUI.CONTACTS_COMMAND_SELECT), Command.SCREEN, 0);
    updateCommand =
        new Command(getLocalizedText(LocaleUI.CONTACTS_COMMAND_UPDATE), Command.SCREEN, 1);
    backCommand = new Command(getLocalizedText(LocaleUI.CONTACTS_COMMAND_BACK), Command.BACK, 0);

    ContactsBean bean = (ContactsBean) Engine.getEngine().getBean(getId());
    if (bean == null) {
      Engine.getEngine().putBean(id, new ContactsBean());
    }
    contacts.addCommand(updateCommand);
    contacts.addCommand(backCommand);
    contacts.setCommandListener(this);
    contacts.setTicker(new Ticker(getLocalizedText(LocaleUI.CONTACTS_TICKER_TEXT)));
    //		addConsole(this.form);
  }
Ejemplo n.º 25
0
 private void doAction() {
   int index = contacts.getSelectedIndex();
   ContactsBean bean = (ContactsBean) Engine.getEngine().getBean(getId());
   Vector contacts = Engine.getEngine().getContacts();
   Contact contact = (Contact) contacts.elementAt(index);
   bean.setContacts(contact);
   //		Debug.println("Index=" + index + " " + contact.toString());
   // TODO: show SMS
   UIManager.getInstance().show(UIManager.SCREEN_SMS);
 }
Ejemplo n.º 26
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);
  }
Ejemplo n.º 27
0
 private void selectEntry() {
   url = (String) urlList.elementAt(list.getSelectedIndex());
   /**
    * Need to call sl.selectedFile() before calling parent.show(), as we need to keep track of
    * state for e.g. GuiDiscover
    */
   if (chooseType == CHOOSE_FILEONLY && url.endsWith("/")) {
     logger.info("Requested a file but got a dir: " + url);
   } else {
     sl.selectedFile(url);
     parent.show();
   }
 }
Ejemplo n.º 28
0
  /**
   * Shows the available images names.
   *
   * @returns false if no images names were found actually
   */
  boolean showImagesNames(Hashtable base) {
    Enumeration keys = base.keys();

    // no images actually
    if (!keys.hasMoreElements()) {
      informSearchError("No images names in found services");

      return false;
    }

    // prepare the list to be shown
    while (listScreen.size() != 0) {
      listScreen.delete(0);
    }

    while (keys.hasMoreElements()) {
      listScreen.append((String) keys.nextElement(), null);
    }

    Display.getDisplay(parent).setCurrent(listScreen);

    return true;
  }
Ejemplo n.º 29
0
 private void initMainMenuList() {
   mainMenuList = new List(content.title, List.IMPLICIT);
   mainMenuList.append(tr.t(Translator.CATEGORIES), null);
   mainMenuList.append(tr.t(Translator.OPTIONS), null);
   mainMenuList.append(tr.t(Translator.HELP), null);
   mainMenuList.append(tr.t(Translator.ABOUT), null);
   mainMenuList.append(tr.t(Translator.EXIT), null);
   mainMenuList.setCommandListener(this);
 }
Ejemplo n.º 30
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);
  }