示例#1
0
  /**
   * Builds the UI based on a VCard.
   *
   * @param vcard the vcard used to build the UI.
   */
  private void buildUI(VCard vcard) {
    personalPanel.setFirstName(vcard.getFirstName());
    personalPanel.setMiddleName(vcard.getMiddleName());
    personalPanel.setLastName(vcard.getLastName());
    personalPanel.setEmailAddress(vcard.getEmailHome());
    personalPanel.setNickname(vcard.getNickName());
    personalPanel.setJID(vcard.getJabberId());

    businessPanel.setCompany(vcard.getOrganization());
    businessPanel.setDepartment(vcard.getOrganizationUnit());
    businessPanel.setStreetAddress(vcard.getAddressFieldWork("STREET"));
    businessPanel.setCity(vcard.getAddressFieldWork("LOCALITY"));
    businessPanel.setState(vcard.getAddressFieldWork("REGION"));
    businessPanel.setZipCode(vcard.getAddressFieldWork("PCODE"));
    businessPanel.setCountry(vcard.getAddressFieldWork("CTRY"));
    businessPanel.setJobTitle(vcard.getField("TITLE"));
    businessPanel.setPhone(vcard.getPhoneWork("VOICE"));
    businessPanel.setFax(vcard.getPhoneWork("FAX"));
    businessPanel.setPager(vcard.getPhoneWork("PAGER"));
    businessPanel.setMobile(vcard.getPhoneWork("CELL"));
    businessPanel.setWebPage(vcard.getField("URL"));

    // Load Home Info
    homePanel.setStreetAddress(vcard.getAddressFieldHome("STREET"));
    homePanel.setCity(vcard.getAddressFieldHome("LOCALITY"));
    homePanel.setState(vcard.getAddressFieldHome("REGION"));
    homePanel.setZipCode(vcard.getAddressFieldHome("PCODE"));
    homePanel.setCountry(vcard.getAddressFieldHome("CTRY"));
    homePanel.setPhone(vcard.getPhoneHome("VOICE"));
    homePanel.setFax(vcard.getPhoneHome("FAX"));
    homePanel.setPager(vcard.getPhoneHome("PAGER"));
    homePanel.setMobile(vcard.getPhoneHome("CELL"));

    // Set avatar
    byte[] bytes = vcard.getAvatar();
    if (bytes != null && bytes.length > 0) {
      ImageIcon icon = new ImageIcon(bytes);
      avatarPanel.setAvatar(icon);
      avatarPanel.setAvatarBytes(bytes);
      if (avatarLabel != null) {
        icon = GraphicUtils.scaleImageIcon(icon, 48, 48);

        avatarLabel.setIcon(icon);
      }
    }
  }
  /**
   * Calls an individual user by their VCard information.
   *
   * @param jid the users JID.
   */
  public void callByJID(String jid) {
    if (getStatus() == SipRegisterStatus.Registered) {
      final VCard vcard =
          SparkManager.getVCardManager().getVCard(StringUtils.parseBareAddress(jid));

      if (vcard != null) {
        String number = vcard.getPhoneWork("VOICE");
        if (!ModelUtil.hasLength(number)) {
          number = vcard.getPhoneHome("VOICE");
        }

        if (ModelUtil.hasLength(number)) {
          getDefaultGuiManager().dial(number);
        }
      }
    }
  }
