Ejemplo n.º 1
0
  public void commandAction(Command c, Displayable d) {
    if (c == startCmd) {
      form.deleteAll();
      form.removeCommand(startCmd);
      form.addCommand(byeCmd);

      Thread t =
          new Thread() {

            public void run() {
              startSession();
            }
          };
      t.start();

      //	    startSession();
      return;
    } else if (c == exitCmd) {
      destroyApp(true);
      return;
    } else if (c == byeCmd) {
      form.removeCommand(byeCmd);
      form.addCommand(restartCmd);
      sendBYE();
      return;
    } else if (c == restartCmd) {
      stopListener();
      form.removeCommand(restartCmd);
      form.addCommand(startCmd);
      form.deleteAll();
      form.append(address);
      return;
    }
  }
  private void createForm(
      final Display display, String room, String server, String nick, final String password) {
    this.display = display;
    parentView = display.getCurrent();

    Form formJoin = new Form(SR.MS_JOIN_CONFERENCE);

    roomField = new TextField(SR.MS_ROOM, room, 64, ConstMIDP.TEXTFIELD_URL);
    TextFieldCombo.setLowerCaseLatin(roomField);
    formJoin.append(roomField);

    hostField = new TextField(SR.MS_AT_HOST, server, 64, ConstMIDP.TEXTFIELD_URL);
    TextFieldCombo.setLowerCaseLatin(hostField);
    formJoin.append(hostField);

    if (nick == null) nick = sd.account.getNickName();
    nickField = new TextFieldCombo(SR.MS_NICKNAME, nick, 32, TextField.ANY, "roomnick", display);
    formJoin.append(nickField);

    passField =
        new TextField(SR.MS_PASSWORD, password, 32, TextField.ANY | ConstMIDP.TEXTFIELD_SENSITIVE);
    formJoin.append(passField);

    msgLimitField = new NumberField(SR.MS_MSG_LIMIT, 20, 0, 20);
    formJoin.append(msgLimitField);

    formJoin.addCommand(cmdJoin);
    // formJoin.addCommand(cmdBookmarks);
    formJoin.addCommand(cmdAdd);

    formJoin.addCommand(cmdCancel);
    formJoin.setCommandListener(this);
    display.setCurrent(formJoin);
  }
  /** Creates a new instance of PrivacyForm */
  public PrivacyForm(Display display, PrivacyItem item, PrivacyList plist) {
    this.display = display;
    parentView = display.getCurrent();
    this.item = item;
    targetList = plist;

    textValue = new TextField(null, item.value, 64, ConstMIDP.TEXTFIELD_URL);
    TextFieldCombo.setLowerCaseLatin(textValue);

    form.append(choiceAction);
    choiceAction.setSelectedIndex(item.action, true);

    form.append(choiseType);

    form.append(textValue);
    choiseType.setSelectedIndex(item.type, true);
    switchType();

    form.append(choiseStanzas);
    choiseStanzas.setSelectedFlags(item.stanzasSet);

    // form.append("Order: "+item.order);

    form.setItemStateListener(this);
    form.setCommandListener(this);
    form.addCommand(cmdOk);
    form.addCommand(cmdCancel);
    display.setCurrent(form);
  }
Ejemplo n.º 4
0
  public TrafficCams(Controller controller) {
    super("Traffic Status", Choice.EXCLUSIVE);

    this.controller = controller;
    traf = this;

    TrafOption = new Command("OK", Command.SCREEN, 1);
    bckMenu = new Command("back", Command.BACK, 2);

    VehicleOk = new Command("OK", Command.SCREEN, 1);
    Vehicleback = new Command("Back", Command.BACK, 2);

    this.addCommand(TrafOption);
    this.addCommand(bckMenu);
    setCommandListener(this);

    if (fmViewPng == null) {
      fmViewPng = new Form("");
      cmBack = new Command("Back", Command.BACK, 1);
      RefreshImage = new Command("refresh", Command.OK, 2);
      fmViewPng.addCommand(cmBack);
      fmViewPng.addCommand(RefreshImage);
      fmViewPng.setCommandListener(this);
    }
  }
