Java Code Examples for com.google.gwt.user.client.ui.SubmitButton

The following are top voted examples for showing how to use com.google.gwt.user.client.ui.SubmitButton. 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: blogwt   File: EditPostPage.java   Source Code and License 5 votes vote down vote up
private void save (SubmitButton source) {
	if (isValid()) {
		saveAndShow = (source == btnSaveAndShow);

		if (changes > 0) {
			changesAtSave = changes;

			if (post == null) {
				PostController.get().createPost(txtTitle.getValue(),
						cbxDirectOnly.getValue().booleanValue()
								? Boolean.FALSE
								: Boolean.TRUE,
						cbxComments.getValue(), txtSummary.getValue(),
						txtContent.getValue(), cbxPublish.getValue(),
						txtTags.getValue());
			} else {
				PostController.get().updatePost(post, txtTitle.getValue(),
						cbxDirectOnly.getValue().booleanValue()
								? Boolean.FALSE
								: Boolean.TRUE,
						cbxComments.getValue(), txtSummary.getValue(),
						txtContent.getValue(), cbxPublish.getValue(),
						txtTags.getValue());
			}

			submitting();
		} else {
			restoreFocus();

			if (saveAndShow) {
				PageTypeHelper.show(PageType.PostDetailPageType,
						PostHelper.slugify(txtTitle.getValue()));
			}
		}
	} else {
		showErrors();
	}
}
 
Example 2
Project: blogwt   File: EditPostPage.java   Source Code and License 4 votes vote down vote up
@UiHandler({ "btnSaveAndShow", "btnSave" })
void onBtnSubmitClicked (ClickEvent e) {
	save((SubmitButton) e.getSource());
}