Examples of StyledLabel


Examples of org.onesocialweb.gwt.client.ui.widget.StyledLabel

    }
    summaryWrapper.add(avatar);

    // Display name
    StyledFlowPanel displaynamewrapper = new StyledFlowPanel("wrapper");
    StyledLabel displayname = new StyledLabel("displayname", jid);
    displayname.setTitle(jid);
    String fullName;
    if (model != null) {
      fullName = model.getFullName();
      if (fullName != null && fullName.length() > 0) {
        displayname.setText(fullName);
      } else {
        displayname.setText(jid);
      }
    }

    StyledLabel you = new StyledLabel("you", uiText.You());

    displaynamewrapper.add(displayname);
    if (isSignedinUser)
      displaynamewrapper.add(you);
    summary.add(displaynamewrapper);

    // Get tags and following status
    String tags = "";
    OswService service = OswServiceFactory.getService();
    rosterItem = service.getRoster().getItem(jid);
    // make sure there is a rosterItem e.g. in the case it's you
    if (rosterItem != null) {
      for (int i = 0; i < rosterItem.getGroups().size(); i++) {
        String tag = rosterItem.getGroups().get(i);
        if (i < (rosterItem.getGroups().size() - 1)) {
          tags += "" + tag + ", ";
        } else {
          tags += "" + tag + "";
        }
      }
    }

    // Add the generic following icon
    following.setVisible(false);
    summary.add(following);

    // Are we following this person ?
    OswServiceFactory.getService().getSubscriptions(
        OswServiceFactory.getService().getUserBareJID(),
        new RequestCallback<List<String>>() {

          @Override
          public void onFailure() {
            // TODO Auto-generated method stub

          }

          @Override
          public void onSuccess(List<String> result) {
            // Show following green arow and label
            if (result.contains(jid)) {
              isFollowing = true;
              following.setVisible(true);
            } else {
              isFollowing = false;
              following.setVisible(false);
            }

            // Add the follow/unfollow button
            addButtons();
          }

        });

    buttonPanel.addStyleName("panel");

    // Bio
    if (model != null) {
      final String bio = model.getNote();
      if (model.getNote() != null) {
        if (model != null && bio != null && bio.length() > 0) {
          StyledLabel aboutme = new StyledLabel("aboutme",
              "<span>" + uiText.Bio() + "</span> " + HtmlHelper.encode(bio));
          summary.add(aboutme);
        }
      }
    }
View Full Code Here

