当前位置: 首页>>代码示例>>Java>>正文


Java ComboBox.addItem方法代码示例

本文整理汇总了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;
}
 
开发者ID:ExtaSoft,项目名称:extacrm,代码行数:27,代码来源:MainSettingsForm.java

示例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;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:EnumFormPropertyRenderer.java

示例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;
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:18,代码来源:EditAgentDeploymentPanel.java

示例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;
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:24,代码来源:ImportXmlTemplateWindow.java

示例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());
    }
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:20,代码来源:SearchPatternComboBox.java

示例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();
}
 
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:24,代码来源:WinServerAddSimple.java

示例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());
		}
	});
}
 
开发者ID:tilioteo,项目名称:hypothesis,代码行数:18,代码来源:ExportScorePresenterImpl.java

示例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;
}
 
开发者ID:tilioteo,项目名称:hypothesis,代码行数:18,代码来源:UserManagementPresenterImpl.java

示例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;
}
 
开发者ID:tilioteo,项目名称:hypothesis,代码行数:18,代码来源:GroupManagementPresenterImpl.java

示例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());
			}

		}
	}

}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:27,代码来源:EmailTargetLayout.java

示例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;
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:33,代码来源:EditAgentDeploymentPanel.java

示例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;
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:29,代码来源:EditTransformerPanel.java

示例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);
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:40,代码来源:TicketComponentFactoryImpl.java

示例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();
			}
		}
	});
}
 
开发者ID:chipster,项目名称:chipster,代码行数:30,代码来源:InputOutputUI.java

示例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);
	}
}
 
开发者ID:unicesi,项目名称:academ,代码行数:32,代码来源:ListadoCalificacionesEvaluacion.java


注:本文中的com.vaadin.ui.ComboBox.addItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。