Ejemplo n.º 5
0
  public Form getForm() {
    if (form == null) {

      form = new Form("form");
      form.addCommand(getC_tovars());
      form.addCommand(getC_history());
      form.setCommandListener(this);
    }
    return form;
  }
Ejemplo n.º 6
0
 public void addRecordForm() {
   fmAddRecord = new Form("Add Record");
   txfName = new TextField("Name", "", 10, TextField.ANY);
   txfNumber = new TextField("Number", "", 10, TextField.NUMERIC);
   fmAddRecord.append(txfName);
   fmAddRecord.append(txfNumber);
   fmAddRecord.addCommand(cmdAdd);
   fmAddRecord.addCommand(cmdMenu);
   fmAddRecord.setCommandListener(this);
   dsp.setCurrent(fmAddRecord);
 }
Ejemplo n.º 7
0
 public void startApp() {
   display = Display.getDisplay(this);
   try {
     form.append(img);
   } catch (Exception e) {
   }
   form.append(userName);
   form.append(password);
   form.addCommand(cancel);
   form.addCommand(login);
   form.setCommandListener(this);
   display.setCurrent(form);
 }
Ejemplo n.º 8
0
  public SnapperMIDlet() {
    mExitCommand = new Command("Exit", Command.EXIT, 0);
    mCameraCommand = new Command("Camera", Command.SCREEN, 0);
    mBackCommand = new Command("Back", Command.BACK, 0);
    mCaptureCommand = new Command("Capture", Command.SCREEN, 0);

    mMainForm = new Form("Snapper");
    mMainForm.addCommand(mExitCommand);
    String supports = System.getProperty("video.snapshot.encodings");
    if (supports != null && supports.length() > 0) {
      mMainForm.append("Ready to take pictures.");
      mMainForm.addCommand(mCameraCommand);
    } else mMainForm.append("Snapper cannot use this " + "device to take pictures.");
    mMainForm.setCommandListener(this);
  }
Ejemplo n.º 9
0
 /**
  * Returns an initialized instance of inputForm component.
  *
  * @return the initialized component instance
  */
 public Form getInputForm() {
   if (inputForm == null) {
     // GEN-END:|14-getter|0|14-preInit
     // write pre-init user code here
     inputForm =
         new Form(
             "Guess the number!",
             new Item[] {getStringItem(), getInputNumber()}); // GEN-BEGIN:|14-getter|1|14-postInit
     inputForm.addCommand(getOkCommand());
     inputForm.addCommand(getExitCommand());
     inputForm.setCommandListener(this); // GEN-END:|14-getter|1|14-postInit
     // write post-init user code here
   } // GEN-BEGIN:|14-getter|2|
   return inputForm;
 }
Ejemplo n.º 10
0
 public OriginatingINVITE() {
   // <i><b>Initialize MIDlet display</b></i>
   display = Display.getDisplay(this);
   // <i><b>create a Form for progess info printings</b></i>
   form = new Form("Session example");
   address = new TextField("INVITE:", "sip:[email protected]:5070", 40, TextField.LAYOUT_LEFT);
   form.append(address);
   byeCmd = new Command("Bye", Command.ITEM, 1);
   restartCmd = new Command("Restart", Command.ITEM, 1);
   startCmd = new Command("Start", Command.ITEM, 1);
   form.addCommand(startCmd);
   exitCmd = new Command("Exit", Command.EXIT, 1);
   form.addCommand(exitCmd);
   form.setCommandListener(this);
 }
