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


Java AbstractSelect.addItem方法代码示例

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


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

示例1: populateWIdsSkip

import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
public static void populateWIdsSkip(AbstractSelect as, String[] s,
		Integer[] skip) {

	Set<Integer> se = new HashSet<Integer>(Arrays.asList(skip));
	as.removeAllItems();
	int i = 0;
	for (String sp : s) {
		if (!se.contains(i)) {
			as.addItem(i);
			as.setItemCaption(i, sp);
		}
		i++;
	}
	as.setItemCaptionMode(ItemCaptionMode.EXPLICIT_DEFAULTS_ID);

}
 
开发者ID:mi9rom,项目名称:VaadHL,代码行数:17,代码来源:ComponentHelper.java

示例2: getValueChangeListener

import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
private Property.ValueChangeListener getValueChangeListener(final AbstractSelect templateComboBox,
                                                            final AbstractSelect supplierPageSelect) {
    final Map<String, String> parentTemplates = utils.getParentTemplates();
    return new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            String templateId = (String) templateComboBox.getValue();
            boolean requiresSupplierPage = parentTemplates.containsKey(templateId);
            if (requiresSupplierPage) {
                supplierPageSelect.removeAllItems();
                String parentTemplateId = parentTemplates.get(templateId);
                final Map<String, String> pages = utils.findPagesUsingTemplate(parentTemplateId);
                for (Map.Entry<String, String> entry : pages.entrySet()) {
                    supplierPageSelect.addItem(entry.getValue());
                    supplierPageSelect.setItemCaption(entry.getValue(), entry.getKey());
                }
                supplierPageSelect.setRequired(true);
                supplierPageSelect.setVisible(true);
            } else {
                supplierPageSelect.setValue(null);
                supplierPageSelect.setRequired(false);
                supplierPageSelect.setVisible(false);
            }
        }
    };
}
 
开发者ID:magnoliales,项目名称:magnolia-handlebars,代码行数:27,代码来源:SupplierPageSelectorFieldFactory.java

示例3: buildSelectOptions

import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
/**
 * A workhorse for {@link RContainer#getOptionGroup} and
 * {@link RContainer#getListSelect} to initiate the selection options by
 * reading them from an R character vector.
 * 
 * @param selectObj
 *            Selection object
 * @param optionsInName
 *            The R character vector to read the different options. Repeated
 *            values are ignored.
 */
public void buildSelectOptions(final AbstractSelect selectObj,
		String optionsInName) {

	/* Clean the possible old values */
	selectObj.removeAllItems();

	String[] optionsIn = getStrings(optionsInName);
	if (optionsIn == null) {
		Notification.show("RVaadin: Cannot find selection element"
				+ " values from " + optionsInName,
				Notification.Type.ERROR_MESSAGE);

	} else {
		for (String str : optionsIn) {
			selectObj.addItem(str);
		}
	}
}
 
开发者ID:avirkki,项目名称:RVaadin,代码行数:30,代码来源:RContainer.java

示例4: populateWIds

import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
/**
 * Populate the AbstractSelect component with strings.<br>
 * The Itemid is an integer = the index of the string in the sequence ,
 * starting from 0
 * 
 * @param as
 *            component
 * @param s
 *            comma separated string list or array of strings
 */
