com.save.area.ProvincePropertyChangeListener.java Source code

Java tutorial

Introduction

Here is the source code for com.save.area.ProvincePropertyChangeListener.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.save.area;

import com.save.common.CommonComboBox;
import com.save.service.AreaService;
import com.save.area.serviceprovider.AreaServiceImpl;
import com.vaadin.data.Property;
import com.vaadin.ui.ComboBox;

/**
 *
 * @author jetdario
 */
public class ProvincePropertyChangeListener implements ComboBox.ValueChangeListener {

    AreaService as = new AreaServiceImpl();

    ComboBox city;

    public ProvincePropertyChangeListener(ComboBox city) {
        this.city = city;
    }

    @Override
    public void valueChange(Property.ValueChangeEvent event) {
        if (event.getProperty().getValue() == null) {
        } else {
            CommonComboBox.citiesByProvinceId((int) event.getProperty().getValue(), getCity());
        }
    }

    ComboBox getCity() {
        return city;
    }

}