Ejemplo n.º 11
0
  public void showAllRecordForm() {
    fmAllRecords = new Form("All records");
    try {
      RecordEnumeration recEnum = rs.enumerateRecords(null, null, false);
      while (recEnum.hasNextElement()) {
        try {
          // System.out.println(new String(recEnum.nextRecord()));
          String name = "Nenacetl jsem";
          int number = 0;
          try {
            byte[] record = recEnum.nextRecord();
            ByteArrayInputStream buffer = new ByteArrayInputStream(record);
            DataInputStream dis = new DataInputStream(buffer);
            name = dis.readUTF();
            number = dis.readInt();
            dis.close();
          } catch (Exception e) {
          }

          fmAllRecords.append(name + " " + String.valueOf(number) + "\n");
        } catch (Exception e) {
          System.out.println(e.getMessage());
        }

        //
      }
    } catch (Exception ex) {
      System.out.println(ex.getMessage());
    }
    fmAllRecords.addCommand(cmdMenu);
    fmAllRecords.setCommandListener(this);
    dsp.setCurrent(fmAllRecords);
  }
  public Form getAboutUs() {
    final Form f = new Form("Event counting");
    if (frmAboutUs == null) {
      f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

      final Button pushButton = new Button("Tap me!");
      final Label countLabel = new Label(" ");
      pushButton.addActionListener(
          new ActionListener() {
            private int c = 0;

            public void actionPerformed(ActionEvent ae) {
              c++;
              countLabel.setText(Integer.toString(c));
              f.layoutContainer();
              pushButton.setText("Tapped " + Integer.toString(c) + " times");
              // System.out.println(Integer.toString(c));
            }
          });
      f.addComponent(pushButton);
      f.addCommand(mBackCommand);
      f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
    }
    return f;
  }
  public Form getSupportMe() {
    if (frmSupportMe == null) {
      // ---------------------------------------------
      // Form f = ...
      frmSupportMe = new Form("Support Me");
      frmSupportMe.setLayout(new BorderLayout());

      Image bimage = null;
      try {
        bimage = Image.createImage("/images/metaLabSmall.png");
      } catch (IOException ex) {
        ex.printStackTrace();
      }

      Label bottomText = new Label(bimage);
      bottomText.setAlignment(Component.CENTER);
      bottomText.setText("Our Logo");
      bottomText.setTextPosition(Component.BOTTOM);

      Container buttonBar = new Container(new BoxLayout(BoxLayout.X_AXIS));
      buttonBar.addComponent(new Button("Add"));
      buttonBar.addComponent(new Button("Remove"));
      buttonBar.addComponent(new Button("Edit"));
      buttonBar.addComponent(new Button("Send"));
      buttonBar.addComponent(new Button("Exit"));

      frmSupportMe.addComponent(BorderLayout.CENTER, bottomText);
      frmSupportMe.addComponent(BorderLayout.SOUTH, buttonBar);
      frmSupportMe.addCommand(mBackCommand);
      frmSupportMe.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
    }
    return frmSupportMe;
  }
Ejemplo n.º 14
0
 public Form getF_welcome() {
   if (f_welcome == null) {
     f_welcome = new Form("NGCalc 2.4.3 \u00A9 Revzin", new Item[] {getImageItem()});
     f_welcome.addCommand(getC_canvas());
     f_welcome.setCommandListener(this);
   }
   return f_welcome;
 }
Ejemplo n.º 15
0
 /**
  * Returns an initialized instance of resultForm component.
  *
  * @return the initialized component instance
  */
 public Form getResultForm() {
   if (resultForm == null) {
     // GEN-END:|26-getter|0|26-preInit
     // write pre-init user code here
     resultForm =
         new Form(
             "Result",
             new Item[] {
               getResultText(), getAttemptsText()
             }); // GEN-BEGIN:|26-getter|1|26-postInit
     resultForm.addCommand(getBackCommand());
     resultForm.addCommand(getExitCommand1());
     resultForm.setCommandListener(this); // GEN-END:|26-getter|1|26-postInit
     // write post-init user code here
   } // GEN-BEGIN:|26-getter|2|
   return resultForm;
 }