Examples of org.onesocialweb.gwt.client.ui.widget.StyledLabel

    // setup layout

    // profile section
    StyledFlowPanel sectionProfile = new StyledFlowPanel("section");
    StyledLabel profileLabel = new StyledLabel("grouplabel", uiText.Profile());
    StyledLabel profileInstruction = new StyledLabel("instruction", "");
    details.add(sectionProfile);
    sectionProfile.add(profileLabel);
    sectionProfile.add(profileInstruction);
    sectionProfile.add(profile);

    // followers section
    StyledFlowPanel sectionFollowers = new StyledFlowPanel("section");
    StyledLabel followersLabel = new StyledLabel("grouplabel", uiText.Followers());
    final StyledLabel followersInstruction = new StyledLabel("instruction",
        "");
    details.add(sectionFollowers);
    sectionFollowers.add(followersLabel);
    sectionFollowers.add(followersInstruction);
    sectionFollowers.add(followersPanel);

    // following section
    StyledFlowPanel sectionFollowing = new StyledFlowPanel("section");
    StyledLabel followingLabel = new StyledLabel("grouplabel", uiText.FollowingPeople());
    final StyledLabel followingInstruction = new StyledLabel("instruction",
        "");
    details.add(sectionFollowing);
    sectionFollowing.add(followingLabel);
    sectionFollowing.add(followingInstruction);
    sectionFollowing.add(followingPanel);

    profileInstruction.setVisible(false);

    if (model != null && model.getFields().size() > 0) {
     
      // show the profile
      sectionProfile.setVisible(true);
     
      if (model.hasField(FullNameField.NAME)) {
        String displayname = model.getFullName();
        if (displayname != null && displayname.length() > 0)
          addHTMLLabelRow(profile, uiText.DisplayName(), displayname);
      }
     
      if (model.hasField(NameField.NAME)) {
        String name = model.getName();
        if (name != null && name.length() > 0)
          addHTMLLabelRow(profile, uiText.FullName(), name);
      }

      if (model.hasField(BirthdayField.NAME)) {
        Date birthday = model.getBirthday();
        if (birthday != null) {
          DateTimeFormat dtf = DateTimeFormat.getFormat("d MMMM yyyy");
          String bday = dtf.format(birthday);
          addHTMLLabelRow(profile, uiText.Birthday(), bday);
       
      }

      if (model.hasField(GenderField.NAME)) {
       
        String value = new String("");
       
        GenderField.Type gender = model.getGender();
       
        if (gender.equals(GenderField.Type.MALE)) {
          value = uiText.Male();
        } else if (gender.equals(GenderField.Type.FEMALE)) {
          value = uiText.Female();
        } else if (gender.equals(GenderField.Type.NOTKNOWN)) {
          value = uiText.NotKnown();
        } else if (gender.equals(GenderField.Type.NOTAPPLICABLE)) {
          value = uiText.NotApplicable();
        }
        if (gender != null)
          addHTMLLabelRow(profile, uiText.Gender(), value);
       
      }

      if (model.hasField(NoteField.NAME)) {
        String bio = model.getNote();
        if (bio != null && bio.length() > 0)
          addHTMLLabelRow(profile, uiText.Bio(), bio);
      }
     
      if (model.hasField(EmailField.NAME)) {
        String email = model.getEmail();
        if (email != null && email.length() > 0)
          addHTMLLabelRow(profile, uiText.Email(), email);
      }
     
      if (model.hasField(TelField.NAME)) {
        String tel = model.getTel();
        if (tel != null && tel.length() > 0)
          addHTMLLabelRow(profile, uiText.Telephone(), tel);
      }
     
      if (model.hasField(URLField.NAME)) {
        String url = model.getUrl();
        if (url != null && url.length() > 0)
          addHTMLLabelRow(profile, uiText.Website(), url);
      }

    } else {
      // if there are no results

      // hide the profile table
      profile.setVisible(false);

      // show message
      String msg = uiText.FailedToGetProfile();
      profileInstruction.setText(msg);
      profileInstruction.setVisible(true);

    }

    // get the followers of this person
    final DefaultTaskInfo task1 = new DefaultTaskInfo(
        uiText.FetchingFollowers(), false);
    TaskMonitor.getInstance().addTask(task1);

    OswServiceFactory.getService().getSubscribers(jid,
        new RequestCallback<List<String>>() {

          @Override
          public void onFailure() {
            // TODO Auto-generated method stub
            task1.complete("", Status.failure);
          }

          @Override
          public void onSuccess(List<String> result) {

            task1.complete("", Status.succes);

            // see if there are any results
            if (result.size() > 0) {
              // sort the list alphabetically
              Collections.sort(result, new Comparator<String>() {

                @Override
                public int compare(String o1, String o2) {
                  return o1.compareToIgnoreCase(o2);
                }

              });

              // add all the jids to the list
              for (final String jid : result) {

                Label follower = new Label(jid);
                follower.addStyleName("link");
                follower.setTitle(uiText.ViewProfileOf() + " " + jid);
                followersPanel.add(follower);
                follower.addClickHandler(new ClickHandler() {

                  @Override
                  public void onClick(ClickEvent event) {

                    // get the app instance from the session
                    // manager
                    AbstractApplication app = OswClient
                        .getInstance()
                        .getCurrentApplication();
                    ProfileWindow profileWindow = (ProfileWindow) app
                        .addWindow(ProfileWindow.class
                            .toString(), 1);
                    profileWindow.setJID(jid);
                    profileWindow.show();
                  }

                });
              }
            } else {
              // give a message if there are no followers
              followersInstruction
                  .setText(uiText.NoFollowers());
            }

          }

        });

    // get the people who are being followed by this person
    final DefaultTaskInfo task2 = new DefaultTaskInfo(
        uiText.FetchingFollowing(), false);
    TaskMonitor.getInstance().addTask(task2);

    OswServiceFactory.getService().getSubscriptions(jid,
        new RequestCallback<List<String>>() {

          @Override
          public void onFailure() {
            // TODO Auto-generated method stub
            task2.complete("", Status.failure);
          }

          @Override
          public void onSuccess(List<String> result) {

            task2.complete("", Status.succes);

            // see if there are any results
            if (result.size() > 0) {
              // sort the list alphabetically
              Collections.sort(result, new Comparator<String>() {

                @Override
                public int compare(String o1, String o2) {
                  return o1.compareToIgnoreCase(o2);
                }

              });

              // add all the jids to the list
              for (final String jid : result) {

                Label following = new Label(jid);
                following.addStyleName("link");
                following.setTitle(uiText.ViewProfileOf() + " " + jid);
                followingPanel.add(following);
                following.addClickHandler(new ClickHandler() {

                  @Override
                  public void onClick(ClickEvent event) {

                    // get the app instance from the session
                    // manager
                    AbstractApplication app = OswClient
                        .getInstance()
                        .getCurrentApplication();
                    ProfileWindow profileWindow = (ProfileWindow) app
                        .addWindow(ProfileWindow.class
                            .toString(), 1);
                    profileWindow.setJID(jid);
                    profileWindow.show();
                  }

                });
              }
            } else {
              // give a message if no one is followed
              followingInstruction
                  .setText(uiText.NoFollowing());
            }

          }
View Full Code Here

Examples of org.onesocialweb.gwt.client.ui.widget.StyledLabel

     * manage.add(manageFollowing);
     */

    // Add the lists
    StyledFlowPanel sectionLists = new StyledFlowPanel("section");
    StyledLabel tagsLabel = new StyledLabel("grouplabel", uiText.YourLists());
    StyledLabel tagsInstruction = new StyledLabel("instruction",
        uiText.AddOrRemovePerson());
    // EditableTagsList manageTags = new EditableTagsList(jid);

    OswService service = OswServiceFactory.getService();
    RosterItem rosterItem = service.getRoster().getItem(jid);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.