package org.ajax4jsf.bean;

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

import javax.faces.model.SelectItem;

public class InplaceSelectTestBean {

    private List<SelectItem> treeItems = new ArrayList<SelectItem>();

    private List<String> treeNames = Arrays.asList("Pine", "Birch", "Aspen", "Spruce", "Oak", "Maple", "Ash", "Lime");

    private String tree = "";

    /**
     * Gets value of tree field.
     * 
     * @return value of tree field
     */
    public String getTree() {
        return tree;
    }

    /**
     * Set a new value for tree field.
     * 
     * @param tree
     *                a new value for tree field
     */
    public void setTree(String tree) {
        this.tree = tree;
    }

    public InplaceSelectTestBean() {
        for (String treeName : treeNames) {
            treeItems.add(new SelectItem(treeName, treeName));
        }
    }

    /**
     * Gets value of treeItems field.
     * 
     * @return value of treeItems field
     */
    public List<SelectItem> getTreeItems() {
        return treeItems;
    }

}
