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;
  }
Exemplo n.º 2
0
  public NewGuideView(TouristMidlet midlet) {
    super(midlet);
    setTitle("Buy guide");
    setLayout(new BorderLayout());
    getStyle().setBgColor(Visual.BACKGROUND_COLOR);

    loadingForm = new Form("Buy guide");
    loadingForm.setLayout(new BorderLayout());
    loadingComp = new LoadingComponent(this);
    loadingForm.addComponent(BorderLayout.CENTER, loadingComp);

    /* See the flow of In-App Purchasing at:
     * http://www.developer.nokia.com/Resources/Library/Java/#!developers-guides/in-app-purchase.html */
    try {
      manager = IAPClientPaymentManager.getIAPClientPaymentManager();
      IAPClientPaymentManager.setIAPClientPaymentListener(this);
    } catch (Exception e) {
      Util.showAlert(e.getClass().getName(), "Could not initialize In-App Purchase manager");
    }

    newGuideList = new NewGuideList(this);
    addComponent(BorderLayout.CENTER, newGuideList);

    loginButton = new Button("Login to see past purchases");
    loginButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            loadAccountAndGuides();
          }
        });
    addCommands();

    revalidate();
  }
Exemplo n.º 3
0
  public MainMidlet() {
    // constructor: where all the variables initialisations are made
    // for Form 1
    box = new BoxLayout(BoxLayout.Y_AXIS);
    form1 = new Form(formLbl);
    form1.setLayout(box);
    text1 = new TextField("", TextField.NUMERIC);
    text2 = new TextField("", TextField.NUMERIC);
    text3 = new TextField("", TextField.NUMERIC);
    labl1 = new Label(lbl1);
    labl2 = new Label(lbl2);
    // contain = new Container();
    // contain.addComponent(labl1,text1);
    labl3 = new Label("");
    cmd1 = new com.sun.lwuit.Command(cmd1String);
    cmd2 = new com.sun.lwuit.Command(cmd2String);

    // ===========================
    form1.addComponent(labl1);
    form1.addComponent(text1);
    form1.addComponent(labl2);
    form1.addComponent(text2);
    form1.addCommand(cmd1);
    form1.addCommand(cmd2);
    // form1.addCommandListener(this);

  }
  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;
  }
Exemplo n.º 5
0
 public static int getScreenHeight(Form form) {
   int displayHeight = Display.getInstance().getDisplayHeight();
   displayHeight =
       displayHeight - form.getTitleComponent().getPreferredH() - form.getSoftButtonCount();
   if (form.getSoftButtonCount() >= 1) {
     displayHeight = displayHeight - form.getSoftButton(0).getParent().getPreferredH();
   }
   return displayHeight;
 }
  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;
  }
