package info.bukova.isspst.ui.buildings;

import info.bukova.isspst.data.Building;
import info.bukova.isspst.data.Room;
import info.bukova.isspst.ui.FormViewModel;

import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;

public class BuildingForm extends FormViewModel<Building> {
	
	@Init(superclass = true)
	public void init() {
		
	}
	
	@Command
	@NotifyChange("dataBean")
	public void addRoom() {
		Room r = new Room();
		getDataBean().addRoom(r);
	}
	
	@Command
	@NotifyChange("dataBean")
	public void removeRoom(@BindingParam("room") Room room) {
		getDataBean().getRooms().remove(room);
	}

}
