Example #1
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());
          }
        });
  }
  protected void beforeGUI1(Form f) {
    try {
      HttpCon con12 = new HttpCon(null, PropertyClass.ServerUrl + "Allfrends");
      con12.SetContype(false, true, true);
      Thread t = new Thread(con12);
      synchronized (t) {
        t.start();
        t.wait();
      }
      final String bf[] = Splitter.Split(con12.getValue().toString(), "-");
      System.out.println(bf);
      final List l = (List) findByName("studentlist", f);

      for (int i = 0; i < bf.length - 1; i++) {

        l.addItem(Splitter.Split(bf[i], "/")[0]);
      }

      l.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent ae) {
              frndid = Splitter.Split(bf[l.getSelectedIndex()], "/")[1];
              showForm("Userprofile", null);
            }
          });

    } catch (Exception e) {
      System.out.println(e);
    }

    super.beforeGUI1(f);
  }
  /**
   * Constructor of Invitation form. This form displays all the non-hike users and allow user to
   * send invitation to those users who are not on hike.
   */
  public FormInvitation() {

    getStyle().setBgColor(ColorCodes.selectContactBgGrey, true);

    // #if nokia2_0
    setTitle(LBL_INVITE_FRIENDS);
    // #endif

    setLayout(new BorderLayout());

    setScrollable(false);

    addComponent(BorderLayout.NORTH, searchTextArea);

    initCommands();

    searchTextArea.setTextChangedListener(this);

    inviteList = new List(inviteVector);
    inviteList.getStyle().setPadding(Component.LEFT, 0, true);
    inviteList.getSelectedStyle().setPadding(Component.LEFT, 0, true);
    inviteList.getStyle().setPadding(Component.RIGHT, 0, true);
    inviteList.getSelectedStyle().setPadding(Component.RIGHT, 0, true);
    inviteList.getStyle().setPadding(Component.BOTTOM, 0, true);
    inviteList.getSelectedStyle().setPadding(Component.BOTTOM, 0, true);
    inviteList.setRenderer(new InviteListRenderer());
    inviteList.addActionListener(
        new ActionListener() {
          boolean clicked = false;
          AddressBookEntry entry;

          public void actionPerformed(ActionEvent evt) {
            if (!clicked) {
              entry = (AddressBookEntry) inviteList.getSelectedItem();
              if (entry.getMsisdn() == null || entry.getPhoneNumber() == null) {
                return;
              }
              clicked = true;
              if (entry.getId().equals(UNKNOWN_CONTACT_ID)) {
                MqttManager.invite(entry.getName(), AppState.getNextMessageID());
              } else {
                MqttManager.invite(entry.getMsisdn(), AppState.getNextMessageID());
              }
              clicked = false;
              entry.setInvited(true);
              // flushReplace();
              revalidate();
            }
          }
        });

    addComponent(BorderLayout.CENTER, inviteList);
  }
  /**
   * Constructor of privacy form. This form gives options user to delete or unlink account from the
   * device. Adding and initializing all components are done in this constructor.
   */
  public FormPrivacy() {

    getStyle().setBgColor(ColorCodes.settingsScreenBgGrey, true);

    // #if nokia2_0
    setTitle(LBL_PRIVACY);
    // #endif

    privacyVector.addElement(new PrivacyModel(LBL_DELETE_ACCOUNT, MSG_DELETE_ACCOUNT));
    privacyVector.addElement(new PrivacyModel(LBL_SIGNOUT, MSG_SIGNOUT_ACCOUNT));

    initCommands();

    // #if nokia1_1
    // #         Label privacyLabel = new Label(LBL_PRIVACY);
    // #         privacyLabel.getStyle().setBgTransparency(0, true);
    // #         privacyLabel.getStyle().setFgColor(0x808080, true);
    // #         privacyLabel.getStyle().setMargin(Component.TOP, 5, true);
    // #         addComponent(privacyLabel);
    // #endif

    setLayout(new BoxLayout(BoxLayout.Y_AXIS));

    final List privacyList = new List(privacyVector);
    privacyList.setFocusable(false);
    privacyList.setFocus(false);
    privacyList.getStyle().setPadding(Component.LEFT, 0, true);
    privacyList.getSelectedStyle().setPadding(Component.LEFT, 0, true);
    privacyList.getStyle().setPadding(Component.RIGHT, 0, true);
    privacyList.getSelectedStyle().setPadding(Component.RIGHT, 0, true);
    privacyList.getStyle().setPadding(Component.BOTTOM, 0, true);
    privacyList.getSelectedStyle().setPadding(Component.BOTTOM, 0, true);
    privacyList.getStyle().setBgColor(ColorCodes.settingsScreenListBgGrey, true);
    privacyList.getSelectedStyle().setBgColor(ColorCodes.settingsScreenListBgGrey, true);
    privacyList.getStyle().setBgTransparency(255, true);
    privacyList.getSelectedStyle().setBgTransparency(255, true);
    privacyList
        .getStyle()
        .setBorder(
            Border.createCompoundBorder(
                null,
                Border.createEtchedRaised(
                    ColorCodes.settingsScreenBorderGrey, ColorCodes.settingsScreenBorderShadow),
                null,
                null),
            true);
    privacyList
        .getSelectedStyle()
        .setBorder(
            Border.createCompoundBorder(
                null,
                Border.createEtchedRaised(
                    ColorCodes.settingsScreenBorderGrey, ColorCodes.settingsScreenBorderShadow),
                null,
                null),
            true);
    privacyList.setRenderer(new PrivacyListRenderer());
    privacyList.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (!clicked) {
              clicked = true;

              switch (privacyList.getSelectedIndex()) {
                case 0:
                  showDialog(MSG_DELETE_ACCOUNT_CONFIRMATION, LBL_DELETE, LBL_CANCEL);
                  clicked = false;
                  break;

                case 1:
                  showDialog(MSG_SIGNOUT_ACCOUNT_CONFIRMATION, LBL_UNLINK, LBL_CANCEL);
                  clicked = false;
                  break;
              }
            }
          }
        });

    addComponent(privacyList);
  }