// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
package demo;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean
@RequestScoped
public class Test {
    // form fields
    private Integer f1;
    private String f2;
    private String f3;
    public Integer getF1() {
        return f1;
    }
    public void setF1(Integer f1) {
        this.f1 = f1;
    }
    public String getF2() {
        return f2;
    }
    public void setF2(String f2) {
        this.f2 = f2;
    }
    public String getF3() {
        return f3;
    }
    public void setF3(String f3) {
        this.f3 = f3;
    }
    // options list
    public List<String> getOptions() {
        List<String> res = new ArrayList<String>();
        res.add("");
        res.add(T1.VER);
        res.add(T1.NOTVER);
        return res;
    }
    // show data
    public List<T1> getData() {
        return DB.getAll();
    }
    // form submit
    public void save() {
        DB.saveOne(new T1(f1, f2, f3));
    }
}
