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);
  }
Esempio n. 2
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);
  }
Esempio n. 3
0
 private List createEmptyList() {
   String title = orgTitle;
   // don't show "file:///"
   if (url.toLowerCase().startsWith("file:///")) {
     // if in root dir show original list title
     if (url.length() == 8) {
       title = orgTitle;
     } else {
       title = url.substring(8);
     }
   }
   List list = new List(title, Choice.IMPLICIT);
   list.addCommand(BACK_CMD);
   list.addCommand(OK_CMD);
   list.addCommand(UP_CMD);
   list.addCommand(ROOT_CMD);
   list.setCommandListener(this);
   list.setSelectCommand(DOWN_CMD);
   return list;
 }
Esempio n. 4
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);
  }
Esempio n. 5
0
  public void commandAction(Command c, Displayable d) {
    if (c == EXIT_CMD) {
      if (d == this) {
        parent.show();
      } else {
        show();
      }
    }
    if (c == ADD_CMD) {
      this.addTag = true;
      TextField tf = new TextField("key", "", 100, TextField.ANY);
      tf.addCommand(OK_CMD);
      tf.setItemCommandListener(this);
      this.append(tf);
      Display.getDisplay(GpsMid.getInstance()).setCurrentItem(tf);
      tf = new TextField("value", "", 100, TextField.ANY);
      tf.addCommand(OK_CMD);
      tf.setItemCommandListener(this);
      this.append(tf);
    }
    if (c == UPLOAD_CMD) {
      parent.show();
      eway.uploadXML(this);
    }

    if (c == REVERSE_CMD) {
      osmway.reverseWay();
    }

    if (c == PRESET_CMD) {
      presets = new List("Tagging Presets", List.IMPLICIT);
      presets.append("maxspeed=20 mph", null);
      presets.append("maxspeed=30 mph", null);
      presets.append("oneway=yes", null);
      presets.append("name=", null);
      presets.append("ref=", null);
      presets.append("lcn_ref=", null);
      presets.append("foot=yes", null);
      presets.append("bicycle=yes", null);
      presets.append("motorcar=yes", null);
      presets.append("access=private", null);
      presets.append("maxweight=7.5", null);
      presets.append("maxlength=18", null);
      presets.append("maxwidth=3", null);
      presets.append("maxheigt=4", null);
      presets.addCommand(OK_CMD);
      presets.addCommand(EXIT_CMD);
      presets.setCommandListener(this);
      presets.setSelectCommand(OK_CMD);
      GpsMid.getInstance().show(presets);
    }

    if (c == OK_CMD) {
      String addPreset = presets.getString(presets.getSelectedIndex());
      int split = addPreset.indexOf("=");
      osmway
          .getTags()
          .put(addPreset.substring(0, split), addPreset.substring(split + 1, addPreset.length()));
      presets = null;
      setupScreen();
      show();
    }
  }