/*
 * $URL$
 * $Revision$
 * $LastChangedBy$
 * $LastChangedDate$
 *
 * Copyright (c) 2005 syseca AG, Switzerland
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of syseca AG. ("Confidential Information"). You shall not
 * disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you
 * entered into with syseca AG.
 */
package ch.spherIC.components;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.Spinner;


/**
 * XSpinner class with special functionality
 */
public class XSpinner extends Spinner {

    /**
     * Creates a new XSpinner object.
     *
     * @param  context {@link Context}
     */
    public XSpinner(Context context) {
        super(context);
    }

    /**
     * Creates a new XSpinner object.
     *
     * @param  context {@link Context}
     * @param  attrs {@link AttributeSet}
     */
    public XSpinner(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    /**
     * Creates a newXSpinner object.
     *
     * @param  context {@link Context}
     * @param  attrs {@link AttributeSet}
     * @param  defStyle  int
     */
    public XSpinner(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }


    /**
     * Sets the value of $param.name$
     *
     * @param  value  DOCUMENT ME!
     */
    public void setSelectionByVal(String value) {

        int count = getAdapter().getCount();

        for (int i = 0; i < count; i++) {
            if (getAdapter().getItem(i).toString().equals(value)) {
                setSelection(i);
                break;
            }
        }
    }

}
