<commit_before>package ch.brueesch.crm.address;


import ch.brueesch.crm.company.Company;
import ch.brueesch.crm.company.CompanyRepository;
import com.vaadin.annotations.Theme;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.event.ShortcutAction;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.*;
import com.vaadin.ui.themes.ValoTheme;
import org.springframework.beans.factory.annotation.Autowired;

@SpringUI(path = "address")
@Theme("valo")
public class AddressUI extends UI {

    private final AddressRepository addressRepository;

    private TextField street = new TextField("Street");
    private TextField secondStreet = new TextField("Second Street");
    private TextField zip = new TextField("Zip");
    private TextField city = new TextField("City");
    private TextField country = new TextField("Country");
    private Button save = new Button("Save");

    @Autowired
    public AddressUI(AddressRepository addressRepository) {
        this.addressRepository = addressRepository;
    }

    @Override
    protected void init(VaadinRequest request) {
        save.addClickListener(e -> this.save());
        HorizontalLayout buttons = new HorizontalLayout(save);
        buttons.setSpacing(true);
        save.setStyleName(ValoTheme.BUTTON_PRIMARY);
        save.setClickShortcut(ShortcutAction.KeyCode.ENTER);

        addComponents(street, secondStreet, zip, city, country);
    }

    private void save() {

    }
}<commit_msg>First Address UI<commit_after>package ch.brueesch.crm.address;


import ch.brueesch.crm.company.Company;
import ch.brueesch.crm.company.CompanyRepository;
import com.vaadin.annotations.Theme;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.event.ShortcutAction;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.*;
import com.vaadin.ui.themes.ValoTheme;
import org.springframework.beans.factory.annotation.Autowired;

@SpringUI(path = "address")
@Theme("valo")
public class AddressUI extends UI {

    private final AddressRepository addressRepository;

    private TextField street = new TextField("Street");
    private TextField secondStreet = new TextField("Second Street");
    private TextField zip = new TextField("Zip");
    private TextField city = new TextField("City");
    private TextField country = new TextField("Country");
    private Button save = new Button("Save");

    @Autowired
    public AddressUI(AddressRepository addressRepository) {
        this.addressRepository = addressRepository;
    }

    @Override
    protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        save.addClickListener(e -> this.save());
        HorizontalLayout buttons = new HorizontalLayout(save);
        buttons.setSpacing(true);
        save.setStyleName(ValoTheme.BUTTON_PRIMARY);
        save.setClickShortcut(ShortcutAction.KeyCode.ENTER);

        Grid table = new Grid();
        BeanItemContainer<Address> container = new BeanItemContainer<Address>(Address.class, addressRepository.findAll());
        table.setContainerDataSource(container);

        layout.addComponents(street, secondStreet, zip, city, country, save, table);
        setContent(layout);
    }

    private void save() {

        Address address = new Address()
                .setCity(city.getValue())
                .setCountry(country.getValue())
                .setSecondStreet(secondStreet.getValue())
                .setStreet(street.getValue())
                .setZip(zip.getValue());

        addressRepository.save(address);



    }
}
{'fraction_non_alphanumeric': 0.10410437618918185, 'fraction_numerical': 0.0, 'mean_word_length': 3.823066841415465, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4895475', 'n_tokens_mistral': 1055, 'n_tokens_neox': 979, 'n_words': 216}