com.vaadin.data.fieldgroup.FieldGroup Java Examples

The following examples show how to use com.vaadin.data.fieldgroup.FieldGroup. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContactForm.java    From spring-cloud-microservice-example with GNU General Public License v3.0 6 votes vote down vote up
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
    }
}
 
Example #2
Source File: ObadviceEditorWindow.java    From XACML with MIT License 4 votes vote down vote up
/**
	 * The constructor should first build the main layout, set the
	 * composition root and then do any custom initialization.
	 *
	 * The constructor will not be automatically regenerated by the
	 * visual editor.
	 * @param obad 
	 */
	public ObadviceEditorWindow(EntityItem<Obadvice> obad) {
		this.setContent(mainLayout);
		//
		// Save
		//
		this.obad = obad;
		//
		// Initialize main layout
		//
		this.mainLayout.setMargin(true);
		this.mainLayout.setWidth("-1px");
		//
		// Initialize components
		//
		this.typeOption.setNullSelectionAllowed(false);
		this.typeOption.setImmediate(true);
		this.typeOption.setDescription("Select whether this is an obligation or advice");
		this.typeOption.addItem("Obligation");
		this.typeOption.addItem("Advice");
		
		this.fulfillOption.setNullSelectionAllowed(true);
		this.fulfillOption.setDescription("Optionally restrict the use of the obligation/advice to a Permit or a Deny");
		this.fulfillOption.addItem("Permit");
		this.fulfillOption.addItem("Deny");

		this.descriptionField.setNullRepresentation("");
		
		this.expressionsField = new OaExpressionsField(this.obad);
		//
		// Add our form components
		//
		this.mainLayout.addComponent(this.typeOption);
		this.mainLayout.addComponent(this.fulfillOption);
		this.mainLayout.addComponent(this.xacmlID);
		this.mainLayout.addComponent(this.descriptionField);
		this.mainLayout.addComponent(this.expressionsField);
//		this.mainLayout.addComponent(this.tableExpressions);
		this.mainLayout.addComponent(this.saveButton);
		//
		// Now bind those fields to the data
		//
		this.fieldGroup = new FieldGroup(obad);
		this.fieldGroup.bindMemberFields(this);
		//
		// Finish setting up
		//
		this.initializeButtons();
		this.initializeOptions();
		//
		// Set focus
		//
		this.xacmlID.focus();
	}