本文整理汇总了Java中com.vaadin.data.fieldgroup.FieldGroup.CommitException方法的典型用法代码示例。如果您正苦于以下问题:Java FieldGroup.CommitException方法的具体用法?Java FieldGroup.CommitException怎么用?Java FieldGroup.CommitException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.data.fieldgroup.FieldGroup
的用法示例。
在下文中一共展示了FieldGroup.CommitException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
public void save(Button.ClickEvent event) {
try {
// Commit the fields from UI to DAO
formFieldBindings.commit();
// Save DAO to backend with direct synchronous service API
getUI().userClient.createUser(contact);
String msg = String.format("Saved '%s %s'.",
contact.getFirstName(),
contact.getLastName());
Notification.show(msg, Type.TRAY_NOTIFICATION);
getUI().refreshContacts();
} catch (FieldGroup.CommitException e) {
// Validation exceptions could be shown here
}
}
示例2: commitEditor
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
protected void commitEditor() throws FieldGroup.CommitException {
if (!isEditorBuffered()) {
// Not using buffered mode, nothing to do
return;
}
try {
fireEditorPreCommitEvent();
Map<Field<?>, Validator.InvalidValueException> invalidValueExceptions = commitFields();
if (invalidValueExceptions.isEmpty()) {
fireEditorPostCommitEvent();
} else {
throw new FieldGroup.FieldGroupInvalidValueException(invalidValueExceptions);
}
} catch (Exception e) {
throw new FieldGroup.CommitException("Commit failed", null, e);
}
}
示例3: buttonClick
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
@Override
public void buttonClick(Button.ClickEvent event) {
if (event.getButton().equals(btnClose)) {
close();
} else if (event.getButton().equals(btnShowMore)) {
xTextField.setVisible(!xTextField.isVisible());
yTextField.setVisible(!yTextField.isVisible());
} else if (event.getButton().equals(btnOk)) {
try {
// check transition name uniqueness
if (!processModelLayout.getActiveElement().getTransitionModel().getName().equalsIgnoreCase(nameTextField.getValue())
&& processModelLayout.getProcessModel().getTransitionModelByName(nameTextField.getValue()) != null) {
throw new Validator.InvalidValueException("Transition name already exists!");
}
fieldGroup.commit();
close();
} catch (Validator.InvalidValueException | FieldGroup.CommitException ex) {
ex.printStackTrace();
Notification.show(("error"), ex.getMessage(), Notification.Type.ERROR_MESSAGE);
}
}
}
示例4: getInternalValue
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
@Override
protected List getInternalValue() {
List<FieldModel> result = new ArrayList<>();
for (Component comp : form) {
if (comp instanceof ParameterForm) {
ParameterForm parameterForm = (ParameterForm) comp;
try {
parameterForm.commit();
} catch (FieldGroup.CommitException ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
}
result.add(parameterForm.getFieldModel());
}
}
return result;
}
示例5: preCommit
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
@Override
public void preCommit(FieldGroup.CommitEvent commitEvent) throws FieldGroup.CommitException {
for (Object propertyId : fieldGroup.getBoundPropertyIds()) {
fieldGroup.getField(propertyId).removeStyleName("errorField");
}
StringBuilder errorMsg = new StringBuilder();
int violationCount = 0;
for (Field<?> f : commitEvent.getFieldBinder().getFields()) {
try {
if (f instanceof CustomField) {
continue;
}
f.validate();
} catch (com.vaadin.data.Validator.InvalidValueException e) {
violationCount++;
errorMsg.append(e.getHtmlMessage()).append("<br/>");
f.addStyleName("errorField");
}
}
if (violationCount > 0) {
throw new FieldGroup.CommitException(errorMsg.toString());
}
}
示例6: postCommit
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
@Override
public void postCommit(FieldGroup.CommitEvent commitEvent) throws FieldGroup.CommitException {
Set<ConstraintViolation<B>> violations = validation.validate(attachForm.getBean());
if (violations.size() > 0) {
StringBuilder errorMsg = new StringBuilder();
for (ConstraintViolation violation : violations) {
errorMsg.append(violation.getMessage()).append("<br/>");
Path propertyPath = violation.getPropertyPath();
if (propertyPath != null && !propertyPath.toString().equals("")) {
fieldGroup.getField(propertyPath.toString()).addStyleName("errorField");
} else {
Annotation validateAnno = violation.getConstraintDescriptor().getAnnotation();
if (validateAnno instanceof DateComparison) {
String firstDateField = ((DateComparison) validateAnno).firstDateField();
String lastDateField = ((DateComparison) validateAnno).lastDateField();
fieldGroup.getField(firstDateField).addStyleName("errorField");
fieldGroup.getField(lastDateField).addStyleName("errorField");
}
}
}
throw new FieldGroup.CommitException(errorMsg.toString());
}
}
示例7: saveEditor
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
@Override
public void saveEditor() throws FieldGroup.CommitException {
try {
editorSaving = true;
commitEditor();
} finally {
editorSaving = false;
}
}
示例8: save
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
public void save() {
try {
fieldGroup.commit();
this.processModelLayout.getActiveElement().getTaskModel().getInParameters().clear();
this.processModelLayout.getActiveElement().getTaskModel().getInParameters().putAll(design.inputInParametersLayout.getValues());
this.processModelLayout.getActiveElement().getTaskModel().getOutParameters().clear();
this.processModelLayout.getActiveElement().getTaskModel().getOutParameters().putAll(design.outputOutParametersLayout.getValues());
} catch (Validator.InvalidValueException | FieldGroup.CommitException ex) {
ex.printStackTrace();
Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
}
}
示例9: save
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
private void save() {
try {
preferences.commit();
module.setCode(preferences.getItemDataSource().getBean().getQuery());
module.setDesign(HybridbpmCoreUtil.objectToJson(preferences.getItemDataSource().getBean()));
module = HybridbpmUI.getDevelopmentAPI().saveModule(module);
} catch (FieldGroup.CommitException ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
}
}
示例10: getTabDefinition
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
public TabDefinition getTabDefinition() {
try {
binder.commit();
return binder.getItemDataSource().getBean();
} catch (FieldGroup.CommitException ex) {
Logger.getLogger(TabConfigurationLayout.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
}
return null;
}
示例11: getViewDefinition
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
public ViewDefinition getViewDefinition() {
try {
binder.commit();
return binder.getItemDataSource().getBean();
} catch (FieldGroup.CommitException ex) {
Logger.getLogger(ViewConfigurationLayout.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
}
return null;
}
示例12: save
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
public void save() {
try {
/* generated commits start */
beanFieldGroup.commit();
beanFieldGroup.setItemDataSource(HybridbpmUI.getCrudAPI().save(beanFieldGroup.getItemDataSource().getBean()));
/* generated commits end */
} catch (FieldGroup.CommitException ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
}
}
示例13: save
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
public void save() {
try {
binder.commit();
HybridbpmUI.getAccessAPI().saveGroup(binder.getItemDataSource().getBean());
} catch (FieldGroup.CommitException ex) {
Logger.getLogger(GroupLayout.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
}
}
示例14: save
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
public void save() {
try {
binder.commit();
HybridbpmUI.getAccessAPI().saveRole(binder.getItemDataSource().getBean());
} catch (FieldGroup.CommitException ex) {
Logger.getLogger(RoleLayout.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
}
}
示例15: getParameter
import com.vaadin.data.fieldgroup.FieldGroup; //导入方法依赖的package包/类
public Parameter getParameter() {
try {
binder.commit();
return binder.getItemDataSource().getBean();
} catch (FieldGroup.CommitException ex) {
Logger.getLogger(SystemParameterLayout.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
}
return null;
}