62 lines
1.4 KiB
Java
62 lines
1.4 KiB
Java
/**
|
|
*
|
|
*/
|
|
package org.gcube.portlets.user.dataminermanager.client.form;
|
|
|
|
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.EnumParameter;
|
|
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.Parameter;
|
|
|
|
import com.google.gwt.user.client.ui.Widget;
|
|
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
|
import com.sencha.gxt.data.shared.StringLabelProvider;
|
|
import com.sencha.gxt.widget.core.client.form.SimpleComboBox;
|
|
|
|
/**
|
|
*
|
|
* @author Giancarlo Panichi
|
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
*
|
|
*/
|
|
public class EnumFld extends AbstractFld {
|
|
|
|
private SimpleComboBox<String> listBox;
|
|
|
|
/**
|
|
* @param parameter
|
|
*/
|
|
public EnumFld(Parameter parameter) {
|
|
super(parameter);
|
|
|
|
EnumParameter p = (EnumParameter) parameter;
|
|
|
|
listBox = new SimpleComboBox<String>(new StringLabelProvider<>());
|
|
listBox.add(p.getValues());
|
|
listBox.setAllowBlank(false);
|
|
listBox.setForceSelection(true);
|
|
listBox.setEditable(false);
|
|
listBox.setTriggerAction(TriggerAction.ALL);
|
|
if (p.getDescription() != null)
|
|
listBox.setTitle(p.getDescription());
|
|
if (p.getDefaultValue() != null)
|
|
listBox.setValue(p.getDefaultValue());
|
|
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
@Override
|
|
public String getValue() {
|
|
return listBox.getCurrentValue();
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
@Override
|
|
public Widget getWidget() {
|
|
return listBox;
|
|
}
|
|
|
|
}
|