示例#3
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jLabel6 = new javax.swing.JLabel();
    jLabel7 = new javax.swing.JLabel();
    jLabel8 = new javax.swing.JLabel();
    jLabel10 = new javax.swing.JLabel();
    streetHomeTextField = new javax.swing.JTextField();
    cityHomeTextField = new javax.swing.JTextField();
    countryHomeTextField = new javax.swing.JTextField();
    jLabel17 = new javax.swing.JLabel();
    countyHomeTextField = new javax.swing.JTextField();
    postCodeHomeTextField = new javax.swing.JTextField();
    jLabel5 = new javax.swing.JLabel();
    emailHomeTextField = new javax.swing.JTextField();
    jLabel21 = new javax.swing.JLabel();
    jLabel22 = new javax.swing.JLabel();
    jLabel23 = new javax.swing.JLabel();
    telephoneHomeTextField = new javax.swing.JTextField();
    faxHomeTextField = new javax.swing.JTextField();
    mobileHomeTextField = new javax.swing.JTextField();
    jLabel28 = new javax.swing.JLabel();
    pagerHomeTextField = new javax.swing.JTextField();

    jLabel6.setText("Street");

    jLabel7.setText("Town/city");

    jLabel8.setText("Country");

    jLabel10.setText("Post code");

    streetHomeTextField.setText(vCard.getAddressFieldHome("STREET"));

    cityHomeTextField.setText(vCard.getAddressFieldHome("TOWN"));

    countryHomeTextField.setText(vCard.getAddressFieldHome("CTRY"));

    jLabel17.setText("County");

    countyHomeTextField.setText(vCard.getAddressFieldHome("REGION"));

    postCodeHomeTextField.setText(vCard.getAddressFieldHome("PCODE"));

    jLabel5.setText("Email");

    emailHomeTextField.setText(vCard.getEmailHome());

    jLabel21.setText("Telephone");

    jLabel22.setText("Fax");

    jLabel23.setText("Mobile");

    telephoneHomeTextField.setText(vCard.getPhoneHome("VOICE"));

    faxHomeTextField.setText(vCard.getPhoneHome("FAX"));

    mobileHomeTextField.setText(vCard.getPhoneHome("CELL"));

    jLabel28.setText("Pager");

    pagerHomeTextField.setText(vCard.getPhoneHome("PAGER"));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createParallelGroup(
                                        javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(
                                        layout
                                            .createSequentialGroup()
                                            .addComponent(
                                                jLabel6,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                71,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(
                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(
                                                streetHomeTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                113,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(
                                        layout
                                            .createSequentialGroup()
                                            .addComponent(
                                                jLabel7,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                71,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(
                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(cityHomeTextField)))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jLabel17,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        71,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        countyHomeTextField,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        113,
                                        Short.MAX_VALUE))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jLabel10,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        71,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        postCodeHomeTextField,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        113,
                                        Short.MAX_VALUE))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jLabel8,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        71,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        countryHomeTextField,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        113,
                                        Short.MAX_VALUE)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(jLabel5)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        emailHomeTextField,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        112,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(jLabel22)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        faxHomeTextField,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jLabel21,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        71,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        telephoneHomeTextField,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        112,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel23)
                                            .addComponent(jLabel28))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(
                                                pagerHomeTextField,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                113,
                                                Short.MAX_VALUE)
                                            .addComponent(
                                                mobileHomeTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                103,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addContainerGap()));

    layout.linkSize(
        javax.swing.SwingConstants.HORIZONTAL,
        new java.awt.Component[] {jLabel10, jLabel6, jLabel7, jLabel8});

    layout.linkSize(
        javax.swing.SwingConstants.HORIZONTAL,
        new java.awt.Component[] {jLabel21, jLabel22, jLabel23, jLabel28, jLabel5});

    layout.linkSize(
        javax.swing.SwingConstants.HORIZONTAL,
        new java.awt.Component[] {
          emailHomeTextField,
          faxHomeTextField,
          mobileHomeTextField,
          pagerHomeTextField,
          telephoneHomeTextField
        });

    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel6)
                                            .addComponent(
                                                streetHomeTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel7)
                                            .addComponent(
                                                cityHomeTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel17)
                                            .addComponent(
                                                countyHomeTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel10)
                                            .addComponent(
                                                postCodeHomeTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel8)
                                            .addComponent(
                                                countryHomeTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(
                                                emailHomeTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel5))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel21)
                                            .addComponent(
                                                telephoneHomeTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel22)
                                            .addComponent(
                                                faxHomeTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel23)
                                            .addComponent(
                                                mobileHomeTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(
                                                pagerHomeTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel28))))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
  } // </editor-fold>//GEN-END:initComponents