本文整理汇总了Java中com.vaadin.data.fieldgroup.FieldGroup.CommitException类的典型用法代码示例。如果您正苦于以下问题:Java CommitException类的具体用法?Java CommitException怎么用?Java CommitException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommitException类属于com.vaadin.data.fieldgroup.FieldGroup包,在下文中一共展示了CommitException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: commit
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
public final void commit()
{
try
{
// Validate all fields
qty.validate(); // throws InvalidValueException which will be handled on upper level
binder.commit();
updateSentStatus();
}
catch (final CommitException e)
{
Notification.show(i18n.get("DailyProductQtyReportView.error.InvalidValue"));
}
}
示例2: commit
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
public final void commit()
{
try
{
// Validate all fields
qty.validate(); // throws InvalidValueException which will be handled on upper level
binder.commit();
updateSentStatus();
}
catch (final CommitException e)
{
Notification.show(i18n.get("DailyProductQtyReportView.error.InvalidValue"));
}
}
示例3: initializeButtons
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
private void initializeButtons() {
this.saveButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
self.isSaved = true;
self.close();
} catch (CommitException e) {
e.printStackTrace();
}
}
});
}
示例4: saveEditor
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
@Override
public void saveEditor() throws CommitException {
super.saveEditor();
// check auto commit on save
if (isCommitOnSave()) {
requireDataSource().commit();
}
}
示例5: buildFooter
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
private Component buildFooter() {
HorizontalLayout footer = new HorizontalLayout();
footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
footer.setWidth(100.0f, Unit.PERCENTAGE);
Button ok = new Button("OK");
ok.addStyleName(ValoTheme.BUTTON_PRIMARY);
ok.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
// Updated user should also be persisted to database. But
// not in this demo.
Notification success = new Notification(
"Profile updated successfully");
success.setDelayMsec(2000);
success.setStyleName("bar success small");
success.setPosition(Position.BOTTOM_CENTER);
success.show(Page.getCurrent());
DashboardEventBus.post(new DashboardEvent.ProfileUpdatedEvent());
close();
} catch (CommitException e) {
Notification.show("Error while updating profile",
Type.ERROR_MESSAGE);
}
}
});
ok.focus();
footer.addComponent(ok);
footer.setComponentAlignment(ok, Alignment.TOP_RIGHT);
return footer;
}
示例6: buildFooter
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
private Component buildFooter() {
HorizontalLayout footer = new HorizontalLayout();
footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
footer.setWidth(100.0f, Unit.PERCENTAGE);
Button ok = new Button("OK");
ok.addStyleName(ValoTheme.BUTTON_PRIMARY);
ok.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
// Updated user should also be persisted to database. But
// not in this demo.
Notification success = new Notification(
"Profile updated successfully");
success.setDelayMsec(2000);
success.setStyleName("bar success small");
success.setPosition(Position.BOTTOM_CENTER);
success.show(Page.getCurrent());
DashboardEventBus.post(new ProfileUpdatedEvent());
close();
} catch (CommitException e) {
Notification.show("Error while updating profile",
Type.ERROR_MESSAGE);
}
}
});
ok.focus();
footer.addComponent(ok);
footer.setComponentAlignment(ok, Alignment.TOP_RIGHT);
return footer;
}
示例7: initializeButtons
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
protected void initializeButtons() {
this.grid.setComponentAlignment(this.buttonSave, Alignment.BOTTOM_CENTER);
this.buttonSave.setImmediate(true);
this.buttonSave.setEnabled(false);
this.buttonSave.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
try {
//
// Commit changes
//
self.fieldGroup.commit();
//
// Save
//
self.isSaved = true;
//
// We can close
//
self.close();
} catch (CommitException e) {
logger.warn("Couldn't commit, the save button should NOT be enabled.");
}
}
});
}
示例8: getSubmitButtonClickListener
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
/**
* @return
*/
private ClickListener getSubmitButtonClickListener() {
return new Button.ClickListener() {
/**
*
*/
private static final long serialVersionUID = 4846553077403712887L;
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
} catch (CommitException e) {
Map<Field<?>, InvalidValueException> invalidFields = e
.getInvalidFields();
// TODO handle it in a better way
for (Map.Entry<Field<?>, InvalidValueException> invalidField : invalidFields
.entrySet()) {
((AbstractField<?>) invalidField.getKey())
.setValidationVisible(true);
}
if (invalidFields.isEmpty()) {
// TODO Handle this error
e.printStackTrace();
Notification.show("Save failed, Please try again");
}
}
}
};
}
示例9: onSaveButtonClick
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
private void onSaveButtonClick() {
if (flightFieldGroup.isValid()) {
try {
flightFieldGroup.commit();
} catch (CommitException e) {
Notification.show(e.getMessage(), Type.ERROR_MESSAGE);
}
Flight flight = flightFieldGroup.getItemDataSource().getBean();
travelService.saveFlight(flight);
flightFieldGroup.setItemDataSource(new Flight());
refreshFlightTable();
}
}
示例10: PreferencesDialog
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
public PreferencesDialog() {
super("Preferences"); // Set window caption
center();
setClosable(true);
setModal(true);;
setResizable(false);
FormLayout layout = new FormLayout();
// Form for editing the bean
final BeanFieldGroup<UserData> binder =
new BeanFieldGroup<UserData>(UserData.class);
UserData userData = ((AnalyzerUI)UI.getCurrent()).getUserData();
binder.setItemDataSource(userData);
layout.addComponent(binder.buildAndBind("Repository", "repository"));
// Buffer the form content
binder.setBuffered(true);
layout.addComponent(new Button("Save", new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
try {
binder.commit();
close();
} catch (CommitException e) {
}
}
}));
setContent(layout);
}
示例11: commit
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
@Override
public void commit() throws CommitException
{
fieldGroup.commit();
for (IModuleConfigForm form: allForms)
form.commit();
}
示例12: getConfiguration
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
@Override
public DistributionMetadataConfig_V1 getConfiguration() throws DPUConfigException {
try {
if (binder.isValid()) {
binder.commit();
} else {
throw new DPUConfigException(ctx.tr(this.getClass().getSimpleName() + ".validation.exception"));
}
} catch (CommitException ex) {
throw new DPUConfigException(ctx.tr(this.getClass().getSimpleName() + ".validation.exception"));
}
return binder.getItemDataSource().getBean();
}
示例13: getConfiguration
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
@Override
public RdfGraphMergerConfig_V1 getConfiguration() throws DPUConfigException {
try {
if (binder.isValid()) {
binder.commit();
} else {
throw new DPUConfigException(ctx.tr(this.getClass().getSimpleName() + ".validation.exception"));
}
} catch (CommitException ex) {
throw new DPUConfigException(ctx.tr(this.getClass().getSimpleName() + ".validation.exception"));
}
return binder.getItemDataSource().getBean();
}
示例14: setActionListeners
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
private void setActionListeners() {
createButton.addClickListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
try {
commitFields();
createPdf();
titlePanel.setLink(controller.getPdfFile());
} catch (CommitException e) {
e.printStackTrace();
}
}
});
}
示例15: buttonClick
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; //导入依赖的package包/类
@Override
public void buttonClick(ClickEvent event) {
try {
binder.commit();
Account account = binder.getItemDataSource().getBean();
mvpPresenterHandlers.tryCreateAccount(account);
} catch (CommitException e) {
username.setValidationVisible(true);
password.setValidationVisible(true);
firstName.setValidationVisible(true);
lastName.setValidationVisible(true);
}
}