Exemplo n.º 7
0
 private void addCommands() {
   Command backCommand =
       new Command("Back") {
         public void actionPerformed(ActionEvent ev) {
           NewGuideView.this.midlet.showGuideView();
         }
       };
   setBackCommand(backCommand);
   addCommand(backCommand);
   loadingForm.setBackCommand(backCommand);
   loadingForm.addCommand(backCommand);
 }
 public void actionPerformed(ActionEvent evt) {
   Command cmd = evt.getCommand();
   switch (cmd.getId()) {
     case EXIT_COMMAND:
       exitMIDlet();
       break;
     case NEXT_COMMAND:
       if (pageFlowIndex < (PAGES.length - 3)) {
         pageFlowIndex += 1;
         previous = PAGES[pageFlowIndex].run(new Command[] {backCommand, nextCommand}, this);
       } else if (pageFlowIndex == (PAGES.length - 3)) {
         pageFlowIndex += 1;
         previous =
             PAGES[pageFlowIndex].run(
                 new Command[] {backCommand, settingsCommand, sendCommand}, this);
       }
       break;
     case BACK_COMMAND:
       if (Display.getInstance().getCurrent().getTitle().equals("Settings")) {
         previous.show();
       } else if (pageFlowIndex > 1) {
         pageFlowIndex -= 1;
         previous = PAGES[pageFlowIndex].run(new Command[] {backCommand, nextCommand}, this);
       } else if (pageFlowIndex == 1) {
         pageFlowIndex -= 1;
         previous = PAGES[pageFlowIndex].run(new Command[] {exitCommand, settingsCommand}, this);
       }
       break;
     case SETTINGS_COMMAND:
       showSettingsPage();
       break;
     case SAVE_COMMAND:
       break;
   }
 }
  protected boolean onPersonalinfoDone() {
    TextField t = (TextField) findByName("thispass", perosnl);
    TextField t2 = (TextField) findByName("nowpass", perosnl);
    TextField l = (TextField) findByName("path11", perosnl);
    int indecate = 0;
    Label l2 = (Label) findByName("Label32", perosnl);

    if (!t2.getText().equals("")) {

      if (t.getText().equals(password.getText())) {
        checkpass = t2.getText();
      } else {

        l2.setText("error password miss match");
        indecate = 1;
      }
    }
    if (l.getText() != null) {
      imgpath = l.getText();
    }
    if (indecate == 0) {
      Myprofile.show();
      // showForm("MyProfile", null);
    }

    boolean val = super.onPersonalinfoDone();
    return val;
  }
  public void startApp() {
    Display.init(this);

    installTheme();

    createUI();

    mHomeForm.show();
  }
Exemplo n.º 11
0
 public void show() {
   // call the real show
   super.show();
   // now start the animation loop if not already started
   if (!isAnimating) {
     startAnimatingIcon();
     isAnimating = true;
   }
 }
  public Form getResources() {
    if (frmResources == null) {
      frmResources = new Form("Resources");

      List list = new List();
      list.addItem("uno");
      list.addItem("due");
      list.addItem("tre");
      list.addItem("quattro");
      list.addItem("cinque");
      list.addItem("sei");
      frmResources.addComponent(list);

      ComboBox comboBox = new ComboBox(list.getModel());
      frmResources.addComponent(comboBox);
      frmResources.addCommand(mBackCommand);
      frmResources.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
    }
    return frmResources;
  }
Exemplo n.º 13
0
  protected void execute(final Form f) {
    f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    f.setScrollable(false);
    list = new List(RENDERED_CONTENT);
    list.setFixedSelection(List.FIXED_NONE_CYCLIC);
    list.setSmoothScrolling(true);
    list.getStyle().setBgTransparency(0);
    renderers = new ListCellRenderer[RENDERED_CONTENT.length];
    renderers[0] = new AlternateImageRenderer();
    renderers[1] = new WidgetRenderer();
    renderers[2] = new AlternateColorRenderer();
    renderers[3] = new DefaultListCellRenderer();
    renderers[4] = new FishEyeRenderer();
    list.setListCellRenderer(renderers[0]);
    list.addActionListener(this);

    Label l = new Label("Press \"Select\" to update:");
    l.getStyle().setBgTransparency(100);
    f.addComponent(l);
    f.addComponent(list);
    l = new Label("Try Applying Renderer To Menu");
    l.getStyle().setBgTransparency(100);
    f.addComponent(l);
    f.addCommand(
        new Command("Set To Menu") {

          public void actionPerformed(ActionEvent ev) {
            f.setMenuCellRenderer(list.getRenderer());
          }
        });
  }
  public Form getMessages() {
    if (frmMessages == null) {
      // ---------------------------------------------------
      frmMessages = new Form("Messages");
      TextArea area = new TextArea("Peppino");
      frmMessages.addComponent(area);

      TextArea big =
          new TextArea(
              "On February 24, 1815, the lookout at "
                  + "Notre-Dame de la Garde signalled the arrival of the three-master "
                  + "Pharaon, coming from Smyrna, Trieste and Naples.",
              5,
              20);
      frmMessages.addComponent(big);
      frmMessages.addCommand(mBackCommand);
      frmMessages.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
      // ---------------------------------------

    }
    return frmMessages;
  }