Ejemplo n.º 16
0
  /** Handle incoming response here */
  public void notifyResponse(SipClientConnection scc) {
    int statusCode = 0;
    boolean received = false;
    try {
      scc.receive(0); // <i><b>fetch resent response</b></i>
      statusCode = scc.getStatusCode();
      str = new StringItem("Response: ", statusCode + " " + scc.getReasonPhrase());
      form.append(str);
      if (statusCode < 200) {
        dialog = scc.getDialog();
        form.append("Early-Dialog state: " + dialog.getState());
      }
      if (statusCode == 200) {
        String contentType = scc.getHeader("Content-Type");
        String contentLength = scc.getHeader("Content-Length");
        int length = Integer.parseInt(contentLength);
        if (contentType.equals("application/sdp")) {
          //
          // <i><b>handle SDP here</b></i>
          //
        }
        dialog = scc.getDialog(); // <i><b>save dialog info</b></i>
        form.append("Dialog state: " + dialog.getState());

        scc.initAck(); // <i><b>initialize and send ACK</b></i>
        scc.send();
        str = new StringItem("Session established: ", scc.getHeader("Call-ID"));
        form.append(str);
        scc.close();
      } else if (statusCode >= 300) {
        str = new StringItem("Session failed: ", scc.getHeader("Call-ID"));
        form.append(str);
        form.removeCommand(byeCmd);
        form.addCommand(restartCmd);
        scc.close();
      }
    } catch (IOException ioe) {
      // <i><b>handle e.g. transaction timeout here</b></i>
      str = new StringItem("No answer: ", ioe.getMessage());
      form.append(str);
      form.removeCommand(byeCmd);
      form.addCommand(restartCmd);
    }
  }
  public Form getAboutYou() {
    Form f = new Form("...placeholder ...");
    if (frmAboutYou == null) {
      f.addComponent(new Label("Choose Back to return to the home screen."));

      f.addCommand(mBackCommand);
      f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
    }
    return f;
  }
Ejemplo n.º 18
0
 /**
  * Returns an initiliazed instance of LoginForm component.
  *
  * @return the initialized component instance
  */
 public Form getLoginForm() {
   if (LoginForm == null) { // GEN-END:|14-getter|0|14-preInit
     // write pre-init user code here
     LoginForm =
         new Form(
             "Login Screen",
             new Item[] {
               getUserAgentNameTF(), getTextField()
             }); // GEN-BEGIN:|14-getter|1|14-postInit
     LoginForm.addCommand(getExitCommand());
     LoginForm.addCommand(getOkCommand());
     LoginForm.addCommand(getOfflineMode());
     LoginForm.addCommand(getCreateContainer());
     LoginForm.addCommand(getCreateAgentandJoin());
     LoginForm.setCommandListener(this); // GEN-END:|14-getter|1|14-postInit
     // write post-init user code here
   } // GEN-BEGIN:|14-getter|2|
   return LoginForm;
 }
Ejemplo n.º 19
0
 /**
  * This method returns instance for PrevNotClosedForm component and should be called instead of
  * accessing PrevNotClosedForm field directly.//GEN-BEGIN:MVDGetBegin46
  *
  * @return Instance for PrevNotClosedForm component
  */
 public Form get_PrevNotClosedForm() {
   if (PrevNotClosedForm == null) { // GEN-END:MVDGetBegin46
     // Insert pre-init code here
     PrevNotClosedForm = new Form(null, new Item[] {get_stringItem5()}); // GEN-BEGIN:MVDGetInit46
     PrevNotClosedForm.addCommand(get_okCommand2());
     PrevNotClosedForm.setCommandListener(this); // GEN-END:MVDGetInit46
     // Insert post-init code here
   } // GEN-BEGIN:MVDGetEnd46
   return PrevNotClosedForm;
 } // GEN-END:MVDGetEnd46
