package rich;

import java.util.ArrayList;

import org.richfaces.VersionBean;

public class RichBean {
	private static final String EXT = ".jsp";
	private String version = VersionBean.SCM_REVISION;
	private String src;
	private MapComponent map;
	private boolean reComponent;
	private boolean reProperty;
	private boolean reStraightforward;
	//private String [] menu = {"Blank", "Calendar", "DataFilterSlider", "DataScroller", "DataTable", "DragAndDrop", "DropDownMenu", "Effect", "Gmap", "InputNumberSlider", "InputNumberSpinner", "Insert", "Message", "ModalPanel", "Paint2D", "Panel", "Panel2", "PanelBar", "PanelMenu", "Separator", "SimpleTogglePanel", "Spacer", "SuggestionBox", "TabPanel", "TogglePanel", "ToolBar", "Tooltip", "Tree", "VirtualEarth", "ScrollableDataTable", "jQuery", "OrderingList"};
	
	public RichBean() {
		src = "Blank";
		reComponent = true;
		reProperty = true;
		reStraightforward = true;
		map = new MapComponent();
		// map.add( value,  add(  pages_path/name_pages, array<boolean>(Property, Straightforward) );
		map.add("Blank", add("/pages/Blank/Blank", new boolean [] {true, true}));
		map.add("Calendar", add("/Calendar/Calendar", new boolean [] {true, true}));
		map.add("DataFilterSlider", add("/DataFilterSlider/DataFilterSlider", new boolean [] {true, false}));
		map.add("DataScroller", add("/DataScroller/DataScroller", new boolean [] {true, true}));
		map.add("DataTable", add("/DataTable/DataTable", new boolean [] {true, true}));
		map.add("DragAndDrop", add("/DragAndDrop/DragAndDrop", new boolean [] {false, false}));
		map.add("DropDownMenu", add("/DropDownMenu/DropDownMenu", new boolean [] {true, true}));
		map.add("Effect", add("/Effect/Effect", new boolean [] {false, false}));
		map.add("Gmap", add("/Gmap/Gmap", new boolean [] {true, false}));
		map.add("InputNumberSlider", add("/InputNumberSlider/InputNumberSlider", new boolean [] {true, true}));
		map.add("InputNumberSpinner", add("/InputNumberSpinner/InputNumberSpinner", new boolean [] {true, true}));
		map.add("Insert", add("/Insert/Insert", new boolean [] {true, false}));
		map.add("Message", add("/Message/Message", new boolean [] {true, true}));
		map.add("ModalPanel", add("/ModalPanel/ModalPanel", new boolean [] {true, true}));
		map.add("Paint2D", add("/Paint2D/Paint2D", new boolean [] {true, true}));
		map.add("Panel", add("/Panel/Panel", new boolean [] {true, true}));
		map.add("Panel2", add("/Panel/Panel2", new boolean [] {false, false}));
		map.add("PanelBar", add("/PanelBar/PanelBar", new boolean [] {true, true}));
		map.add("PanelMenu", add("/PanelMenu/PanelMenu", new boolean [] {true, true}));
		map.add("Separator", add("/Separator/Separator", new boolean [] {true, true}));
		map.add("SimpleTogglePanel", add("/SimpleTogglePanel/SimpleTogglePanel", new boolean [] {true, true}));
		map.add("Spacer", add("/Spacer/Spacer", new boolean [] {true, true}));
		map.add("SuggestionBox", add("/SuggestionBox/SuggestionBox", new boolean [] {true, true}));
		map.add("TabPanel", add("/TabPanel/TabPanel", new boolean [] {true, true}));
		map.add("TogglePanel", add("/TogglePanel/TogglePanel", new boolean [] {true, true}));
		map.add("ToolBar", add("/ToolBar/ToolBar", new boolean [] {true, false}));
		map.add("Tooltip", add("/Tooltip/Tooltip", new boolean [] {true, true}));
		map.add("Tree", add("/Tree/Tree", new boolean [] {true, false}));
		map.add("VirtualEarth", add("/VirtualEarth/VirtualEarth", new boolean [] {true, false}));
		map.add("ScrollableDataTable", add("/ScrollableDataTable/ScrollableDataTable", new boolean [] {true, false}));
		map.add("jQuery", add("/jQuery/jQuery", new boolean [] {false, false}));
		map.add("OrderingList", add("/OrderingList/OrderingList", new boolean [] {true, true}));
		map.add("DataDefinitionList", add("/DataDefinitionList/DataDefinitionList", new boolean [] {true, false}));
		map.add("DataOrderedList", add("/DataOrderedList/DataOrderedList", new boolean [] {true, false}));
		map.add("ContextMenu", add("/ContextMenu/ContextMenu", new boolean [] {true, false}));
		map.add("ListShuttle", add("/ListShuttle/ListShuttle", new boolean [] {true, true}));
		map.add("ComponentControl", add("/ComponentControl/ComponentControl", new boolean [] {false, false}));
	}
	
	public String getSrc() {
		return src;
	}

	public String getPathComponent() {
		return map.get(src).get(0);
	}
	
	public String getPathProperty() {
		return map.get(src).get(1);
	}
	
	public String getPathStraightforward() {
		return map.get(src).get(2);
	}
	
	public void setSrc(String src) {
		this.src = src;
	}
	
	private ArrayList<String> add(String path, boolean [] arr){
		ArrayList<String> list = new ArrayList<String>();
		list.add(path + EXT);
		if(arr[0]) list.add(path + "Property" + EXT); else list.add("/pages/Blank/BlankProperty"  + EXT);
		if(arr[1]) list.add(path + "Straightforward" + EXT); else list.add("/pages/Blank/BlankStraightforward" + EXT);
		return list;
	}

	public boolean isReComponent() {
		return reComponent;
	}

	public void setReComponent(boolean reComponent) {
		this.reComponent = reComponent;
	}

	public boolean isReProperty() {
		return reProperty;
	}

	public void setReProperty(boolean reProperty) {
		this.reProperty = reProperty;
	}

	public boolean isReStraightforward() {
		return reStraightforward;
	}

	public void setReStraightforward(boolean reStraightforward) {
		this.reStraightforward = reStraightforward;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}
}
