All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.uqbar.arena.tests.nestedCombos.NestedCombosDomain Maven / Gradle / Ivy

There is a newer version: 3.6.3
Show newest version
package org.uqbar.arena.tests.nestedCombos;
 
import java.util.ArrayList;
import java.util.List;

import org.uqbar.commons.model.annotations.Observable;

@Observable
public class NestedCombosDomain {
	private Country country;
	private Province province;
	private List possibleCountries = new ArrayList();
	private List possibleProvinces = new ArrayList();
	private int times = 0;

	public NestedCombosDomain() {
		this.country = this.addCountry("Argentina", "Buenos Aires", "Córdoba", "Santa Fé");
		this.addCountry("Bolivia", "Cochabamba", "Potosí", "La Paz");
	}

	public void deleteProvince() {
		this.possibleProvinces.remove(this.province);
	}

	public void changed() {
		this.times++;
	}

	public Country addCountry(String name, String... provinces) {
		Country country = new Country(name);
		for (String provinceName : provinces) {
			country.addProvince(provinceName);
		}
		this.possibleCountries.add(country);
		return country;
	}

	public Country getCountry() {
		return country;
	}

	public void setCountry(Country country) {
		this.country = country;
		this.possibleProvinces = country.provinces();
	}

	public Province getProvince() {
		return province;
	}

	public void setProvince(Province province) {
		this.province = province;
	}

	public List getPossibleCountries() {
		return possibleCountries;
	}

	public void setPossibleCountries(List possibleCountries) {
		this.possibleCountries = possibleCountries;
	}

	public List getPossibleProvinces() {
		return possibleProvinces;
	}

	public void setPossibleProvinces(List possibleProvinces) {
		this.possibleProvinces = possibleProvinces;
	}

	public int getTimes() {
		return times;
	}

	public void setTimes(int times) {
		this.times = times;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy