Example usage for com.google.gwt.user.client.ui FormPanel METHOD_POST

List of usage examples for com.google.gwt.user.client.ui FormPanel METHOD_POST

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui FormPanel METHOD_POST.

Prototype

String METHOD_POST

To view the source code for com.google.gwt.user.client.ui FormPanel METHOD_POST.

Click Source Link

Document

Used with #setMethod(String) to specify that the form will be submitted using an HTTP POST request (necessary for FileUpload to work properly).

Usage

From source file:com.dimdim.conference.ui.resources.client.SelectOnlyFileDialog.java

License:Open Source License

protected Widget getContent() {
    VerticalPanel contentPanel = new VerticalPanel();
    contentPanel.setStyleName("powerpoint-info-text");

    //Label comment1 = new Label(ResourceGlobals.getResourceGlobals().getSelectFileComment1().replaceAll("file",this.docType));
    Label comment1 = new Label(ResourceGlobals.getResourceGlobals().getSelectFileComment1());
    comment1.setStyleName("change-photo-picture-caption");
    comment1.addStyleName("common-text");
    comment1.addStyleName("common-4px-top-bottom-spacing");
    comment1.setWordWrap(true);//from   w  ww .j a  va2  s . c o m
    //      comment1.setWidth("200px");
    //      comment1.setWidth("250px");

    contentPanel.add(comment1);
    contentPanel.add(new HTML(" "));

    this.selectFileForm = new FormPanel();
    this.selectFileForm.setAction(this.commandURLFactory.getPhotoUploadURL());
    this.selectFileForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    this.selectFileForm.setMethod(FormPanel.METHOD_POST);

    this.existingFileField = new FileUpload();
    this.existingFileField.setName("photo");
    this.selectFileForm.add(this.existingFileField);
    this.existingFileField.setStyleName("photo-file-upload-field");

    contentPanel.add(this.selectFileForm);

    contentPanel.add(new HTML(" "));
    this.errorMessage.setStyleName("common-text");
    contentPanel.add(this.errorMessage);

    return contentPanel;
}

From source file:com.dimdim.conference.ui.user.client.ChangePictureDialog.java

License:Open Source License

protected Widget getContent() {
    VerticalPanel contentPanel = new VerticalPanel();
    contentPanel.setStyleName("change-photo-content-panel");
    String defaultPhotoUrl = UserGlobals.getUserGlobals().getDefaultPhotoUrl();
    String currentPhotoUrl = this.me.getPhotoUrl();

    //Window.alert("inside chage picture");
    this.defaultPhotoButton = new RadioButton("PhotoSelection");
    this.defaultPhotoButton.addClickListener(this);
    this.defaultPhotoButton.setStyleName("change-photo-radio-button");
    this.customPhotoButton = new RadioButton("PhotoSelection");
    this.customPhotoButton.addClickListener(this);
    this.customPhotoButton.setStyleName("change-photo-radio-button");

    //   Custom Photo caption

    Label comment1 = new Label(UserGlobals.getUserGlobals().getChangePictureComment1());
    comment1.setStyleName("change-photo-picture-caption");
    comment1.addStyleName("common-text");
    contentPanel.add(comment1);//from  w  w  w  .j  av  a 2 s .co m

    Label comment2 = new Label(UserGlobals.getUserGlobals().getChangePictureComment2());
    comment2.setStyleName("change-photo-picture-caption");
    comment2.addStyleName("common-text");
    contentPanel.add(comment2);

    HorizontalPanel customPhotoCaption = new HorizontalPanel();
    customPhotoCaption.setStyleName("change-photo-picture-caption");
    customPhotoCaption.add(this.customPhotoButton);
    Label label2 = new Label(UIStrings.getChangePhotoLabel());
    label2.setStyleName("common-text");
    label2.addStyleName("change-photo-label");
    customPhotoCaption.add(label2);

    //      HorizontalPanel uploadCaption = new HorizontalPanel();
    //      uploadCaption.setStyleName("change-photo-picture-caption");
    //      this.uploadLink = new Label("Upload");
    //      this.uploadLink.addClickListener(this);
    //      this.uploadLink.setStyleName("common-text");
    //      this.uploadLink.addStyleName("change-photo-upload-label");
    //      this.uploadLink.addStyleName("common-anchor");
    //      uploadCaption.add(this.uploadLink);

    //   Create a form panel for the photo file upload.

    this.photoUploadForm = new FormPanel();
    this.photoUploadForm.setAction(this.commandURLFactory.getPhotoUploadURL());
    this.photoUploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    this.photoUploadForm.setMethod(FormPanel.METHOD_POST);

    this.photoUploadField = new FileUpload();
    this.photoUploadField.setName("photo");
    this.photoUploadForm.add(this.photoUploadField);
    this.photoUploadField.setStyleName("photo-file-upload-field");

    contentPanel.add(customPhotoCaption);
    contentPanel.add(this.photoUploadForm);
    //      contentPanel.add(uploadCaption);

    //   Default Photo Caption

    HorizontalPanel defaultPhotoCaption = new HorizontalPanel();
    defaultPhotoCaption.setStyleName("change-photo-picture-caption");
    defaultPhotoCaption.add(this.defaultPhotoButton);
    Label label1 = new Label(UIStrings.getUseDefaultPhotoLabel());
    label1.setStyleName("common-text");
    label1.addStyleName("change-photo-label");
    defaultPhotoCaption.add(label1);
    if (UserGlobals.getUserGlobals().isPhotoUrlDefault(currentPhotoUrl)) {
        this.defaultPhotoButton.setChecked(true);
        this.customPhotoButton.setChecked(false);
    } else {
        this.defaultPhotoButton.setChecked(false);
        this.customPhotoButton.setChecked(true);
    }
    contentPanel.add(defaultPhotoCaption);

    //   Photo Panel

    if (currentPhotoUrl == null || currentPhotoUrl.length() == 0) {
        currentPhotoUrl = defaultPhotoUrl;
    }
    Image photoImage = new Image(currentPhotoUrl);
    photoImage.setStyleName("change-photo-picture");
    contentPanel.add(photoImage);
    contentPanel.setCellVerticalAlignment(photoImage, VerticalPanel.ALIGN_MIDDLE);
    contentPanel.setCellHorizontalAlignment(photoImage, HorizontalPanel.ALIGN_LEFT);

    //      this.photoUploadField.setVisible(false);
    //      this.uploadLink.setVisible(false);

    return contentPanel;
}

From source file:com.edgenius.wiki.gwt.client.login.LoginForm.java

License:Open Source License

public LoginForm(DialogBox dialog, Button sender, String redirUrl, final boolean offline) {
    this.offline = offline;
    this.dialog = dialog;
    this.sender = sender;

    if (offline) {
        this.initWidget(offlineBinder.createAndBindUi(this));
    } else {//from www .j  av a  2  s . co  m
        this.initWidget(onlineBinder.createAndBindUi(this));
    }

    final String containerID = HTMLPanel.createUniqueId();
    DOM.setElementAttribute(form.getElement(), "id", containerID);

    form.addSubmitHandler(this);
    form.addSubmitCompleteHandler(this);

    form.setAction(GwtClientUtils.getBaseUrl() + "j_spring_security_check");
    form.setMethod(FormPanel.METHOD_POST);

    KeyDownHandler enterSubmit = GwtClientUtils.createEnterSubmitListener(form);

    username.addKeyDownHandler(enterSubmit);
    username.addKeyPressHandler(cleanMessageListener);

    password.addKeyDownHandler(enterSubmit);
    password.addKeyPressHandler(cleanMessageListener);

    remeberme.addKeyDownHandler(enterSubmit);

    //first disable,only this user failed login several times later in given period, captcha will show up
    captcha.disable();
    captcha.getCaptchaInputWidget().addKeyPressHandler(cleanMessageListener);
    captcha.getCaptchaInputWidget().addKeyDownHandler(enterSubmit);

    //hardcode for server side parameter name
    redir.setValue(redirUrl);
    focus();

}

From source file:com.edgenius.wiki.gwt.client.login.SignupForm.java

License:Open Source License

/**
 * Used in user signup and system admin adds new user
 * @param dialog /*from w w w . ja v a2s.  c o m*/
 * @param sender 
 * @param redirUrl 
 */
public SignupForm(DialogBox dialog, Button sender, String redirUrl) {
    this.dialog = dialog;
    this.sender = sender;
    this.redirUrl = redirUrl;
    form.setMethod(FormPanel.METHOD_POST);
    form.addSubmitHandler(this);

    FlexTable inputPanel = new FlexTable();
    profile.userInfo(inputPanel, form, PersonalProfile.STYLE_SIGNUP);

    VerticalPanel panel = new VerticalPanel();
    panel.add(message);
    panel.add(inputPanel);

    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    panel.setSize("450px", "100%");

    form.setWidget(panel);

    this.setWidget(form);
}

From source file:com.edgenius.wiki.gwt.client.space.SpaceLogoForm.java

License:Open Source License

public SpaceLogoForm() {
    final FormPanel form = new FormPanel();
    form.setAction(GwtClientUtils.getBaseUrl() + "space/logo.do");
    form.setMethod(FormPanel.METHOD_POST);
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.addSubmitHandler(this);
    form.addSubmitCompleteHandler(this);

    VerticalPanel panel = new VerticalPanel();
    panel.add(message);//from w w  w.j a  v a  2 s .co m
    panel.add(spaceUname);
    HorizontalPanel h1 = new HorizontalPanel();
    Label uploadLabel = new Label(Msg.consts.logo());
    uploadLabel.setStyleName(Css.FORM_LABEL);
    FileUpload upload = new FileUpload();
    upload.setName("file");
    h1.add(uploadLabel);
    h1.add(upload);
    panel.add(h1);

    form.setWidget(panel);

    //
    Button update = new Button(Msg.consts.update());
    update.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            form.submit();
        }
    });
    Button cancel = new Button(Msg.consts.cancel());
    cancel.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            //return to link panel
            for (Iterator<SpaceUpdateListener> iter = listener.iterator(); iter.hasNext();) {
                iter.next().spaceUpdateCancelled();
            }
        }
    });

    ButtonBar btnBar = new ButtonBar();
    btnBar.add(update);
    btnBar.add(cancel);

    VerticalPanel main = new VerticalPanel();
    main.add(form);
    main.add(btnBar);
    setWidget(main);
}

From source file:com.edgenius.wiki.gwt.client.user.PasswordForm.java

License:Open Source License

public PasswordForm() {
    //      form.setAction(GwtUtils.getBaseUrl() + "user/password.do");
    form.setMethod(FormPanel.METHOD_POST);
    form.addSubmitHandler(this);

    VerticalPanel panel = new VerticalPanel();
    panel.add(userUid);/*from   ww w.j  a v  a  2s . c  om*/
    panel.add(message);
    FlexTable inputPanel = new FlexTable();
    profile.userInfo(inputPanel, form, PersonalProfile.STYLE_PASSWORD);
    panel.add(inputPanel);

    signup.addClickHandler(this);
    cancel.addClickHandler(this);

    ButtonBar h6 = new ButtonBar();
    h6.add(signup);
    h6.add(cancel);

    panel.add(h6);
    form.setWidget(panel);
    initWidget(form);
}

From source file:com.edgenius.wiki.gwt.client.user.PortraitForm.java

License:Open Source License

public PortraitForm() {
    form.setAction(GwtClientUtils.getBaseUrl() + "user/portrait.do");
    form.setMethod(FormPanel.METHOD_POST);
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.addSubmitHandler(this);
    form.addSubmitCompleteHandler(this);

    VerticalPanel panel = new VerticalPanel();
    panel.add(message);// www.j a v  a 2  s .c  o  m
    panel.add(userUid);
    Label uploadLabel = new Label(Msg.consts.portrait());
    uploadLabel.setStyleName(Css.FORM_LABEL);
    FileUpload upload = new FileUpload();
    upload.setName("file");
    panel.add(uploadLabel);
    panel.add(upload);
    form.setWidget(panel);

    update.addClickHandler(this);

    cancel.addClickHandler(this);

    ButtonBar btnBar = new ButtonBar();
    btnBar.add(update);
    btnBar.add(cancel);

    VerticalPanel main = new VerticalPanel();
    main.add(form);
    main.add(btnBar);
    setWidget(main);
}

From source file:com.edgenius.wiki.gwt.client.user.ProfileForm.java