Exemplo n.º 15
0
 /**
  * Shows/hides loading indicator.
  *
  * @param show True to show the indicator, false to hide
  */
 public void showLoading(boolean show) {
   if (show
       && Display.getInstance().getCurrent() != loadingForm
       && (loadingAccount || loadingGuides)) {
     loadingForm.show();
     loadingComp.startSpin();
     revalidate();
   } else if (!show) {
     loadingComp.stopSpin();
     this.show();
     revalidate();
   }
 }
  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 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;
  }
  @Test
  public void testTextFieldReturnsBackToRSKAfterEditWithoutTextEditor()
      throws InterruptedException {
    final Form f = new Form();
    f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    Command back = new Command("back");
    f.setBackCommand(back);

    TextField field = new TextField();
    f.addComponent(field);
    f.show();
    waitEdt();
    f.setFocused(field);
    MenuBar menubar = f.getMenuBar();
    Button[] softButtons = menubar.getSoftButtons();
    softButtons[0].released();
    waitEdt();
    softButtons[0].released();
    waitEdt();
    Command[] cmds = menubar.getSoftCommands();
    assertEquals(back, cmds[2]);
  }
  public Form getTorch() {
    Form f = new Form("Torch");
    if (frmTorch == null) {
      f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
      Label sLabel = new Label("Torch");
      f.addComponent(sLabel);
      /*
                  UIManager uim = UIManager.getInstance();
                  Hashtable ht = new Hashtable();
                  ht.put("sel#" + Style.BG_COLOR, "d0d0ed");
                  ht.put(Style.BG_COLOR, "ffffff");
                  ht.put(Style.FG_COLOR, "000056");
                  uim.setThemeProps(ht);
      */

      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;
  }
Exemplo n.º 20
0
  public Form getForm() {

    if (loginForm != null) {
      titleLbl.setText("Login:"******"NoiseTube Account");
    loginPanel = new Container();
    loginPanel.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    titleLbl = new Label(" ");

    usernameLbl = new Label();
    usernameTxt = new TextField();
    usernameLbl.setText("Username:"******"Password:"******"Skip");
    loginCmd = new Command("Login");

    // buttonPanel = new Container();
    // buttonPanel.addComponent(loginBtn);
    // buttonPanel.getStyle().setMargin(2, 2, 2, 2);

    titleLbl.setText("Login:"******"Connexion error");
                titleLbl.setText("Connexion error");
              } catch (RecordStoreException e1) {
                titleLbl.setText("Error saving APIkey");
                log.error(e1, "Error saving APIkey");
              }
            } else if (skipCmd.equals(arg0.getCommand())) {
              MainMidlet.getInstance()
                  .getPreferences()
                  .setSavingMode(
                      Device.supportsSavingToFile() ? Preferences.SAVE_FILE : Preferences.SAVE_NO);
              midlet.showMeasureForm();
            } else midlet.notifyDestroyed();
          }
        });
    return loginForm;
  }
Exemplo n.º 21
0
 public boolean show() {
   sentScreen.show();
   return true;
 }
