package sb;

import java.util.*;

import org.richfaces.renderkit.html.SuggestionBoxRenderer;

public class Sb {

    private ArrayList cities;
    private ArrayList data;
    private ArrayList tokens;
    private int first;
    private String zindex;
    private String property;
    private String rows;
    private String cellspacing;
    private String cellpadding;
    private String minchars;
    private String frequency;
    private String rules;
    private String border;
    private String width;
    private String height;
    private String shadowOpacity;
    private String bgColor;
    private String shadowDepth;
    private boolean focus;
    private boolean check;
    private boolean reRender;

    private static final String[] cit = { "Abba", "Abbeville", "Acworth",
	    "Adairsville", "Adel", "Adrian", "Ailey", "Alamo", "Alapaha",
	    "Albany", "Allenhurst", "Alma", "Alma", "Alpharetta", "Alston",
	    "Amboy", "Ambrose", "Americus", "Appling", "Arlington", "Ashburn",
	    "Athens", "Athens-Clarke County", "Atkinson", "Atlanta",
	    "Attapulgus", "Auburn", "Augusta", "Augusta-Richmond County",
	    "Austell", "Avondale Estates", "Axson" };

    public Sb() {
	border = "1";
	width = "200";
	height = "150";
	shadowOpacity = "1";
	shadowDepth = Integer.toString(SuggestionBoxRenderer.SHADOW_DEPTH);
	reRender = true;
	zindex = "3";
	focus = true;
	rows = "0";
	first = 0;
	cellspacing = "2";
	cellpadding = "2";
	minchars = "1";
	frequency = "0";
	rules = "none";
	setCities(getAllData());
	// TODO Auto-generated constructor stub
    }

    public List autocomplete(Object event) {
	String pref = event.toString();
	ArrayList result = new ArrayList();

	Iterator iterator = getAllData().iterator();
	while (iterator.hasNext()) {
	    Data elem = (Data) iterator.next();
	    if ((elem != null && elem.getText().toLowerCase().indexOf(
		    pref.toLowerCase()) == 0)
		    || "".equals(pref)) {
		result.add(elem);
	    }
	}
	return result;
    }

    public ArrayList getCities() {
	return cities;
    }

    public void setCities(ArrayList cities) {
	this.cities = cities;
    }

    public ArrayList getAllData() {
	ArrayList result = new ArrayList();
	for (int i = 0; i < cit.length; i++) {
	    Data data = new Data(cit[i], String.valueOf(i + 1));
	    result.add(data);
	}
	return result;
    }

    public ArrayList getData() {
	return data;
    }

    public void setData(ArrayList data) {
	this.data = data;
    }

    public String getProperty() {
	return property;
    }

    public void setProperty(String property) {
	this.property = property;
    }

    public String getCellpadding() {
	return cellpadding;
    }

    public void setCellpadding(String cellpadding) {
	this.cellpadding = cellpadding;
    }

    public String getCellspacing() {
	return cellspacing;
    }

    public void setCellspacing(String cellspacing) {
	this.cellspacing = cellspacing;
    }

    public boolean isCheck() {
	return check;
    }

    public void setCheck(boolean check) {
	this.check = check;
    }

    public int getFirst() {
	return first;
    }

    public int getIntFirst() {
	return first;
    }

    public void setFirst(int first) {
	this.first = first;
    }

    public String getFrequency() {
	return frequency;
    }

    public double getDoubleFrequency() {
	return Double.parseDouble(getFrequency());
    }

    public void setFrequency(String frequency) {
	this.frequency = frequency;
    }

    public String getMinchars() {
	return minchars;
    }

    public void setMinchars(String minchars) {
	this.minchars = minchars;
    }

    public String getRows() {
	return rows;
    }

    public int getIntRows() {
	return Integer.parseInt(getRows());
    }

    public void setRows(String rows) {
	this.rows = rows;
    }

    public String getRules() {
	return rules;
    }

    public void setRules(String rules) {
	this.rules = rules;
    }

    public ArrayList getTokens() {
	return tokens;
    }

    public void setTokens(ArrayList tokens) {
	this.tokens = tokens;
    }

    public void OnSelect() {
	System.out.print("Onselect works!!!");

    }

    public String getBorder() {
	return border;
    }

    public void setBorder(String border) {
	this.border = border;
    }

    public String getHeight() {
	return height;
    }

    public void setHeight(String height) {
	this.height = height;
    }

    public String getShadowOpacity() {
	return shadowOpacity;
    }

    public void setShadowOpacity(String shadowOpacity) {
	this.shadowOpacity = shadowOpacity;
    }

    public String getWidth() {
	return width;
    }

    public void setWidth(String width) {
	this.width = width;
    }

    public String getBgColor() {
	return bgColor;
    }

    public void setBgColor(String bgColor) {
	this.bgColor = bgColor;
    }

    public boolean isFocus() {
	return focus;
    }

    public void setFocus(boolean focus) {
	this.focus = focus;
    }

    public String getZindex() {
	return zindex;
    }

    public void setZindex(String zindex) {
	this.zindex = zindex;
    }

    public String getShadowDepth() {
	return shadowDepth;
    }

    public void setShadowDepth(String shadowDepth) {
	this.shadowDepth = shadowDepth;
    }

    public boolean isReRender() {
	return reRender;
    }

    public void setReRender(boolean reRender) {
	this.reRender = reRender;
    }

}
