本文整理汇总了Java中com.vaadin.data.fieldgroup.FieldGroup类的典型用法代码示例。如果您正苦于以下问题:Java FieldGroup类的具体用法?Java FieldGroup怎么用?Java FieldGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldGroup类属于com.vaadin.data.fieldgroup包,在下文中一共展示了FieldGroup类的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: uploadSucceeded
import com.vaadin.data.fieldgroup.FieldGroup; //导入依赖的package包/类
@Override
public void uploadSucceeded(Upload.SucceededEvent event) {
try {
image = baos.toByteArray();
binder.commit();
document = binder.getItemDataSource().getBean();
document.setUpdateDate(new Date());
document.setName(document.getId() != null ? document.getName() : filename);
document.setBody(image);
document.setMime(document.getId() != null ? document.getMime() : mimeType);
document.setSize(image.length);
binder.setItemDataSource(document);
checkVisibility();
} catch (FieldGroup.CommitException ex) {
Logger.getLogger(DocumentFormLayout.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
}
}
示例6: InfoPanel
import com.vaadin.data.fieldgroup.FieldGroup; //导入依赖的package包/类
public InfoPanel(BeanItem<Invoice> invoiceBean) {
this.invoiceBean = invoiceBean;
Address companyAddress = invoiceBean.getBean().getCompany();
Address customerAddress = invoiceBean.getBean().getCustomer();
customerBean = new BeanItem<Address>(customerAddress);
companyBean = new BeanItem<Address>(companyAddress);
customerFieldGroup = new FieldGroup(customerBean);
companyFieldGroup = new FieldGroup(companyBean);
invoiceInfoFieldGroup = new FieldGroup(this.invoiceBean);
initComponents();
doBind();
setValidators();
setLayout();
}
示例7: 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());
}
}
示例8: 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());
}
}
示例9: bindTagField
import com.vaadin.data.fieldgroup.FieldGroup; //导入依赖的package包/类
public <T extends BaseEntity, L> TokenField bindTagField(final AbstractLayout form, final FieldGroup group,
final Selected<T> selected, final String fieldLabel, final String fieldName)
{
final TokenField field = new SplitTagField<T>(fieldLabel, false);
field.setWidth("100%"); // width...
field.setInputWidth("100%"); // and input width separately
field.setFilteringMode(FilteringMode.CONTAINS); // suggest
field.setTokenCaptionPropertyId(Tag_.name.getName());
field.setInputPrompt("Enter one or more comma separated tags");
field.setRememberNewTokens(false); // we can opt to do this ourselves
field.setImmediate(true);
if (group != null)
{
group.bind(field, fieldName);
}
form.addComponent(field);
return field;
}
示例10: saveEditor
import com.vaadin.data.fieldgroup.FieldGroup; //导入依赖的package包/类
@Override
public void saveEditor() throws FieldGroup.CommitException {
try {
editorSaving = true;
commitEditor();
} finally {
editorSaving = false;
}
}
示例11: 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);
}
}
示例12: 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);
}
}
示例13: 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;
}
示例14: 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;
}
示例15: 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);
}
}