org.uqbar.arena.tests.nestedCombos.NestedCombosDomain Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of arena-examples Show documentation
Show all versions of arena-examples Show documentation
Ejemplos básicos y tests del framework Arena
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