License:Open Source License

public ProfileForm() {

    form.setMethod(FormPanel.METHOD_POST);
    form.addSubmitHandler(this);

    VerticalPanel panel = new VerticalPanel();
    panel.add(message);//from  ww w .  j  a  v a 2  s  .  c  o  m
    panel.add(profile);

    signup.addClickHandler(this);
    cancel.addClickHandler(this);

    ButtonBar h6 = new ButtonBar();
    h6.add(signup);
    h6.add(cancel);
    panel.add(h6);
    form.setWidget(panel);
    initWidget(form);
}

From source file:com.edgenius.wiki.gwt.client.user.SendMessageDialog.java

License:Open Source License

public SendMessageDialog(String username) {
    this.username = username;
    this.setText(Msg.consts.send_message());
    this.setIcon(new Image(IconBundle.I.get().message()));
    final FormPanel form = new FormPanel();
    form.setMethod(FormPanel.METHOD_POST);
    form.addSubmitHandler(this);
    form.setStyleName(Css.FORM);// w  ww. j ava  2 s.co m
    form.setWidget(panel);

    Label header = new Label(Msg.params.send_message_to(username));
    panel.add(header);
    header.setStyleName(Css.HEADING2);
    panel.setCellHorizontalAlignment(header, HasHorizontalAlignment.ALIGN_CENTER);

    panel.add(message);
    panel.add(limit);
    limit.setStyleName(Css.TWEET_COUNTER);
    panel.setCellHorizontalAlignment(limit, HasHorizontalAlignment.ALIGN_RIGHT);

    panel.add(contentBox);
    contentBox.addKeyUpHandler(this);

    ButtonBar btnBar = getButtonBar();
    Button send = new Button(Msg.consts.send());
    Button cancel = new Button(Msg.consts.cancel());
    send.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            form.submit();
        }
    });
    cancel.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            SendMessageDialog.this.hidebox();
        }
    });
    btnBar.add(cancel);
    btnBar.add(send);

    panel.setSize("100%", "100%");
    contentBox.setStyleName(Css.TWEET_BOX);

    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    panel.setCellHorizontalAlignment(contentBox, HasHorizontalAlignment.ALIGN_CENTER);

    this.setWidget(form);
}

From source file:com.edgenius.wiki.gwt.client.widgets.FeedbackDialog.java

License:Open Source License

public FeedbackDialog() {
    this.setText(Msg.consts.feedback());
    this.setIcon(new Image(IconBundle.I.get().email()));

    final FormPanel form = new FormPanel();
    form.setMethod(FormPanel.METHOD_POST);
    form.addSubmitHandler(this);
    form.setStyleName(Css.FORM);/*  w ww  .  j  av a 2s.  com*/
    form.setWidget(panel);

    HorizontalPanel h1 = new HorizontalPanel();
    Label emailLabel = new Label(Msg.consts.your_email());
    h1.add(emailLabel);
    h1.add(emailBox);

    feedbackBox.valid(Msg.consts.feedback(), true, 0, 0, null);
    emailBox.valid(Msg.consts.email(), true, 0, 0, this);
    Label feedbackLabel = new Label(Msg.consts.your_feedback());
    panel.add(message);
    panel.add(h1);
    panel.add(feedbackLabel);
    panel.add(feedbackBox);

    ButtonBar btnBar = getButtonBar();
    Button send = new Button(Msg.consts.send(), ButtonIconBundle.tickImage());
    Button cancel = new Button(Msg.consts.cancel(), ButtonIconBundle.crossImage());
    send.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            form.submit();
        }
    });
    cancel.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            FeedbackDialog.this.hidebox();
        }
    });
    btnBar.add(cancel);
    btnBar.add(send);

    panel.setSize("100%", "100%");
    emailLabel.setStyleName(Css.FORM_LABEL);
    feedbackLabel.setStyleName(Css.FORM_LABEL);
    emailBox.setStyleName(Css.FORM_INPUT);
    feedbackBox.setStyleName(Css.LONG_TEXTBOX);

    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    panel.setCellHorizontalAlignment(feedbackBox, HasHorizontalAlignment.ALIGN_CENTER);

    this.setWidget(form);

}