package org.ajax4jsf.bean;

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

import javax.faces.event.ActionEvent;

import org.ajax4jsf.model.ListShuttleItem;

public class ListShuttleBean {
	private List<ListShuttleItem> items = null;
	private List<ListShuttleItem> freeItems = null;
	private boolean controlsVisible = true;
	public ListShuttleBean() {
		init();
	}
	
	private void init() {
		items = new ArrayList<ListShuttleItem>();
		freeItems = new ArrayList<ListShuttleItem>();
		for (int i = 0; i < 5; i++) {
			ListShuttleItem item = new ListShuttleItem(i + 1, "Item" + (i + 1));
			freeItems.add(item);
		}
		controlsVisible = true;
	}
	
	public void hide(ActionEvent event) {
		controlsVisible = false;
	}
	
	public void reset(ActionEvent event) {
		init();
	}
	
	public List<ListShuttleItem> getItems() {
		return items;
	}
	public void setItems(List<ListShuttleItem> items) {
		this.items = items;
	}

	public List<ListShuttleItem> getFreeItems() {
		return freeItems;
	}

	public void setFreeItems(List<ListShuttleItem> freeItems) {
		this.freeItems = freeItems;
	}

	/**
	 * @return the controlsVisible
	 */
	public boolean isControlsVisible() {
		return controlsVisible;
	}

	/**
	 * @param controlsVisible the controlsVisible to set
	 */
	public void setControlsVisible(boolean controlsVisible) {
		this.controlsVisible = controlsVisible;
	}
}