Ejemplo n.º 20
0
 /**
  * This method returns instance for NoBTAPIForm component and should be called instead of
  * accessing NoBTAPIForm field directly.//GEN-BEGIN:MVDGetBegin43
  *
  * @return Instance for NoBTAPIForm component
  */
 public Form get_NoBTAPIForm() {
   if (NoBTAPIForm == null) { // GEN-END:MVDGetBegin43
     // Insert pre-init code here
     NoBTAPIForm = new Form(null, new Item[] {get_stringItem8()}); // GEN-BEGIN:MVDGetInit43
     NoBTAPIForm.addCommand(get_exitCommand());
     NoBTAPIForm.setCommandListener(this); // GEN-END:MVDGetInit43
     // Insert post-init code here
   } // GEN-BEGIN:MVDGetEnd43
   return NoBTAPIForm;
 } // GEN-END:MVDGetEnd43
Ejemplo n.º 21
0
 /**
  * This method returns instance for StartFailedForm component and should be called instead of
  * accessing StartFailedForm field directly.//GEN-BEGIN:MVDGetBegin19
  *
  * @return Instance for StartFailedForm component
  */
 public Form get_StartFailedForm() {
   if (StartFailedForm == null) { // GEN-END:MVDGetBegin19
     // Insert pre-init code here
     StartFailedForm = new Form(null, new Item[] {get_stringItem3()}); // GEN-BEGIN:MVDGetInit19
     StartFailedForm.addCommand(get_okCommand2());
     StartFailedForm.setCommandListener(this); // GEN-END:MVDGetInit19
     // Insert post-init code here
   } // GEN-BEGIN:MVDGetEnd19
   return StartFailedForm;
 } // GEN-END:MVDGetEnd19
Ejemplo n.º 22
0
 /**
  * This method returns instance for helpForm component and should be called instead of accessing
  * helpForm field directly.//GEN-BEGIN:MVDGetBegin25
  *
  * @return Instance for helpForm component
  */
 public Form get_helpForm() {
   if (helpForm == null) { // GEN-END:MVDGetBegin25
     // Insert pre-init code here
     helpForm = new Form(null, new Item[] {get_stringItem4()}); // GEN-BEGIN:MVDGetInit25
     helpForm.addCommand(get_okCommand2());
     helpForm.setCommandListener(this); // GEN-END:MVDGetInit25
     // Insert post-init code here
   } // GEN-BEGIN:MVDGetEnd25
   return helpForm;
 } // GEN-END:MVDGetEnd25
Ejemplo n.º 23
0
 /**
  * This method returns instance for NoBTForm component and should be called instead of accessing
  * NoBTForm field directly.//GEN-BEGIN:MVDGetBegin11
  *
  * @return Instance for NoBTForm component
  */
 public Form get_NoBTForm() {
   if (NoBTForm == null) { // GEN-END:MVDGetBegin11
     // Insert pre-init code here
     NoBTForm = new Form(null, new Item[] {get_stringItem1()}); // GEN-BEGIN:MVDGetInit11
     NoBTForm.addCommand(get_okCommand2());
     NoBTForm.setCommandListener(this); // GEN-END:MVDGetInit11
     // Insert post-init code here
   } // GEN-BEGIN:MVDGetEnd11
   return NoBTForm;
 } // GEN-END:MVDGetEnd11
Ejemplo n.º 24
0
 /**
  * This method returns instance for BTOffForm component and should be called instead of accessing
  * BTOffForm field directly.//GEN-BEGIN:MVDGetBegin16
  *
  * @return Instance for BTOffForm component
  */
 public Form get_BTOffForm() {
   if (BTOffForm == null) { // GEN-END:MVDGetBegin16
     // Insert pre-init code here
     BTOffForm = new Form(null, new Item[] {get_stringItem2()}); // GEN-BEGIN:MVDGetInit16
     BTOffForm.addCommand(get_okCommand2());
     BTOffForm.setCommandListener(this); // GEN-END:MVDGetInit16
     // Insert post-init code here
   } // GEN-BEGIN:MVDGetEnd16
   return BTOffForm;
 } // GEN-END:MVDGetEnd16
