/** @param parent the profile form which will own the this tab component. */
  public ProfileTabComponent(final ProfileForm parent) {
    // unset default FlowLayout' gaps
    super(new FlowLayout(FlowLayout.LEFT, 0, 0));

    this.parent = parent;
    setOpaque(false);

    final JLabel label = new JLabel();
    label.setText(parent.getName());
    parent.addPropertyChangeListener(
        "name",
        new PropertyChangeListener() {
          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            label.setText(evt.getNewValue().toString());
          }
        });

    add(label);
    // add more space between the label and the button
    label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, BORDER_RIGHT));

    // tab button
    button = new CloseTabButton();
    button.setVisible(false);
    add(button);
    // add more space to the top of the component
    setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
  }
Exemplo n.º 2
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);
  }
Exemplo n.º 3
0
  public void userUpdated(UserModel model) {

    // reset profileForm value
    form1.fillFields(model);
    fillPanel(model);
    editDeck.showWidget(0);
  }
Exemplo n.º 4
0
  public void onSuccess(UserModel user) {
    deck.showWidget(1);

    if (!GwtClientUtils.preSuccessCheck(user, null)) {
      return;
    }

    // user exist - then fill all user information form and display information.
    if (user.getUid() != null && user.getUid() > 0) {
      fillPanel(user);
      form1.fillFields(user);
      form2.fillFields(user);
      form3.fillFields(user);
      editDeck.showWidget(0);
    }
    // image loading and center
    Scheduler.get()
        .scheduleDeferred(
            new ScheduledCommand() {
              public void execute() {
                ProfileDialog.this.center();
              }
            });
    // TODO: user not exist, error message display
  }
  /**
   * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping,
   *     org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
   *     javax.servlet.http.HttpServletResponse)
   */
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse reponse)
      throws HibernateException {
    logger.debug("Add called...");
    ProfileForm profileForm = (ProfileForm) form;

    QueueLoader queueLoader = new QueueLoader();
    List<Queue> queueList = queueLoader.loadQueueList(false, false);
    profileForm.setQueueList(queueList);
    profileForm.setActive(true);
    profileForm.setSelectable(true);
    request.getSession().setAttribute("profileForm", profileForm);

    return mapping.findForward("input");
  }