Esempio n. 1
0
  public ProfileDialog() {

    this.setWidget(uiBinder.createAndBindUi(this));
    this.addDialogListener(this);
    addStyleName(Css.PROFILE_DIALOG_BOX);

    profileLink.setText(Msg.consts.edit_profile());
    passwordLink.setText(Msg.consts.edit_password());
    portraitLink.setText(Msg.consts.edit_portrait());
    statusText.setHint(Msg.consts.user_status_hint());

    profileLink.addClickHandler(this);
    passwordLink.addClickHandler(this);
    portraitLink.addClickHandler(this);
    statusText.addChangeHandler(this);
    form1.addListener(this);
    form2.addListener(this);
    form3.addListener(this);

    editDeck.insert(form1, 1);
    editDeck.insert(form2, 2);
    editDeck.insert(form3, 3);

    deck.showWidget(0);

    resetTitle("");
    this.setIcon(ButtonIconBundle.userImage());

    // refresh page
    SecurityControllerAsync securityController = ControllerFactory.getSecurityController();
    // give -1 to get current login user
    securityController.getUser(-1, this);
  }
Esempio n. 2
0
 public void onChange(ChangeEvent event) {
   statusDirty = true;
   String str = statusText.getText();
   if (str.length() > 140) {
     // truncate if too long
     statusText.setText(str.substring(0, 140) + "...");
   }
 }
Esempio n. 3
0
  public boolean dialogClosing(DialogBox dialog) {
    // save status if any change
    statusText.setFocus(false);
    if (statusDirty && userUid != null) {
      SecurityControllerAsync securityController = ControllerFactory.getSecurityController();
      // give -1 to get current login user
      securityController.saveUserStatus(
          userUid,
          statusText.getText(),
          new AsyncCallback<Boolean>() {
            public void onFailure(Throwable caught) {}

            public void onSuccess(Boolean result) {}
          });
    }
    return true;
  }
Esempio n. 4
0
  private void fillPanel(UserModel model) {
    if (model == null) return;

    resetTitle(model.getLoginname());
    // if it's login user, refresh navbar user name
    if (model.isLogin()) BaseEntryPoint.I.resetLoginUser(model.getFullname());

    //		set display info on left part
    fullname.setText(model.getFullname());

    contacts.setUser(model);
    statusText.setText(StringUtil.trimToEmpty(model.getStatus()));
    this.userUid = model.getUid();

    if (model.getPortrait() != null) {
      // while user update Profile, the portrait won't refresh. See userPortraitUpdated() method
      portrait.clear();
      portrait.setWidget(GwtClientUtils.createUserPortrait(model.getPortrait()));
    }
  }