Package org.vaadin.addon.customfield.demo

Source Code of org.vaadin.addon.customfield.demo.AddressFormExample

package org.vaadin.addon.customfield.demo;

import org.vaadin.addon.customfield.demo.data.Address;
import org.vaadin.addon.customfield.demo.data.City;
import org.vaadin.addon.customfield.demo.field.AddressField;

import com.vaadin.ui.Component;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;

/**
* Demonstrate a custom field which is a form, and contains another custom field
* for the selection of a city.
*/
public class AddressFormExample extends CustomComponent implements Component {

    private VerticalLayout layout;

    public AddressFormExample() {
        layout = new VerticalLayout();
        layout.setMargin(true);

        layout.addComponent(new Label("Custom field for editing an Address"));

        Address address = new Address("Ruukinkatu 2-4", "20540", City.TURKU);
        AddressField field = new AddressField();
        field.setValue(address);
        layout.addComponent(field);

        setCompositionRoot(layout);
    }

}
TOP

Related Classes of org.vaadin.addon.customfield.demo.AddressFormExample

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.