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

项目:blogwt    文件:EditPostPage.java   
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();
    }
}
项目:blogwt    文件:EditPostPage.java   
@UiHandler({ "btnSaveAndShow", "btnSave" })
void onBtnSubmitClicked (ClickEvent e) {
    save((SubmitButton) e.getSource());
}