Java 类com.google.gwt.dom.client.FormElement 实例源码

项目:sigmah    文件:ReportsPresenter.java   
/**
 * Method executed on report export action.
 * 
 * @param report
 *          The current report.
 */
private void onExportReport(final ProjectReportDTO report) {

    final ServletUrlBuilder urlBuilder =
            new ServletUrlBuilder(injector.getAuthenticationProvider(), injector.getPageManager(), Servlet.EXPORT, ServletMethod.EXPORT_REPORT);

    urlBuilder.addParameter(RequestParameter.ID, report.getId());
    urlBuilder.addParameter(RequestParameter.TYPE, ExportType.PROJECT_REPORT);
    urlBuilder.addParameter(RequestParameter.FORMAT, ExportFormat.MS_WORD);

    final FormElement form = FormElement.as(DOM.createForm());
    form.setAction(urlBuilder.toString());
    form.setTarget("_downloadFrame");
    form.setMethod(Method.POST.name());

    RootPanel.getBodyElement().appendChild(form);

    form.submit();
    form.removeFromParent();
}
项目:appformer    文件:FileUploadFormEncoder.java   
/**
 * Sets the encoding of the provided form to UTF-8, see
 * https://code.google.com/p/google-web-toolkit/issues/detail?id=4682 for
 * details.
 * @param form
 */
public void addUtf8Charset(final Form form) {
    FormElement.as(form.getElement()).setAcceptCharset("UTF-8");

    final Hidden field = new Hidden();
    field.setName("utf8char");
    field.setValue("\u8482");
    form.add(field);
}
项目:sigmah    文件:ContactDetailsPresenter.java   
/**
 * Method executed on export contact action.
 *
 * @param contact
 *          The contact to export.
 */
private void onExportContact(final ContactDTO contact) {

  view.buildExportDialog(new ExportActionHandler() {

    @Override
    public void onExportContact(final boolean characteristicsField, final boolean allRelationsField, final boolean frameworkRelationsField, final boolean relationsByElementField) {

      final ServletUrlBuilder urlBuilder =
          new ServletUrlBuilder(injector.getAuthenticationProvider(), injector.getPageManager(), Servlet.EXPORT, ServletMethod.EXPORT_CONTACT);

      urlBuilder.addParameter(RequestParameter.ID, contact.getId());
      urlBuilder.addParameter(RequestParameter.WITH_CHARACTERISTICS, characteristicsField);
      urlBuilder.addParameter(RequestParameter.WITH_ALL_RELATIONS, allRelationsField);
      urlBuilder.addParameter(RequestParameter.WITH_FRAMEWORK_RELATIONS, frameworkRelationsField);
      urlBuilder.addParameter(RequestParameter.WITH_RELATIONS_BY_ELEMENT, relationsByElementField);

      final FormElement form = FormElement.as(DOM.createForm());
      form.setAction(urlBuilder.toString());
      form.setTarget("_downloadFrame");
      form.setMethod(Method.POST.name());

      RootPanel.getBodyElement().appendChild(form);

      form.submit();
      form.removeFromParent();
    }
  });
}
项目:sigmah    文件:ContactRelationshipsPresenter.java   
/**
 * Method executed on export relationships action.
 *
 * @param contact
 *          The contact to export.
 */
private void onExportContactRelationships(final ContactDTO contact) {

  view.buildExportDialog(new ExportActionHandler() {

    @Override
    public void onExportContactRelationships(final boolean characteristicsField, final boolean allRelationsField, final boolean frameworkRelationsField, final boolean relationsByElementField) {

      final ServletUrlBuilder urlBuilder =
          new ServletUrlBuilder(injector.getAuthenticationProvider(), injector.getPageManager(), ServletConstants.Servlet.EXPORT, ServletConstants.ServletMethod.EXPORT_CONTACT);

      urlBuilder.addParameter(RequestParameter.ID, contact.getId());
      urlBuilder.addParameter(RequestParameter.WITH_CHARACTERISTICS, characteristicsField);
      urlBuilder.addParameter(RequestParameter.WITH_ALL_RELATIONS, allRelationsField);
      urlBuilder.addParameter(RequestParameter.WITH_FRAMEWORK_RELATIONS, frameworkRelationsField);
      urlBuilder.addParameter(RequestParameter.WITH_RELATIONS_BY_ELEMENT, relationsByElementField);

      final FormElement form = FormElement.as(DOM.createForm());
      form.setAction(urlBuilder.toString());
      form.setTarget("_downloadFrame");
      form.setMethod(FormPanel.Method.POST.name());

      RootPanel.getBodyElement().appendChild(form);

      form.submit();
      form.removeFromParent();
    }
  });
}
项目:sigmah    文件:ProjectPresenter.java   
/**
 * Method executed on export project action.
 *
 * @param project
 *          The project to export.
 */
private void onExportProject(final ProjectDTO project) {

    view.buildExportDialog(new ExportActionHandler() {

        @Override
        public void onExportProject(final Field<Boolean> indicatorField, final Field<Boolean> logFrameField, final Field<Boolean> contactsField) {

            final ServletUrlBuilder urlBuilder =
                    new ServletUrlBuilder(injector.getAuthenticationProvider(), injector.getPageManager(), Servlet.EXPORT, ServletMethod.EXPORT_PROJECT);

            final ExportType type;

            if (indicatorField.getValue()) {
                if (logFrameField.getValue()) {
                type = ExportType.PROJECT_SYNTHESIS_LOGFRAME_INDICATORS;
                } else {
                type = ExportType.PROJECT_SYNTHESIS_INDICATORS;
                }
            } else {
                if (logFrameField.getValue()) {
                type = ExportType.PROJECT_SYNTHESIS_LOGFRAME;
            } else {
                type = ExportType.PROJECT_SYNTHESIS;
            }
            }

            urlBuilder.addParameter(RequestParameter.ID, project.getId());
            urlBuilder.addParameter(RequestParameter.TYPE, type);
            urlBuilder.addParameter(RequestParameter.WITH_CONTACTS, contactsField.getValue());

            final FormElement form = FormElement.as(DOM.createForm());
            form.setAction(urlBuilder.toString());
            form.setTarget("_downloadFrame");
            form.setMethod(Method.POST.name());

            RootPanel.getBodyElement().appendChild(form);

            form.submit();
            form.removeFromParent();
        }
    });
}
项目:requestor    文件:FormDataOverlay.java   
public static native FormDataOverlay create(FormElement formElement) /*-{
    return new FormData(formElement);
}-*/;
项目:requestor    文件:FormData.java   
private FormData(FormElement formElement) {
    this.formElement = formElement;
    this.params = null;
}
项目:requestor    文件:FormData.java   
public static FormData wrap(FormElement formElement) {
    return new FormData(formElement);
}
项目:requestor    文件:FormData.java   
public FormElement getFormElement() {
    return formElement;
}
项目:gwtbootstrap3    文件:AbstractForm.java   
FormElement getFormElement() {
    return FormElement.as(getElement());
}
项目:requestor    文件:Form.java   
void onWrappingPostButtonClick(FormElement formElement);