Ejemplo n.º 25
0
 public InputText(String str) {
   Form form = new Form("請輸入" + str);
   if (page == 0) txt = new TextField(str, "", 10, TextField.ANY);
   else if (page == 2) txt = new TextField(str, "", 5, TextField.ANY);
   okCommand = new Command("確定", Command.OK, 1);
   form.append(txt);
   form.addCommand(okCommand);
   form.setCommandListener(this);
   display.setCurrent(form);
 }
Ejemplo n.º 26
0
 public void getNumberRecord() {
   fmNumbers = new Form("Number of Records");
   int number = 0;
   try {
     number = rs.getNumRecords();
   } catch (Exception e) {
   }
   fmNumbers.append("Numbers of Records: " + number);
   dsp.setCurrent(fmNumbers);
   fmNumbers.setCommandListener(this);
   fmNumbers.addCommand(cmdMenu);
 }
  public Form getToDoList() {
    Form f = new Form("To Do List");
    if (frmToDoList == null) {
      f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
      Label sLabel = new Label("To Do List appears here");
      f.addComponent(sLabel);

      f.addCommand(mBackCommand);
      f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
      f.setTransitionInAnimator(Transition3D.createCube(300, false));
      f.setTransitionOutAnimator(Transition3D.createCube(300, true));
    }
    return f;
  }
  public Form getSurveys() {
    if (frmSurveys == null) {
      frmSurveys = new Form("Surveys");
      Label sLabel = new Label("Surveys On Board");
      frmSurveys.addComponent(sLabel);

      frmSurveys.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

      RadioButton rb;
      ButtonGroup group = new ButtonGroup();

      rb = new RadioButton("Grilled chicken");
      group.add(rb);
      frmSurveys.addComponent(rb);

      rb = new RadioButton("Filet mignon");
      group.add(rb);
      frmSurveys.addComponent(rb);

      rb = new RadioButton("Mahi mahi");
      group.add(rb);
      frmSurveys.addComponent(rb);

      rb = new RadioButton("Chili");
      group.add(rb);
      frmSurveys.addComponent(rb);

      CheckBox cb;

      cb = new CheckBox("Guacamole");
      frmSurveys.addComponent(cb);

      cb = new CheckBox("Tabasco sauce");
      frmSurveys.addComponent(cb);

      cb = new CheckBox("Mango salsa");
      frmSurveys.addComponent(cb);

      cb = new CheckBox("Mayonnaise");
      frmSurveys.addComponent(cb);

      cb = new CheckBox("Whipped cream");
      frmSurveys.addComponent(cb);

      frmSurveys.addCommand(mBackCommand);
      frmSurveys.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
    }
    return frmSurveys;
  }
  public Form getCalendar() {
    Form f = new Form("Calendar");

    if (frmCalendar == null) {
      f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

      Calendar cal = new Calendar();
      f.addComponent(cal);
      f.addCommand(mBackCommand);
      f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
      f.setTransitionInAnimator(Transition3D.createCube(300, false));
      f.setTransitionOutAnimator(Transition3D.createCube(300, true));
    }
    return f;
  }
Ejemplo n.º 30
0
  public CopterForm(
      String title,
      Command cmdExit,
      CommandListener cl,
      ItemStateListener isl,
      Canvas canv,
      CopterAudioScene cas) {
    _f = new Form(title);
    _f.addCommand(cmdExit);
    _f.setItemStateListener(isl);
    _f.setCommandListener(cl);

    _c = new Command(title, Command.ITEM, 2);
    canv.addCommand(_c);
    _cas = cas;
  }