package widget;


/**
 * The Model (from the Model-View-Controller pattern)
 * for an AbstractButton.
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public abstract class AbstractButtonModel extends WidgetModel
{
    private boolean                 selected;
    protected String                actionCommand;


    /**
     * Constructor
     *
     * @param button  The button this controller belongs to
     * @param ac      The action command associated with  this button
     */
    public AbstractButtonModel(String ac)
    {
	this.actionCommand = ac;
	selected = false;
    }




    /**
     * Get the action command associated with this Button
     *
     * @return  The action command
     */
    public String getActionCommand()
    {
	return actionCommand;
    }






    /**
     * Is this ToggleButton selected?
     *
     * @return   true if selected, false otherwise
     */
    public boolean isSelected()
    {
	return selected;
    }





    /**
     * Set the action command associated with this Button
     *
     * @param ac    The action command
     */
    public void setActionCommand(String ac)
    {
	actionCommand = ac;
    }





    /**
     * Set whether this ToggleButton is selected
     *
     * @param selected   true to selected, false to de-select
     */
    public void setSelected(boolean selected)
    {
	this.selected = selected;
    }



}

