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


Java ComboBox.setNewItemsAllowed方法代码示例

本文整理汇总了Java中com.vaadin.ui.ComboBox.setNewItemsAllowed方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.setNewItemsAllowed方法的具体用法?Java ComboBox.setNewItemsAllowed怎么用?Java ComboBox.setNewItemsAllowed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.ui.ComboBox的用法示例。


在下文中一共展示了ComboBox.setNewItemsAllowed方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: selectUser

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
protected void selectUser(String userId, String userName) {
  if (!selectedUsersTable.containsId(userId)) {
    Item item = selectedUsersTable.addItem(userId);
    item.getItemProperty("userName").setValue(userName);
    
    if (showRoles) {
      ComboBox comboBox = new ComboBox(null, Arrays.asList(
              i18nManager.getMessage(Messages.TASK_ROLE_CONTRIBUTOR),
              i18nManager.getMessage(Messages.TASK_ROLE_IMPLEMENTER),
              i18nManager.getMessage(Messages.TASK_ROLE_MANAGER),
              i18nManager.getMessage(Messages.TASK_ROLE_SPONSOR)));
      comboBox.select(i18nManager.getMessage(Messages.TASK_ROLE_CONTRIBUTOR));
      comboBox.setNewItemsAllowed(true);
      item.getItemProperty("role").setValue(comboBox);
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:18,代码来源:SelectUsersPopupWindow.java

示例2: initComponents

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
 * Setup UI.
 */
private void initComponents() {
	List<User> users = UserList.INSTANCE.getUsers();
	userSwitchBox = new ComboBox(Messages.getString("UserSwitchPanel.boxCaption")); //$NON-NLS-1$
	setUsers(users);
	User current = (User) VaadinSession.getCurrent().getAttribute(SessionStorageKey.USER.name());
	userSwitchBox.setValue(current);
	
	userSwitchBox.setDescription(
		Messages.getString("UserSwitchPanel.boxDescription")); //$NON-NLS-1$
	userSwitchBox.setNewItemsAllowed(false);
	userSwitchBox.setNullSelectionAllowed(false);
	
	addComponent(userSwitchBox);
	btReload = new Button(Messages.getString("UserSwitchPanel.reloadCaption")); //$NON-NLS-1$
	btReload.setStyleName(BaseTheme.BUTTON_LINK);
	btReload.addStyleName("plain-link"); //$NON-NLS-1$
	
	addComponent(btReload);
}
 
开发者ID:ADHO,项目名称:dhconvalidator,代码行数:23,代码来源:UserSwitchPanel.java

示例3: bindEnumField

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
public ComboBox bindEnumField(ComboBox comboBox, AbstractLayout form, ValidatingFieldGroup<E> group,
		String fieldLabel, String fieldName, Class<?> clazz)
{
	ComboBox field = comboBox;
	field.setCaption(fieldLabel);
	field.setContainerDataSource(createContainerFromEnumClass(fieldName, clazz));
	field.setItemCaptionPropertyId(fieldName);
	// field.setCaption(fieldLabel);
	field.setNewItemsAllowed(false);
	field.setNullSelectionAllowed(false);
	field.setTextInputAllowed(true);
	field.setWidth(STANDARD_COMBO_WIDTH);
	field.setPopupWidth("100%");

	field.setImmediate(true);
	field.setId(fieldLabel.replace(" ", ""));
	addValueChangeListeners(field);
	doBinding(group, fieldName, field);

	form.addComponent(field);
	return field;
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:23,代码来源:FormHelper.java

示例4: getComboBox

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
 * @param caption
 * @param bindName
 * @param container
 *            TODO
 * @return
 */
private ComboBox getComboBox(String caption, String bindName,
		Container container) {
	ComboBox comboBox = new ComboBox(caption);
	comboBox.setImmediate(true);
	comboBox.setValidationVisible(false);
	comboBox.setNewItemsAllowed(false);
	comboBox.setFilteringMode(FilteringMode.CONTAINS);
	comboBox.setNullSelectionAllowed(false);
	fieldGroup.bind(comboBox, bindName);
	comboBox.setContainerDataSource(container);
	return comboBox;
}
 
开发者ID:KrishnaPhani,项目名称:KrishnasSpace,代码行数:20,代码来源:BasicFormImpl.java

示例5: setCategoryFilter

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
 * @param filterRow
 * @return
 */
private HeaderCell setCategoryFilter(HeaderRow filterRow) {
	HeaderCell categoryFilter = filterRow.getCell(CATEGORY);
	ComboBox comboBox = new ComboBox();
	comboBox.setHeight(100, Unit.PERCENTAGE);
	comboBox.setImmediate(true);
	comboBox.setNewItemsAllowed(false);
	comboBox.setTextInputAllowed(false);
	comboBox.addValueChangeListener(getCategoryFilterListener());
	comboBox.setContainerDataSource(getCategoryDataSource());
	categoryFilter.setComponent(comboBox);
	return categoryFilter;
}
 
开发者ID:KrishnaPhani,项目名称:KrishnasSpace,代码行数:17,代码来源:FilterGrid.java

示例6: buildGrid

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
protected void buildGrid() {
    grid = new Grid();
    grid.setSelectionMode(SelectionMode.NONE);
    grid.setSizeFull();
    grid.setEditorEnabled(!readOnly);
    container = new BeanItemContainer<Record>(Record.class);
    grid.setContainerDataSource(container);
    grid.setColumns("entityName", "attributeName", "xpath");
    HeaderRow filterRow = grid.appendHeaderRow();

    addColumn("entityName", filterRow);

    addColumn("attributeName", filterRow);

    ComboBox combo = new ComboBox();
    combo.addValueChangeListener(e->saveXPathSettings());
    combo.setWidth(100, Unit.PERCENTAGE);
    combo.setImmediate(true);
    combo.setNewItemsAllowed(true);
    combo.setInvalidAllowed(true);
    combo.setTextInputAllowed(true);
    combo.setScrollToSelectedItem(true);
    combo.setFilteringMode(FilteringMode.CONTAINS);
    grid.getColumn("xpath").setEditorField(combo).setExpandRatio(1);
    addShowPopulatedFilter("xpath", filterRow);
    grid.setEditorBuffered(false);
    addComponent(grid);
    setExpandRatio(grid, 1);
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:30,代码来源:EditXmlFormatPanel.java

示例7: 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

示例8: bindComboBox

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
public <L> ComboBox bindComboBox(AbstractLayout form, ValidatingFieldGroup<E> fieldGroup, String fieldName,
		String fieldLabel, Collection<?> options)
{
	ComboBox field = new SplitComboBox(fieldLabel, options);
	field.setNewItemsAllowed(false);
	field.setNullSelectionAllowed(false);
	field.setTextInputAllowed(true);
	field.setWidth(STANDARD_COMBO_WIDTH);
	field.setPopupWidth("100%");
	field.setImmediate(true);
	form.addComponent(field);
	addValueChangeListeners(field);
	doBinding(group, fieldName, field);
	return field;
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:16,代码来源:FormHelper.java

示例9: ReportParameterReportChooser

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
 * 
 * @param caption
 * @param defaultValue
 * @param parameterName
 * @param enumClass
 */
public ReportParameterReportChooser(String caption, T defaultValue, String parameterName, Class<T> enumClass)
{
	super(caption, parameterName);
	field = new ComboBox(caption);
	this.enumClass = enumClass;
	field.setContainerDataSource(FormHelper.createContainerFromEnumClass("value", enumClass));
	field.setNewItemsAllowed(false);
	field.setNullSelectionAllowed(false);
	field.setTextInputAllowed(false);
	field.setValue(defaultValue);
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:19,代码来源:ReportParameterReportChooser.java

示例10: ReportParameterEnum

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
 * 
 * @param caption
 * @param defaultValue
 * @param parameterName
 * @param enumClass
 */
public ReportParameterEnum(String caption, T defaultValue, String parameterName, Class<T> enumClass)
{
	super(caption, parameterName);
	field = new ComboBox(caption);
	this.enumClass = enumClass;
	field.setContainerDataSource(FormHelper.createContainerFromEnumClass("value", enumClass));
	field.setNewItemsAllowed(false);
	field.setNullSelectionAllowed(false);
	field.setTextInputAllowed(false);
	field.setValue(defaultValue);
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:19,代码来源:ReportParameterEnum.java

示例11: buildSearchLayout

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
protected AbstractLayout buildSearchLayout() {
    FormLayout layout = new FormLayout();
    layout.setMargin(true);

    List<Plugin> existingPlugins = context.getPluginService().findPlugins();
    Set<String> groups = new HashSet<>();
    Set<String> names = new HashSet<>();
    for (Plugin plugin : existingPlugins) {
        groups.add(plugin.getArtifactGroup());
        names.add(plugin.getArtifactName());
    }

    versionSelect = new ListSelect("Versions");
    groupCombo = new ComboBox("Group");
    nameCombo = new ComboBox("Name");

    versionSelect.setRows(4);
    versionSelect.setMultiSelect(false);
    versionSelect.setNullSelectionAllowed(false);
    versionSelect.setWidth(100, Unit.PERCENTAGE);
    versionSelect.addValueChangeListener(e -> versionSelected());

    groupCombo.setWidth(100, Unit.PERCENTAGE);
    groupCombo.setNewItemsAllowed(true);
    groupCombo.addItems(groups);
    groupCombo.addValueChangeListener(e -> {
        populateNameField(nameCombo);
        setSearchButtonEnabled();
    });
    groupCombo.setNewItemHandler((newItemCaption) -> {
        groupCombo.removeItem(handEnteredGroup);
        handEnteredGroup = newItemCaption;
        groupCombo.addItem(handEnteredGroup);
        groupCombo.setValue(handEnteredGroup);
        setSearchButtonEnabled();
    });
    layout.addComponent(groupCombo);

    nameCombo.setWidth(100, Unit.PERCENTAGE);
    nameCombo.setNewItemsAllowed(true);
    nameCombo.addItems(names);
    nameCombo.addValueChangeListener(e -> {
        setSearchButtonEnabled();
    });
    nameCombo.setNewItemHandler((newItemCaption) -> {
        nameCombo.removeItem(handEnteredName);
        handEnteredName = newItemCaption;
        nameCombo.addItem(handEnteredName);
        nameCombo.setValue(handEnteredName);
        setSearchButtonEnabled();
    });
    layout.addComponent(nameCombo);

    layout.addComponent(versionSelect);

    return layout;
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:58,代码来源:PluginsPanelAddDialog.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 Route route = (Route) itemId;
    Field<?> field = null;
    if (propertyId.equals("matchExpression")) {
        final TextField textField = new ImmediateUpdateTextField(null) {
            @Override
            protected void save(String text) {
                route.setMatchExpression(text);
                EditContentRouterPanel.this.save();
            }
        };
        textField.setWidth(100, Unit.PERCENTAGE);
        textField.setValue(route.getMatchExpression());
        field = textField;
    } else if (propertyId.equals("targetStepId")) {
        final ComboBox combo = new ComboBox();
        combo.setWidth(100, Unit.PERCENTAGE);
        flow = context.getConfigurationService().findFlow(flow.getId());
        List<FlowStepLink> stepLinks = flow.findFlowStepLinksWithSource(flowStep.getId());
        for (FlowStepLink flowStepLink : stepLinks) {
            FlowStep comboStep = flow.findFlowStepWithId(flowStepLink.getTargetStepId());
            combo.addItem(comboStep.getId());
            combo.setItemCaption(comboStep.getId(), comboStep.getName());

            if (flowStepLink.getTargetStepId().equals(route.getTargetStepId()) || combo.getValue() == null) {
                combo.setValue(comboStep.getId());
            }
        }

        combo.setImmediate(true);
        combo.setNewItemsAllowed(false);
        combo.setNullSelectionAllowed(false);
        combo.addValueChangeListener(new ValueChangeListener() {
            public void valueChange(ValueChangeEvent event) {
                String stepId = (String) event.getProperty().getValue();
                if (stepId != null) {
                    route.setTargetStepId(stepId);
                    EditContentRouterPanel.this.save();
                }
            }
        });
        field = combo;
    }
    if (field != null) {
        field.setReadOnly(readOnly);
    }
    return field;
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:50,代码来源:EditContentRouterPanel.java


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