Java Code Examples for com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler

The following are top voted examples for showing how to use com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: qafe-platform   File: EventFactory.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 2
Project: wte4j   File: TemplateUploadFormPanel.java   Source Code and License 4 votes vote down vote up
@Override
public void addSubmitCompleteHandler(SubmitCompleteHandler handler) {
	formPanel.addSubmitCompleteHandler(handler);
}
 
Example 3
Project: scheduling-portal   File: SubmitWindow.java   Source Code and License 4 votes vote down vote up
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();
        }
    };
}
 
Example 4
Project: kaa   File: RecordPanel.java   Source Code and License 4 votes vote down vote up
/**
 * 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();
}
 
Example 5
Project: document-management-system   File: FileUploadForm.java   Source Code and License 2 votes vote down vote up
/**
 * addSubmitCompleteHandler
 *
 * @param submitCompleHandler
 */
public void addSubmitCompleteHandler(SubmitCompleteHandler submitCompleHandler) {
	uploadForm.addSubmitCompleteHandler(submitCompleHandler);
}
 
Example 6
Project: wte4j   File: TemplateUploadDisplay.java   Source Code and License votes vote down vote up
void addSubmitCompleteHandler(SubmitCompleteHandler handler);