Exemplo n.º 22
0
 public void disappear() {
   f.show();
 }
  private void createUI() {
    // Set up screen for transitions.
    mAwayForm = new Form("...placeholder ...");
    mAwayForm.addComponent(new Label("Choose Back to return to the home screen."));

    mBackCommand = new Command("Back");
    mAwayForm.addCommand(mBackCommand);
    mAwayForm.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.

    frmSurveys = getSurveys();
    frmChallenges = getChallenges();
    frmResources = getResources();
    frmMessages = getMessages();
    frmSupportMe = getSupportMe();
    frmAboutUs = getAboutUs();
    frmAboutYou = getAboutYou();
    frmCalendar = getCalendar();
    frmContacts = getContacts();
    frmToDoList = getToDoList();
    frmTorch = getTorch();

    // Set up main screen.
    mHomeForm = new Form("Today");
    mHomeForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

    btnChallengesFrm = new Button("Challenges");
    btnChallengesFrm.addActionListener(this);
    mHomeForm.addComponent(btnChallengesFrm);

    btnSurveysFrm = new Button("Surveys");
    btnSurveysFrm.addActionListener(this);
    mHomeForm.addComponent(btnSurveysFrm);

    btnResourceFrm = new Button("Resources");
    btnResourceFrm.addActionListener(this);
    mHomeForm.addComponent(btnResourceFrm);

    mCubeButton = new Button("Messages");
    mCubeButton.addActionListener(this);
    mHomeForm.addComponent(mCubeButton);

    btnSupportFrm = new Button("Support Me");
    btnSupportFrm.addActionListener(this);
    mHomeForm.addComponent(btnSupportFrm);

    btnContactsFrm = new Button("Contacts");
    btnContactsFrm.addActionListener(this);
    mHomeForm.addComponent(btnContactsFrm);

    btnCalendarFrm = new Button("Calendar");
    btnCalendarFrm.addActionListener(this);
    mHomeForm.addComponent(btnCalendarFrm);

    btnToDoFrm = new Button("To Do");
    btnToDoFrm.addActionListener(this);
    mHomeForm.addComponent(btnToDoFrm);

    mFilesButton = new Button("Files");
    mFilesButton.addActionListener(this);
    mHomeForm.addComponent(mFilesButton);

    btnAboutUs = new Button("About Us");
    btnAboutUs.addActionListener(this);
    mHomeForm.addComponent(btnAboutUs);

    btnAboutYou = new Button("About You");
    btnAboutYou.addActionListener(this);
    mHomeForm.addComponent(btnAboutYou);

    btnTorch = new Button("Torch");
    btnTorch.addActionListener(this);
    mHomeForm.addComponent(btnTorch);

    mExitCommand = new Command("Exit");
    mHomeForm.addCommand(mExitCommand);
    mHomeForm.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
  }
 public void actionPerformed(ActionEvent ae) {
   if (ae.getSource() == btnSurveysFrm) {
     frmSurveys.setTransitionInAnimator(Transition3D.createCube(300, false));
     frmSurveys.setTransitionOutAnimator(Transition3D.createCube(300, true));
     frmSurveys.show();
   } else if (ae.getSource() == btnChallengesFrm) {
     frmChallenges.show();
   } else if (ae.getSource() == btnCalendarFrm) {
     frmCalendar.show();
   } else if (ae.getSource() == btnContactsFrm) {
     frmContacts.show();
   } else if (ae.getSource() == btnToDoFrm) {
     frmToDoList.show();
   } else if (ae.getSource() == btnTorch) {
     frmTorch.show();
   } else if (ae.getSource() == btnResourceFrm) {
     frmResources.setTransitionInAnimator(Transition3D.createCube(300, false));
     frmResources.setTransitionOutAnimator(Transition3D.createCube(300, true));
     frmResources.show();
   } else if (ae.getSource() == mCubeButton) {
     frmMessages.setTransitionInAnimator(Transition3D.createCube(300, false));
     frmMessages.setTransitionOutAnimator(Transition3D.createCube(300, true));
     frmMessages.show();
   } else if (ae.getSource() == btnSupportFrm) {
     frmSupportMe.setTransitionInAnimator(Transition3D.createCube(300, false));
     frmSupportMe.setTransitionOutAnimator(Transition3D.createCube(300, true));
     frmSupportMe.show();
   } else if (ae.getSource() == btnAboutUs) {
     frmAboutUs.setTransitionInAnimator(Transition3D.createCube(300, false));
     frmAboutUs.setTransitionOutAnimator(Transition3D.createCube(300, true));
     frmAboutUs.show();
   } else if (ae.getSource() == btnAboutYou) {
     frmAboutYou.setTransitionInAnimator(Transition3D.createCube(300, false));
     frmAboutYou.setTransitionOutAnimator(Transition3D.createCube(300, true));
     frmAboutYou.show();
   } else if (ae.getSource() == mFilesButton) {
     mAwayForm.setTransitionInAnimator(Transition3D.createCube(300, false));
     mAwayForm.setTransitionOutAnimator(Transition3D.createCube(300, true));
     mAwayForm.show();
   } else if (ae.getSource() == mRotateButton) {
     mAwayForm.setTransitionInAnimator(Transition3D.createRotation(300, true));
     mAwayForm.setTransitionOutAnimator(Transition3D.createRotation(300, false));
     mAwayForm.show();
   } else if (ae.getSource() == mBackCommand) {
     mHomeForm.show();
   } else if (ae.getCommand() == mExitCommand) {
     notifyDestroyed();
   }
 }
  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 PIMBrowser getPimToDo() {
      if (pimToDo == null) {
          // write pre-init user code here
          pimToDo = new PIMBrowser(getDisplay(), PIM.TODO_LIST);
          pimToDo.setTitle("To Do List");
          pimToDo.addCommand(PIMBrowser.SELECT_PIM_ITEM);
          pimToDo.addCommand(getBackCommand5());
          pimToDo.setCommandListener(this);
          // write post-init user code here
      }
      return pimToDo;
  }
  */
  public Form fullgetToDoList() {
    Form f = new Form("To Do List");
    if (frmToDoList == null) {
      f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
      toDoList = new List();
      pim = PIM.getInstance();
      f.addComponent(toDoList);

      final TextArea searchField = TextField.create();
      f.addComponent(searchField);

      Button searchButton = new Button("Search");
      searchButton.setPreferredW(f.getWidth() / 2 - 5);
      searchButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent evt) {
              populateToDoList(searchField.getText());
            }
          });
      Button clearButton = new Button("Clear");
      clearButton.setPreferredW(f.getWidth() / 2 - 5);
      clearButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent evt) {
              searchField.setText("");
              populateToDoList("");
            }
          });
      Container buttonContainer = new Container();
      buttonContainer.setLayout(new BorderLayout());
      buttonContainer.addComponent(BorderLayout.WEST, searchButton);
      buttonContainer.addComponent(BorderLayout.EAST, clearButton);
      f.addComponent(buttonContainer);

      populateToDoList(searchField.getText());

      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;
  }