static public void populateWIds(AbstractSelect as, String... s) {
	int i = 0;
	as.removeAllItems();
	for (String sp : s) {
		as.addItem(i);
		as.setItemCaption(i, sp);
		i++;
	}
	as.setItemCaptionMode(ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
}
 
开发者ID:mi9rom,项目名称:VaadHL,代码行数:21,代码来源:ComponentHelper.java

示例5: createResourceCombo

import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
protected AbstractSelect createResourceCombo(XMLSetting definition,
        AbstractObjectWithSettings obj, ResourceCategory category) {
    IConfigurationService configurationService = context.getConfigurationService();
    FlowStep step = getSingleFlowStep();
    String projectVersionId = step.getComponent().getProjectVersionId();
    final AbstractSelect combo = new ComboBox(definition.getName());
    combo.setImmediate(true);
    combo.setDescription(definition.getDescription());
    combo.setNullSelectionAllowed(false);
    combo.setRequired(definition.isRequired());
    Set<XMLResourceDefinition> types = context.getDefinitionFactory()
            .getResourceDefinitions(projectVersionId, category);
    if (types != null) {
        String[] typeStrings = new String[types.size()];
        int i = 0;
        for (XMLResourceDefinition type : types) {
            typeStrings[i++] = type.getId();
        }
        List<Resource> resources = 
                configurationService.findResourcesByTypes(projectVersionId, true, typeStrings);

        if (resources != null) {
            for (Resource resource : resources) {
                combo.addItem(resource.getId());
                combo.setItemCaption(resource.getId(), resource.getName());
            }

            combo.setValue(obj.get(definition.getId()));
        }
    }
    combo.addValueChangeListener(
            event -> saveSetting(definition.getId(), (String) combo.getValue(), obj));
    combo.setReadOnly(readOnly);
    return combo;
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:36,代码来源:PropertySheet.java

示例6: fillSelectByEnum

import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
/**
 * Заполняем поле выбора элементами перечисления
 *
 * @param component поле выбора
 * @param cls       тип перечисления
 */
public static <TEnum extends Enum<TEnum>> void fillSelectByEnum(final AbstractSelect component,
                                                                final Class<TEnum> cls) {
    final Converter<String, TEnum> converter = VaadinSession.getCurrent().getConverterFactory()
            .createConverter(String.class, cls);
    for (final TEnum en : EnumSet.allOf(cls)) {
        component.addItem(en);
        component.setItemCaption(en, converter.convertToPresentation(en, null, null));
    }
}
 
开发者ID:ExtaSoft,项目名称:extacrm,代码行数:16,代码来源:ComponentUtil.java

示例7: addResourceCombo

import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
protected void addResourceCombo(XMLComponentDefinition componentDefintion, FormLayout formLayout, final Component component) {
    if (componentDefintion == null) {
        log.error("Could not find a component defintion for: " + component.getName() + " " + component.getType());
    } else {
        IConfigurationService configurationService = context.getConfigurationService();
        FlowStep step = getSingleFlowStep();
        if (componentDefintion.getResourceCategory() != null && componentDefintion.getResourceCategory() != ResourceCategory.NONE
                && step != null) {
            final AbstractSelect resourcesCombo = new ComboBox("Resource");
            resourcesCombo.setImmediate(true);
            String projectVersionId = step.getComponent().getProjectVersionId();
            Set<XMLResourceDefinition> types = context.getDefinitionFactory().getResourceDefinitions(projectVersionId,
                    componentDefintion.getResourceCategory());
            if (types != null) {
                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) {
                        resourcesCombo.addItem(resource);
                    }

                    resourcesCombo.setValue(component.getResource());
                }
            }
            resourcesCombo.addValueChangeListener(new ValueChangeListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void valueChange(ValueChangeEvent event) {
                    component.setResource((Resource) resourcesCombo.getValue());
                    context.getConfigurationService().save(component);
                }
            });

            formLayout.addComponent(resourcesCombo);
        }
    }
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:43,代码来源:PropertySheet.java

示例8: addAllItems

import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
public void addAllItems(AbstractSelect select,Object [] objects){
	for(Object obj:objects){
		select.addItem(obj);
	}
}
 
开发者ID:alternativeTime,项目名称:GlycanBuilderVaadin7Version,代码行数:6,代码来源:MassOptionsDialog.java

示例9: addItemList

import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
/**
 * Add a List of objects to a combo
 * @param combo combo to add items
 * @param items items to add
 */
public static void addItemList(AbstractSelect combo, List<?> items) {
	combo.setItemCaptionMode(ItemCaptionMode.ID);
	for (Object item : items)
		combo.addItem(item);
}
 
开发者ID:chelu,项目名称:jdal,代码行数:11,代码来源:FormUtils.java


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