本文整理汇总了Java中com.vaadin.ui.ComboBox.addItem方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.addItem方法的具体用法?Java ComboBox.addItem怎么用?Java ComboBox.addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.ComboBox
的用法示例。
在下文中一共展示了ComboBox.addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEditFields
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
protected ComponentContainer createEditFields() {
final ExtaFormLayout form = new ExtaFormLayout();
appTitleField = new EditField("Заголовок приложения");
form.addComponent(appTitleField);
iconPathField = new ComboBox("Иконка приложения");
for (final String icon : lookup(UserSettingsService.class).getFaviconPathList()) {
iconPathField.addItem(icon);
iconPathField.setItemIcon(icon, new ThemeResource(getLast(Splitter.on('/').split(icon))));
}
iconPathField.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ICON_ONLY);
iconPathField.setWidth(85, Unit.PIXELS);
iconPathField.setTextInputAllowed(false);
iconPathField.setNullSelectionAllowed(false);
form.addComponent(iconPathField);
isShowSalePointIdsField = new MCheckBox("Показывать раздел \"Идентификация\" в карточке торговой точки");
form.addComponent(isShowSalePointIdsField);
isDevServerField = new MCheckBox("Режим отладки");
form.addComponent(isDevServerField);
return form;
}
示例2: getPropertyField
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Field getPropertyField(FormProperty formProperty) {
ComboBox comboBox = new ComboBox(getPropertyLabel(formProperty));
comboBox.setRequired(formProperty.isRequired());
comboBox.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
comboBox.setEnabled(formProperty.isWritable());
Map<String, String> values = (Map<String, String>) formProperty.getType().getInformation("values");
if (values != null) {
for (Entry<String, String> enumEntry : values.entrySet()) {
// Add value and label (if any)
comboBox.addItem(enumEntry.getKey());
if (enumEntry.getValue() != null) {
comboBox.setItemCaption(enumEntry.getKey(), enumEntry.getValue());
}
}
}
return comboBox;
}
示例3: getLogLevelComponent
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
protected ComboBox getLogLevelComponent() {
final ComboBox combo = new ComboBox("Log Level");
combo.setNullSelectionAllowed(false);
combo.setWidth(200, Unit.PIXELS);
LogLevel[] levels = LogLevel.values();
for (LogLevel logLevel : levels) {
combo.addItem(logLevel.name());
}
combo.setValue(agentDeployment.getLogLevel());
combo.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
agentDeployment.setLogLevel((String) combo.getValue());
saveAgentDeployment(agentDeployment);
}
});
return combo;
}
示例4: createResourceCB
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
protected ComboBox createResourceCB() {
ComboBox cb = new ComboBox("HTTP Resource");
String projectVersionId = component.getProjectVersionId();
IConfigurationService configurationService = context.getConfigurationService();
Set<XMLResourceDefinition> types = context.getDefinitionFactory()
.getResourceDefinitions(projectVersionId, ResourceCategory.HTTP);
String[] typeStrings = new String[types.size()];
int i = 0;
for (XMLResourceDefinition type : types) {
typeStrings[i++] = type.getId();
}
List<Resource> resources = new ArrayList<>(configurationService.findResourcesByTypes(projectVersionId, true, typeStrings));
if (resources != null) {
for (Resource resource : resources) {
cb.addItem(resource);
}
}
cb.setWidth(50.0f, Unit.PERCENTAGE);
return cb;
}
示例5: setFieldDefaults
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private void setFieldDefaults(ComboBox backingField) {
backingField.setImmediate(true);
backingField.removeAllItems();
for (Object p : backingField.getContainerPropertyIds()) {
backingField.removeContainerProperty(p);
}
// setup displaying property ids
backingField.addContainerProperty(CAPTION_PROPERTY_ID, String.class, "");
backingField.setItemCaptionPropertyId(CAPTION_PROPERTY_ID);
@SuppressWarnings("unchecked")
EnumSet<?> enumSet = EnumSet.allOf((Class<java.lang.Enum>) getTargetPropertyType());
for (Object r : enumSet) {
Item newItem = backingField.addItem(r);
newItem.getItemProperty(CAPTION_PROPERTY_ID).setValue(r.toString());
}
}
示例6: attach
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
public void attach() {
// サーバ名(Prefix)
prefixField = new TextField(ViewProperties.getCaption("field.serverNamePrefix"));
getLayout().addComponent(prefixField);
// プラットフォーム
cloudTable = new SelectCloudTable();
getLayout().addComponent(cloudTable);
// サーバ台数
serverNumber = new ComboBox(ViewProperties.getCaption("field.serverNumber"));
serverNumber.setWidth("110px");
serverNumber.setMultiSelect(false);
for (int i = 1; i <= MAX_ADD_SERVER; i++) {
serverNumber.addItem(i);
}
serverNumber.setNullSelectionAllowed(false);
serverNumber.setValue(1); // 初期値は1
getLayout().addComponent(serverNumber);
initValidation();
}
示例7: buildSelection
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private void buildSelection() {
exportSelectionType = new ComboBox();
exportSelectionType.setTextInputAllowed(false);
exportSelectionType.setNullSelectionAllowed(false);
exportSelectionType.setEnabled(false);
exportSelectionType.addItem(Messages.getString("Caption.Item.Selected"));
exportSelectionType.addItem(Messages.getString("Caption.Item.All"));
exportSelectionType.select(Messages.getString("Caption.Item.Selected"));
exportSelectionType.addValueChangeListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
allTestsSelected = exportSelectionType.getValue().equals(Messages.getString("Caption.Item.All"));
mainEvent.fire(new MainUIEvent.PackSelectionChangedEvent());
}
});
}
示例8: buildSelection
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
protected ComboBox buildSelection() {
final ComboBox selectionType = new ComboBox();
selectionType.setTextInputAllowed(false);
selectionType.setNullSelectionAllowed(false);
selectionType.addItem(Messages.getString("Caption.Item.Selected"));
selectionType.addItem(Messages.getString("Caption.Item.All"));
selectionType.select(Messages.getString("Caption.Item.Selected"));
selectionType.addValueChangeListener(e -> {
allSelected = selectionType.getValue().equals(Messages.getString("Caption.Item.All"));
mainEvent.fire(new MainUIEvent.UserSelectionChangedEvent());
});
return selectionType;
}
示例9: buildSelection
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
protected ComboBox buildSelection() {
final ComboBox selectionType = new ComboBox();
selectionType.setTextInputAllowed(false);
selectionType.setNullSelectionAllowed(false);
selectionType.addItem(Messages.getString("Caption.Item.Selected"));
selectionType.addItem(Messages.getString("Caption.Item.All"));
selectionType.select(Messages.getString("Caption.Item.Selected"));
selectionType.addValueChangeListener(e -> {
allSelected = selectionType.getValue().equals(Messages.getString("Caption.Item.All"));
mainEvent.fire(new MainUIEvent.GroupSelectionChangedEvent());
});
return selectionType;
}
示例10: getValidEmailContacts
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void getValidEmailContacts(ComboBox targetAddress)
{
JpaBaseDao<ReportEmailRecipient, Long> reportEmailRecipient = JpaBaseDao.getGenericDao(ReportEmailRecipient.class);
targetAddress.addContainerProperty("id", String.class, null);
targetAddress.addContainerProperty("email", String.class, null);
targetAddress.addContainerProperty("namedemail", String.class, null);
for (final ReportEmailRecipient contact : reportEmailRecipient.findAll())
{
if (contact.getEmail() != null)
{
Item item = targetAddress.addItem(contact.getEmail());
if (item != null)
{
item.getItemProperty("email").setValue(contact.getEmail());
item.getItemProperty("id").setValue(contact.getEmail());
item.getItemProperty("namedemail").setValue(contact.getEmail());
}
}
}
}
示例11: getStartTypeComponent
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
protected ComboBox getStartTypeComponent() {
startTypeCombo = new ComboBox("Start Type");
startTypeCombo.setWidth(200, Unit.PIXELS);
startTypeCombo.setNullSelectionAllowed(false);
StartType[] values = StartType.values();
for (StartType value : values) {
startTypeCombo.addItem(value.name());
}
startTypeCombo.setValue(agentDeployment.getStartType());
startTypeCombo.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
agentDeployment.setStartType((String) startTypeCombo.getValue());
updateScheduleEnable();
for (int i = 0; i < 7; i++) {
ListSelect listSelect = ((ListSelect) cronLayout.getComponent(i));
for (Object itemId : listSelect.getItemIds()) {
listSelect.unselect(itemId);
}
listSelect.select(listSelect.getItemIds().iterator().next());
}
String startExpression = null;
if (agentDeployment.getStartType().equals(StartType.SCHEDULED_CRON.name())) {
startExpression = "0 0 0 * * ?";
}
startExpressionTextField.setValue(startExpression);
agentDeployment.setStartExpression(startExpression);
updateScheduleFields();
saveAgentDeployment(agentDeployment);
}
});
return startTypeCombo;
}
示例12: createField
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
public Field<?> createField(final Container dataContainer, final Object itemId, final Object propertyId,
com.vaadin.ui.Component uiContext) {
final ComponentAttribSetting setting = (ComponentAttribSetting) itemId;
Field<?> field = null;
if (propertyId.equals("value") && (setting.getValue() == null || !setting.getValue().contains("\n"))) {
final ComboBox combo = new ComboBox();
combo.setWidth(100, Unit.PERCENTAGE);
String[] functions = ModelAttributeScriptHelper.getSignatures();
for (String function : functions) {
combo.addItem(function);
}
combo.setPageLength(functions.length > 20 ? 20 : functions.length);
if (setting.getValue() != null && !combo.getItemIds().contains(setting.getValue())) {
combo.addItem(setting.getValue());
}
combo.setImmediate(true);
combo.setNewItemsAllowed(true);
combo.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
setting.setValue((String) combo.getValue());
context.getConfigurationService().save(setting);
}
});
field = combo;
}
return field;
}
示例13: NewTicketWindow
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
NewTicketWindow(Date date, final Integer prjId, final Integer milestoneId, boolean isIncludeMilestone) {
super(UserUIContext.getMessage(TicketI18nEnum.NEW));
MVerticalLayout content = new MVerticalLayout();
withModal(true).withResizable(false).withCenter().withWidth("1200px").withContent(content);
typeSelection = new ComboBox();
typeSelection.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
typeSelection.addItem(UserUIContext.getMessage(TaskI18nEnum.SINGLE));
typeSelection.setItemIcon(UserUIContext.getMessage(TaskI18nEnum.SINGLE), ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK));
}
if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) {
typeSelection.addItem(UserUIContext.getMessage(BugI18nEnum.SINGLE));
typeSelection.setItemIcon(UserUIContext.getMessage(BugI18nEnum.SINGLE), ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG));
}
if (isIncludeMilestone && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) {
typeSelection.addItem(UserUIContext.getMessage(MilestoneI18nEnum.SINGLE));
typeSelection.setItemIcon(UserUIContext.getMessage(MilestoneI18nEnum.SINGLE), ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE));
}
typeSelection.setNullSelectionAllowed(false);
if (CollectionUtils.isNotEmpty(typeSelection.getItemIds())) {
typeSelection.select(typeSelection.getItemIds().iterator().next());
} else {
throw new SecureAccessException();
}
typeSelection.setNullSelectionAllowed(false);
typeSelection.addValueChangeListener(valueChangeEvent -> doChange(date, prjId, milestoneId));
GridFormLayoutHelper formLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 1);
formLayoutHelper.addComponent(typeSelection, UserUIContext.getMessage(GenericI18Enum.FORM_TYPE), 0, 0);
formLayout = new CssLayout();
formLayout.setWidth("100%");
content.with(formLayoutHelper.getLayout(), formLayout);
doChange(date, prjId, milestoneId);
}
示例14: initElements
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
protected void initElements() {
type2 = new ComboBox();
type2.setImmediate(true);
type2.setWidth(WIDTH);
lbMeta = new Label("Meta:");
cbMeta = new CheckBox();
cbMeta.setDescription("Is this element Meta data");
optional.setWidth(WIDTH);
type = new ComboBox();
type.setWidth(WIDTH);
type.setNullSelectionAllowed(false);
type.setImmediate(true);
type.addItem(SINGLE_FILE);
type.addItem(MULTI_FILE);
type.select(SINGLE_FILE);
type.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = -1134955257251483403L;
@Override
public void valueChange(ValueChangeEvent event) {
if(type.getValue().toString().contentEquals(SINGLE_FILE)) {
getSingleFileUI();
} else if(type.getValue().toString().contentEquals(MULTI_FILE)){
getMultipleFilesUI();
}
}
});
}
示例15: cargarCalificacionesEvaluacion
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
public void cargarCalificacionesEvaluacion(EvaluacionBO evaluacion, UsuarioBO evaluador, List<TemaBO> temas, List<NivelDeConocimientoBO> nivelesDeConocimiento, List<CalificacionBO> calificacionesPrevias) {
tablaCalificacionesEvaluacion.removeAllItems();
for (TemaBO tema : temas) {
CalificacionBO calificacion = new CalificacionBO();
calificacion.setEvaluacion(evaluacion);
calificacion.setEvaluador(evaluador.getNombre());
calificacion.setTema(tema);
ComboBox comboBox = new ComboBox();
for (NivelDeConocimientoBO nivelDeConocimientoBO : nivelesDeConocimiento) {
comboBox.addItem(nivelDeConocimientoBO);
}
comboBox.setNullSelectionAllowed(false);
boolean noTieneCalificacion = true;
for (Iterator<CalificacionBO> iterator = calificacionesPrevias.iterator(); noTieneCalificacion && iterator.hasNext();) {
CalificacionBO calificacionBO = (CalificacionBO) iterator.next();
if (tema.equals(calificacionBO.getTema())) {
noTieneCalificacion = false;
comboBox.select(calificacionBO.getNivelDeConocimiento());
calificacion.setNivelDeConocimiento(calificacionBO.getNivelDeConocimiento());
}
}
if (noTieneCalificacion) {
comboBox.select(nivelesDeConocimiento.get(0));
calificacion.setNivelDeConocimiento(nivelesDeConocimiento.get(0));
}
tablaCalificacionesEvaluacion.addItem(new Object[] {tema.getId(), comboBox, tema.getNombre(), tema.getDescripcion()}, calificacion);
}
}