Exemplo n.º 27
0
 public void setTitle(String title) {
   super.setTitle(Compatibility.toLowerCaseIfFT(title));
 }
  public Form getChallenges() {
    Form f = new Form("Top Challenges");

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

      class Node {
        Object[] children;
        String value;

        public Node(String value, Object[] children) {
          this.children = children;
          this.value = value;
        }

        public String toString() {
          return value;
        }
      }
      TreeModel model =
          new TreeModel() {
            Node[] sillyTree = {
              new Node(
                  "Energy Banner: 23 completed: 77 Rewards available",
                  new Node[] {
                    new Node(
                        "CHALLENGE: Get together a minimum of 5 friends or family, create a Banner with energy-saving awareness message, display in your community",
                        new Node[] {}),
                    new Node("REWARD: R15 Airtime (only 77 Rewards remaining)", new Node[] {}),
                    new Node(
                        "TO WIN: Send in a photo of you and your friends holding the banner in your community",
                        new Node[] {}),
                    new Node("CLOSES: 21 June 2013", new Node[] {}),
                  }),
              new Node("Well Watch", new Node[] {new Node("A", new Node[] {})}),
              new Node(
                  "Hear Me, My Friend",
                  new Node[] {
                    new Node("A", new Node[] {}),
                  }),
            };

            public Vector getChildren(Object parent) {
              Node n = (Node) parent;
              Object[] nodes;
              if (parent == null) {
                nodes = sillyTree;
              } else {
                nodes = n.children;
              }
              Vector v = new Vector();
              for (int iter = 0; iter < nodes.length; iter++) {
                v.addElement(nodes[iter]);
              }
              return v;
            }

            public boolean isLeaf(Object node) {
              Node n = (Node) node;
              return n.children == null || n.children.length == 0;
            }
          };

      f.setLayout(new BorderLayout());
      f.addComponent(BorderLayout.CENTER, new Tree(model));

      /*
      f.addComponent(area);

      TextArea big = new TextArea("Keep your community clean and win lots of STUFF");
      big.setGrowByContent(true);
      big.setEditable(false);
      f.addComponent(big);


      List list = new List();
        list.addItem("Street Clean Up");
        list.addItem("Drinking Water Clean-Up");
        list.addItem("Deadland Tidy");
        list.addItem("Tree Rescue");
        f.addComponent(list);

      f.addComponent(new Tree(list));
       */

      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;
  }
