Пример #1
0
  /**
   * This is an overrided call of text change. This method gets called on every text change in the
   * search box.
   *
   * @param textArea
   * @param previousText
   * @param currentText
   */
  public void onTextChange(
      PatchedTextArea textArea, String previousText, final String currentText) {
    if (!(Display.getInstance().getCurrent() instanceof FormInvitation)) {
      return;
    }
    Log.v(TAG, " ************* testing PatchedTextArea " + currentText);
    Log.v(TAG, " ************* String Length  " + currentText.length());
    final int index = currentText.lastIndexOf(';');

    Log.v(TAG, " ************* Last Index " + index);
    if (index > 0) {
      UIHelper.runOnLwuitUiThread(
          new Runnable() {
            public void run() {
              searchContactlist(currentText.substring(index + 1));
            }
          });

      Log.v(TAG, " ************* Last Character " + currentText.substring(index));
    } else {
      UIHelper.runOnLwuitUiThread(
          new Runnable() {
            public void run() {
              searchContactlist(currentText);
            }
          });
    }

    if (!inviteVector.isEmpty()) {
      inviteList.setSelectedIndex(0);
      inviteList.repaint();
    }
  }
Пример #2
0
  /**
   * This delegated method is called just after showing the form. This method removes all the
   * contacts from the list and add them again on onShow().
   */
  protected void onShow() {
    super.onShow();

    inviteVector.removeAllElements();
    Vector list = AddressBookList.getInstance().getInviteList();
    Log.v(TAG, "Invite lsit size: " + list.size());
    Enumeration enums = list.elements();
    while (enums.hasMoreElements()) {
      AddressBookEntry entry = (AddressBookEntry) enums.nextElement();
      inviteVector.addElement(entry);
    }
    Collections.sort(inviteVector, mAlphabeticalComparator);
    // flushReplace();
    revalidate();
  }
Пример #3
0
    public Component getListCellRendererComponent(
        List list, Object value, int index, boolean isSelected) {
      if (value != null) {
        addressEntry = (AddressBookEntry) value;

        Log.v(TAG, "AddressBookEntry: " + addressEntry);

        Log.v(TAG, "Index is:" + index);
        onFocusLbl.getStyle().setBgTransparency(20, true);

        Container namephnumContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
        namephnumContainer.getStyle().setPadding(Component.LEFT, 3, true);
        namephnumContainer.getStyle().setPadding(Component.TOP, 5, true);
        namephnumContainer.getStyle().setPadding(Component.BOTTOM, 8, true);

        Label contactName = new Label(addressEntry.getName());
        contactName.getStyle().setBgTransparency(0, true);
        contactName.getStyle().setFgColor(ColorCodes.selectContactNameGrey, true);
        contactName.getStyle().setPadding(Component.BOTTOM, 0, true);

        contactName.getSelectedStyle().setFont(Fonts.MONO_MEDIUM, true);
        contactName.getStyle().setFont(Fonts.MONO_MEDIUM, true);
        contactName.getSelectedStyle().setBorder(null, true);
        contactName.setPreferredSize(
            new Dimension(
                (Display.getInstance().getDisplayWidth() - inviteImage.getWidth() - 25), 30));

        Label phoneNum = new Label(addressEntry.getMsisdn());
        phoneNum.getStyle().setBgTransparency(0, true);
        phoneNum.getStyle().setPadding(Component.TOP, 0, true);
        phoneNum.getSelectedStyle().setBorder(null, true);
        phoneNum.getSelectedStyle().setFont(Fonts.MONO_SMALL, true);
        phoneNum.getStyle().setFont(Fonts.MONO_SMALL, true);
        phoneNum.getStyle().setFgColor(ColorCodes.selectContactNumberGrey);

        namephnumContainer.addComponent(contactName);
        namephnumContainer.addComponent(phoneNum);

        inviteButton = new Button(inviteImage);
        inviteButton.getStyle().setBgTransparency(0, true);
        inviteButton.getSelectedStyle().setBgTransparency(0, true);
        inviteButton.getPressedStyle().setBgTransparency(0, true);
        inviteButton.getPressedStyle().setBorder(null, true);
        inviteButton.getStyle().setBorder(null, true);
        inviteButton.getSelectedStyle().setBorder(null, true);
        inviteButton.getStyle().setAlignment(CENTER);

        tickMark = new Label(sentInviteImage);
        tickMark.getStyle().setAlignment(Component.CENTER);
        tickMark.getStyle().setBgTransparency(0, true);
        tickMark.getSelectedStyle().setBgTransparency(0, true);
        tickMark.getPressedStyle().setBgTransparency(0, true);
        tickMark.getPressedStyle().setBorder(null, true);
        tickMark.getStyle().setBorder(null, true);
        tickMark.getSelectedStyle().setBorder(null, true);
        tickMark.getStyle().setAlignment(CENTER);
        tickMark.getStyle().setPadding(Component.RIGHT, 30, true);

        mainContainer = new Container(new BorderLayout());
        mainContainer
            .getStyle()
            .setBorder(
                Border.createCompoundBorder(
                    null,
                    Border.createEtchedRaised(
                        ColorCodes.selectContactSeperator, ColorCodes.selectContactSeperatorShadow),
                    null,
                    null),
                true);

        mainContainer.addComponent(BorderLayout.WEST, namephnumContainer);
        if (inviteButton.getParent() == null) {
          mainContainer.addComponent(BorderLayout.EAST, inviteButton);
        }

        getStyle().setPadding(Component.RIGHT, 0, true);
        getUnselectedStyle().setPadding(Component.RIGHT, 0, true);
        getPressedStyle().setPadding(Component.RIGHT, 0, true);
        getSelectedStyle().setPadding(Component.RIGHT, 0, true);

        if (addressEntry.isInvited()) {
          mainContainer.removeComponent(inviteButton);
          mainContainer.addComponent(BorderLayout.EAST, tickMark);
        }
      }

      return mainContainer;
    }