/**
* This file is part of Rydia.
*
* Rydia is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Rydia is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Rydia. If not, see <http://www.gnu.org/licenses/>.
**/
package org.rydia.client;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.ClickListener;
/**
* <u><b><font color="red">FOR INTERNAL USE ONLY.</font></b></u>
* Copyright (c)2007, Daniel Kaplan
*
* @author Daniel Kaplan
* @since 7.11.6
*/
public class CheckboxRenderer extends Question{
public CheckboxRenderer(String [] state, int row, Rydia.ChangeListener changeListener) {
super(state, row, changeListener);
}
public Widget getColumn2() {
final CheckBox cb = new CheckBox();
cb.setEnabled(isEnabled());
cb.setChecked(state[ANSWER].equals("checked"));
cb.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
reactToChange(cb.isChecked() ? "checked" : "unchecked");
}
});
return cb;
}
}