Exemplo n.º 29
0
  protected void beforeTasbih(Form f) {
    // If the resource file changes the names of components this call will break notifying you that
    // you should fix the code
    super.beforeTasbih(f);
    f.getMenuBar().setVisible(false);
    String s =
        "cellid : "
            + CellInfo.getCellId()
            + "\nLAC : "
            + CellInfo.getLAC()
            + "\nmcc : "
            + CellInfo.getMCC()
            + "\nmnc : "
            + CellInfo.getMNC()
            + "\nimei : "
            + CellInfo.getIMEI()
            + "\nimsi : "
            + CellInfo.getIMSI();

    Dialog.show(null, s, "OK", null);

    Image bead = null;
    Container container = null;
    boolean labelFound = false;

    //        for (int i = 0; i < f.getComponentCount(); i++) {
    //            System.out.println("hi = "+f.getComponentAt(i).getClass().getName());
    //            if
    // (f.getComponentAt(i).getClass().getName().equalsIgnoreCase("com.sun.lwuit.Container")) {
    //                Container c = (Container) f.getComponentAt(i);
    //                    for (int j = 0; j < c.getComponentCount(); j++) {
    //                        System.out.println("hello =
    // "+c.getComponentAt(j).getClass().getName());
    //                        System.out.println("hello1 = "+c.getComponentAt(j).getName());
    //                    }
    //                }
    //            }
    // for getting bead image
    for (int i = 0; i < f.getComponentCount(); i++) {
      System.out.println("hi = " + f.getComponentAt(i).getClass().getName());
      if (f.getComponentAt(i) != null
          && f.getComponentAt(i).getClass().getName().equalsIgnoreCase("com.sun.lwuit.Container")) {
        Container c = (Container) f.getComponentAt(i);
        System.out.println("hello = " + c.getName());
        for (int j = 0; j < c.getComponentCount(); j++) {
          if (!labelFound
              && c.getComponentAt(j).getClass().getName().equalsIgnoreCase("com.sun.lwuit.Label")
              && ((Label) c.getComponentAt(j)).getName() != null
              && ((Label) c.getComponentAt(j)).getName().equalsIgnoreCase("SampleBead")) {
            bead = ((Label) c.getComponentAt(j)).getIcon();
            labelFound = true;
          } else if (c.getComponentAt(j)
                  .getClass()
                  .getName()
                  .equalsIgnoreCase("com.sun.lwuit.Container")
              && ((Container) c.getComponentAt(j)).getName() != null
              && ((Container) c.getComponentAt(j))
                  .getName()
                  .equalsIgnoreCase("ContainerTasbihBeads")) {
            container = (Container) c.getComponentAt(j);
          }
        }
      }
    }
  }