Java 类com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler 实例源码

项目:qafe-platform    文件:EventFactory.java   
public static SubmitCompleteHandler createSubmitCompleteHandler(final UIObject ui, final EventListenerGVO ev, final List<InputVariableGVO> inputVariables) {
    SubmitCompleteHandler submitCompleteHandler = new SubmitCompleteHandler() {
        public void onSubmitComplete(SubmitCompleteEvent event) {
            String uuId = event.getResults();
            boolean success = false;
            if ((uuId != null) && (uuId.indexOf("=") > 0)) {
                uuId = uuId.substring(uuId.indexOf("=") + 1);
                success = true;
            }
            FormPanel fp = (FormPanel) ui;
            if (fp instanceof HasWidgets) {
                HasWidgets hasWidgets = (HasWidgets) fp;
                Iterator<Widget> itr = hasWidgets.iterator();
                while (itr.hasNext()) {
                    Widget widget = itr.next();
                    if (widget instanceof Grid) {
                        Grid gridPanel = (Grid) widget;
                        FileUpload fileUpload = (FileUpload) gridPanel.getWidget(0, 0);
                        if (success) {
                            DOM.setElementAttribute(fileUpload.getElement(), "fu-uuid", uuId);
                            CallbackHandler.createCallBack(ui, QAMLConstants.EVENT_ONFINISH, ev, inputVariables);
                        } else {
                            Label fileNameLabel = new Label("Uploading unsuccessfull.");// (Hyperlink)
                                                                                        // gridPanel.getWidget(1,
                                                                                        // 0);
                            fileNameLabel.setText("Uploading unsuccessfull.");
                            fileNameLabel.setVisible(true);
                            gridPanel.add(fileNameLabel);
                        }
                    }
                }
            }
        }
    };
    return submitCompleteHandler;
}
项目:wte4j    文件:TemplateUploadFormPanel.java   
@Override
public void addSubmitCompleteHandler(SubmitCompleteHandler handler) {
    formPanel.addSubmitCompleteHandler(handler);
}
项目:scheduling-portal    文件:SubmitWindow.java   
private SubmitCompleteHandler fileUploadCompleteHandler() {
    return new SubmitCompleteHandler() {
        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {

            String fn = fileUpload.getFilename();
            // chrome workaround
            final String fileName = fn.replace("C:\\fakepath\\", "");
            String res = event.getResults();

            try {
                JSONValue js = JSONParser.parseStrict(res);
                JSONObject obj = js.isObject();

                if (obj.get("jobEdit") != null && obj.get("jobEdit").isString() != null) {
                    String val = obj.get("jobEdit").isString().stringValue();
                    job = new String(org.ow2.proactive_grid_cloud_portal.common.shared.Base64Utils.fromBase64(val));
                    // if the job has an EXECUTION_CALENDAR Generic Information defined, the startAccordingToPlanningRadioButton becomes visible, and invisible otherwise
                    setStartAccordingPlanningRadioButtonState(job);
                    variables = readVars(job);
                } else {
                    GWT.log("JSON parse ERROR");
                    displayErrorMessage(res);
                    //Force disable check&submit buttons to prevent confusion if a valid job was uploaded first but not submitted
                    setEnabledStartAtPart(false);
                    startAccordingPlanningRadioButton.setVisible(false);
                    return;
                }

            } catch (JSONException t) {
                GWT.log("JSON parse ERROR");
                displayErrorMessage(res);
                //Force disable check&submit buttons to prevent confusion if a valid job was uploaded first but not submitted
                setEnabledStartAtPart(false);
                startAccordingPlanningRadioButton.setVisible(false);
                return;
            }
            redrawVariables();
        }
    };
}
项目:kaa    文件:RecordPanel.java   
/**
 * Instantiates a new RecordPanel.
 */
public RecordPanel(AvroWidgetsConfig config, boolean showCaption, String title,
                   HasErrorMessage hasErrorMessage, boolean optional, boolean readOnly) {
  this.showCaption = showCaption;
  this.optional = optional;
  this.readOnly = readOnly;
  this.hasErrorMessage = hasErrorMessage;
  FlexTable table = new FlexTable();
  table.setWidth("100%");
  if (config == null) {
    config = new AvroWidgetsConfig.Builder().createConfig();
  }

  recordFieldWidget = new RecordFieldWidget(config, readOnly);
  if (showCaption) {
    recordCaption = new CaptionPanel();
    setTitle(title);
    recordCaption.setContentWidget(recordFieldWidget);
    table.setWidget(0, 0, recordCaption);
  } else {
    table.setWidget(0, 0, recordFieldWidget);
  }

  recordFileUpload = new FileUploadForm();
  recordFileUpload.addSubmitCompleteHandler(new SubmitCompleteHandler() {
    @Override
    public void onSubmitComplete(SubmitCompleteEvent event) {
      loadRecordFromFile();
    }
  });
  recordFileUpload.addChangeHandler(this);
  recordFileItemName = recordFileUpload.getFileItemName();
  uploadButton = new Button(Utils.constants.upload(), new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      recordFileUpload.submit();
    }
  });
  uploadButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());
  uploadButton.setEnabled(false);
  uploadTable = new FlexTable();
  Label uploadLabel = new Label(Utils.constants.uploadFromFile());
  uploadTable.setWidget(0, 0, uploadLabel);
  uploadTable.setWidget(0, 1, recordFileUpload);
  uploadTable.setWidget(0, 2, uploadButton);
  uploadTable.getFlexCellFormatter()
      .setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
  uploadTable.getFlexCellFormatter()
      .setVerticalAlignment(0, 2, HasVerticalAlignment.ALIGN_MIDDLE);
  table.setWidget(1, 0, uploadTable);
  setWidget(table);
  setUploadVisible(!readOnly);
  formDataLoader = new DefaultFormDataLoader();
}
项目:document-management-system    文件:FileUploadForm.java   
/**
 * addSubmitCompleteHandler
 *
 * @param submitCompleHandler
 */
public void addSubmitCompleteHandler(SubmitCompleteHandler submitCompleHandler) {
    uploadForm.addSubmitCompleteHandler(submitCompleHandler);
}
项目:wte4j    文件:TemplateUploadDisplay.java   
void addSubmitCompleteHandler(SubmitCompleteHandler handler);