Java 类com.vaadin.ui.ComboBox 实例源码

项目:hawkbit    文件:ComboBoxBuilder.java   
/**
 * @return a new ComboBox
 */
public ComboBox buildCombBox() {
    final ComboBox targetFilter = SPUIComponentProvider.getComboBox(null, "", null, ValoTheme.COMBOBOX_SMALL, false,
            "", prompt);
    targetFilter.setImmediate(true);
    targetFilter.setPageLength(7);
    targetFilter.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
    targetFilter.setSizeUndefined();
    if (id != null) {
        targetFilter.setId(id);
    }
    if (valueChangeListener != null) {
        targetFilter.addValueChangeListener(valueChangeListener);
    }
    return targetFilter;
}
项目:esup-ecandidat    文件:CandidatureViewTemplate.java   
/**
 * @param propertyId
 * @param libNull
 * @return les filtres perso en ComboBox
 */
public ComboBox getComboBoxFilterComponent(final Object propertyId, final String libNull) {
    List<String> list = new ArrayList<>();
    if (propertyId.equals(Candidature_.typeTraitement.getName() + "." + TypeTraitement_.libTypTrait.getName())) {
        cacheController.getListeTypeTraitement().forEach(e -> list.add(e.getLibTypTrait()));
        return generateComboBox(list, libNull);
    } else if (propertyId.equals(Candidature_.typeStatut.getName() + "." + TypeStatut_.libTypStatut.getName())) {
        cacheController.getListeTypeStatut().forEach(e -> list.add(e.getLibTypStatut()));
        return generateComboBox(list, libNull);
    } else if (propertyId.equals(LAST_TYPE_DECISION_PREFIXE + TypeDecisionCandidature_.typeDecision.getName() + "."
            + TypeDecision_.libTypDec.getName())) {
        typeDecisionController.getTypeDecisionsEnService().forEach(e -> list.add(e.getLibTypDec()));
        return generateComboBox(list, libNull);
    }
    return null;
}
项目:esup-ecandidat    文件:CandidatureViewTemplate.java   
/**
 * @param liste
 * @param libNull
 * @return une combo grace a la liste
 */
private ComboBox generateComboBox(final List<String> liste, final String libNull) {
    ComboBox sampleIdCB = new ComboBox();
    sampleIdCB.setPageLength(20);
    sampleIdCB.setTextInputAllowed(false);
    BeanItemContainer<String> dataList = new BeanItemContainer<>(String.class);
    dataList.addBean(applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()));
    if (libNull != null) {
        dataList.addBean(libNull);
    }
    dataList.addAll(liste);
    sampleIdCB
            .setNullSelectionItemId(applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()));
    sampleIdCB.setContainerDataSource(dataList);
    sampleIdCB.setImmediate(true);
    return sampleIdCB;
}
项目:esup-ecandidat    文件:GridFormatting.java   
/**
 * Ajoute un filtre en combobox String sur une colonne
 * 
 * @param property
 * @param cb
 */
public void addComboBoxFilters(String property, ComboBox cb, String libNull) {
    HeaderCell cell = getFilterCell(property);
    cb.addValueChangeListener(e -> {
        container.removeContainerFilters(property);
        if (cb.getValue() != null && !((String) cb.getValue()).isEmpty()
                && !((String) cb.getValue()).equals(libNull)) {
            container.addContainerFilter(new SimpleStringFilter(property, (String) cb.getValue(), true, true));
        } else if (cb.getValue() != null && !((String) cb.getValue()).isEmpty()
                && ((String) cb.getValue()).equals(libNull)) {
            container.addContainerFilter(new IsNull(property));
        }
        fireFilterListener();
        fireFilterListener();
    });
    cb.setImmediate(true);
    cb.setWidth(100, Unit.PERCENTAGE);
    cb.addStyleName(ValoTheme.COMBOBOX_TINY);
    cell.setComponent(cb);
}
项目:osc-core    文件:BaseDeploymentSpecWindow.java   
@Override
public void initForm() {
    this.form.addComponent(getName());
    this.form.addComponent(getProjects());
    this.form.addComponent(getRegion());
    this.form.addComponent(getUserOptions());
    this.form.addComponent(getOptionTable());

    List<ComboBox> networks = getNetworkComboBoxes();
    for (ComboBox combobox : networks) {
        this.form.addComponent(combobox);
    }
    this.form.addComponent(getIPPool());
    this.form.addComponent(getCount());
    this.form.addComponent(getSharedCheckBox());
    this.name.focus();
    getCount().setEnabled(false);
}
项目:osc-core    文件:BaseDeploymentSpecWindow.java   
protected Component getProjects() {
    try {
        this.project = new ComboBox("Select Project");
        this.project.setTextInputAllowed(true);
        this.project.setNullSelectionAllowed(false);
        this.project.setImmediate(true);
        this.project.setRequired(true);
        this.project.setRequiredError("Project cannot be empty");

    } catch (Exception e) {
        ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
        log.error("Error populating Project List combobox", e);
    }

    return this.project;
}
项目:osc-core    文件:BaseDeploymentSpecWindow.java   
protected List<ComboBox> getNetworkComboBoxes() {

        List<ComboBox> networkComboBox = new ArrayList<>();
        this.managementNetwork = new ComboBox("Select Management Network");
        this.managementNetwork.setTextInputAllowed(false);
        this.managementNetwork.setNullSelectionAllowed(false);
        this.managementNetwork.setImmediate(true);
        this.managementNetwork.setRequired(true);
        this.managementNetwork.setRequiredError("Management Network cannot be empty");

        networkComboBox.add(this.managementNetwork);

        this.inspectionNetwork = new ComboBox("Select Inspection Network");
        this.inspectionNetwork.setTextInputAllowed(false);
        this.inspectionNetwork.setNullSelectionAllowed(false);
        this.inspectionNetwork.setImmediate(true);
        this.inspectionNetwork.setRequired(true);
        this.inspectionNetwork.setRequiredError("Inspection Network cannot be empty");

        networkComboBox.add(this.inspectionNetwork);

        return networkComboBox;

    }
项目:osc-core    文件:BaseDeploymentSpecWindow.java   
private void populateNetworks(ComboBox networkComboBox, List<OsNetworkDto> networkList) {
    try {
        networkComboBox.removeAllItems();
        if (networkList != null) {
            // Calling List Network Service
            BeanItemContainer<OsNetworkDto> networkListContainer = new BeanItemContainer<>(OsNetworkDto.class,
                    networkList);

            networkComboBox.setContainerDataSource(networkListContainer);
            networkComboBox.setItemCaptionPropertyId("name");
            if (networkList.size() > 0) {
                networkComboBox.select(networkListContainer.getIdByIndex(0));
            }
        }
    } catch (Exception e) {
        ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
        log.error("Error getting Network List", e);
    }
}
项目:osc-core    文件:BaseSecurityGroupInterfaceWindow.java   
protected Component getPolicy() {
    try {
        this.policy = new ComboBox("Select Policy");
        this.policy.setTextInputAllowed(false);
        this.policy.setNullSelectionAllowed(false);
        this.policy.setImmediate(true);
        this.policy.setRequired(true);
        this.policy.setRequiredError("Policy cannot be empty");
        populatePolicy();

    } catch (Exception e) {
        ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
        log.error("Error populating Policy List combobox", e);
    }

    return this.policy;
}
项目:osc-core    文件:BindSecurityGroupWindow.java   
private ComboBox getPolicyComboBox(List<PolicyDto> policyDtoList) {
    ComboBox policy = new ComboBox("Select Policy");
    policy.setTextInputAllowed(false);
    policy.setNullSelectionAllowed(false);
    policy.setImmediate(true);
    policy.setRequired(true);
    policy.setRequiredError("Policy cannot be empty");

    BeanItemContainer<PolicyDto> policyListContainer = new BeanItemContainer<>(PolicyDto.class,
            policyDtoList);
    policy.setContainerDataSource(policyListContainer);
    policy.setItemCaptionPropertyId("policyName");

    if (policyListContainer.size() > 0) {
        policy.select(policyListContainer.getIdByIndex(0));
    }

    policy.setEnabled(false);

    return policy;
}
项目:osc-core    文件:BindSecurityGroupWindow.java   
@SuppressWarnings({ "rawtypes" })
private void serviceTableClicked(long itemId) {
    ComboBox policyComboBox = (ComboBox) this.serviceTable.getContainerProperty(itemId, PROPERTY_ID_POLICY)
            .getValue();
    ComboBox failurePolicyComboBox = (ComboBox) this.serviceTable
            .getContainerProperty(itemId, PROPERTY_ID_FAILURE_POLICY).getValue();
    Property itemProperty = this.serviceTable.getContainerProperty(itemId, PROPERTY_ID_ENABLED);

    boolean currentValue = (boolean) itemProperty.getValue();
    if (policyComboBox.getContainerDataSource().size() > 0) {
        if (isBindedWithMultiplePolicies(itemId)) {
            policyComboBox.setEnabled(false);
        } else {
            policyComboBox.setEnabled(currentValue);
        }
    }
    if (failurePolicyComboBox.getData() != null) {
        failurePolicyComboBox.setEnabled(currentValue);
    }
}
项目:osc-core    文件:BaseSecurityGroupWindow.java   
protected ComboBox getProject() {
    try {
        this.project = new ComboBox("Select Project");
        this.project.setTextInputAllowed(true);
        this.project.setNullSelectionAllowed(false);
        this.project.setImmediate(true);
        this.project.setRequired(true);
        this.project.setRequiredError("Project cannot be empty");

    } catch (Exception e) {
        ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
        log.error("Error populating Project List combobox", e);
    }

    return this.project;
}
项目:osc-core    文件:BaseDAWindow.java   
private ComboBox createDomainComboBox(List<DomainDto> dl) {
    ComboBox domainComboBox = new ComboBox();
    BeanItemContainer<DomainDto> domainContainer = new BeanItemContainer<DomainDto>(DomainDto.class, dl);
    ApplianceManagerConnectorDto mc = (ApplianceManagerConnectorDto) this.managerConnector.getValue();

    domainComboBox.setContainerDataSource(domainContainer);
    domainComboBox.setTextInputAllowed(false);
    domainComboBox.setNullSelectionAllowed(false);
    domainComboBox.setItemCaptionPropertyId("name");
    domainComboBox.setEnabled(mc.isPolicyMappingSupported());

    if (domainComboBox.getItemIds().size() > 0) {
        domainComboBox.select(domainContainer.getIdByIndex(0));
    }
    return domainComboBox;
}
项目:osc-core    文件:BaseDAWindow.java   
private ComboBox createEncapsulationTypeComboBox(VirtualizationType virtualizationType,
        List<TagEncapsulationType> types) {
    ComboBox encapsulationType = new ComboBox();
    encapsulationType.setTextInputAllowed(false);
    encapsulationType.setNullSelectionAllowed(true);

    BeanItemContainer<TagEncapsulationType> encapsulationTypeContainer = new BeanItemContainer<TagEncapsulationType>(
            TagEncapsulationType.class, types);
    encapsulationType.setContainerDataSource(encapsulationTypeContainer);
    ApplianceManagerConnectorDto currentMc = (ApplianceManagerConnectorDto) this.managerConnector.getValue();

    if (!virtualizationType.isOpenstack() || (currentMc != null && !currentMc.isPolicyMappingSupported())) {
        encapsulationType.setEnabled(false);
    }
    return encapsulationType;
}
项目:osc-core    文件:BaseDAWindow.java   
/**
 * @return AD ComboBox
 */
protected ComboBox getApplianceDefinition() {
    try {
        this.applianceDefinition = new ComboBox("Service Function Definition");
        this.applianceDefinition.setTextInputAllowed(false);
        this.applianceDefinition.setNullSelectionAllowed(false);
        this.applianceDefinition.setRequired(true);
        this.applianceDefinition.setRequiredError("Service Function Definition cannot be Empty");
        this.applianceDefinition.setWidth(100, Unit.PERCENTAGE);

        updateAppliances();
    } catch (Exception e) {
        log.error("Error populating appliance list combobox", e);
    }

    return this.applianceDefinition;
}
项目:md-stepper    文件:StepperPropertiesLayout.java   
private ComboBox createThemeChooserBox() {
  List<String> themes = Arrays.asList("Blueprint", "Dark", "Default", "Facebook", "Flat",
                                      "Flat-Dark", "Light", "Metro");

  ComboBox comboBox = new ComboBox("Choose theme", themes);
  comboBox.setWidth(100, Unit.PERCENTAGE);
  comboBox.setValue("Default");
  comboBox.addValueChangeListener(e -> {
    Object value = e.getValue();
    String theme = value != null ? String.valueOf(value) : "";
    if (!"".equals(theme.trim())) {
      getUI().setTheme(theme.toLowerCase());
    }
  });

  return comboBox;
}
项目:HomeWire-Server    文件:ConditionPanel.java   
public ConditionPanel(ConditionDTO conditionDTO,
                      ConditionWidgetRepository conditionWidgetRepository,
                      Consumer<ConditionDTO> changeListener) {
  this.conditionWidgetRepository = conditionWidgetRepository;
  this.conditionDTO = conditionDTO;

  this.mainPanel = new Panel("Condition");
  this.mainTypeComboBox = new ComboBox("Type");

  this.currentConditionWidget = conditionWidgetRepository
      .getFactory(TypeViewDTO.ConditionTypes.ofConditionDto(conditionDTO))
      .createWidget(conditionDTO);
  currentConditionWidget.setChangeListener(changeListener);

  this.changeListener = changeListener;

  setupPanel();

  setCompositionRoot(mainPanel);
  setSizeUndefined();
}
项目:HomeWire-Server    文件:ActionPanel.java   
public ActionPanel(ActionDTO actionDTO,
                   ActionWidgetRepository actionWidgetRepository,
                   Consumer<ActionDTO> changeListener) {
  this.actionWidgetRepository = actionWidgetRepository;
  this.actionDTO = actionDTO;

  this.mainPanel = new Panel("Action");
  this.mainTypeComboBox = new ComboBox("Type");

  this.currentActionWidget = actionWidgetRepository
      .getFactory(TypeViewDTO.ActionTypes.ofActionDto(actionDTO))
      .createWidget(actionDTO);
  currentActionWidget.setChangeListener(changeListener);

  this.changeListener = changeListener;

  setupPanel();

  setCompositionRoot(mainPanel);
  setSizeUndefined();
}
项目:dungeonstory-java    文件:SkillForm.java   
@Override
protected Component createContent() {
    FormLayout layout = new FormLayout();

    name = new FTextField("Nom");
    shortDescription = new FTextField("Description courte").withFullWidth();
    description = new FTextArea("Description").withFullWidth();
    keyAbility = new ComboBox<Ability>("Attribut clé", Services.getAbilityService().findAll());

    layout.addComponent(name);
    layout.addComponent(shortDescription);
    layout.addComponent(description);
    layout.addComponent(keyAbility);
    layout.addComponent(getToolbar());

    return layout;
}
项目:dungeonstory-java    文件:CityForm.java   
@Override
protected Component createContent() {
    FormLayout layout = new FormLayout();

    name = new FTextField("Nom");
    region = new ComboBox<Region>("Région", regionService.findAll());
    shortDescription = new FTextField("Description courte");
    description = new FTextArea("Description").withFullWidth();

    layout.addComponent(name);
    layout.addComponent(region);
    layout.addComponent(shortDescription);
    layout.addComponent(description);
    layout.addComponent(getToolbar());

    return layout;
}
项目:dungeonstory-java    文件:FeatForm.java   
@Override
protected Component createContent() {
    FormLayout layout = new FormLayout();

    name = new FTextField("Nom").withWidth(50, Unit.PERCENTAGE);
    description = new FTextArea("Description").withFullWidth().withRows(10);
    usage = new EnumComboBox<FeatUsage>(FeatUsage.class, "Usage");
    prerequisiteType = new EnumComboBox<PrerequisiteType>(PrerequisiteType.class, "Type de prérequis");
    prerequisiteArmorProficiency = new EnumComboBox<>(ArmorType.ProficiencyType.class, "Maitrise d'armure prérequise");
    prerequisiteAbility = new ComboBox<Ability>("Caractéristique prérequise", abilityService.findAll());
    prerequisiteAbilityScore = new DSIntegerField("Score de caractéristique");

    prerequisiteType.addSelectionListener(event -> adjustTypeVisibility(event.getValue()));

    layout.addComponent(name);
    layout.addComponent(description);
    layout.addComponent(usage);
    layout.addComponents(prerequisiteType, prerequisiteArmorProficiency, prerequisiteAbility, prerequisiteAbilityScore);
    layout.addComponent(getToolbar());

    return layout;
}
项目:dungeonstory-java    文件:AdventureForm.java   
@Override
protected Component createContent() {
    layout = new FormLayout();

    name = new FTextField("Titre").withWidth("50%");
    description = new FTextArea("Description").withFullWidth();
    challengeRating = new ComboBox<>("Degré de difficulté");
    challengeRating.setItems(Services.getLevelService().findAll());
    status = new EnumComboBox<>(AdventureStatus.class, "Statut");
    layout.addComponents(name, description, challengeRating, status);
    layout.addComponent(getToolbar());

    messageButton = new Button("Messages", event -> {
        EventBus.post(new NavigationEvent(AdventureView.URI + "/" + getEntity().getId()));
    });
    layout.addComponent(messageButton);

    return layout;
}
项目:cuba    文件:WebSearchPickerField.java   
public WebSearchPickerField() {
    final ComboBox selectComponent = component;
    WebPickerField.Picker picker = new WebPickerField.Picker(this, component) {
        @Override
        public void setRequired(boolean required) {
            super.setRequired(required);
            selectComponent.setNullSelectionAllowed(!required);
        }
    };
    pickerField = new WebPickerField(picker);

    Messages messages = AppBeans.get(Messages.class);
    setInputPrompt(messages.getMainMessage("searchPickerField.inputPrompt"));

    // Required for custom components in fieldgroup
    initValueSync(selectComponent, picker);
}
项目:SecureBPMN    文件:EnumFormPropertyRenderer.java   
@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;
}
项目:SecureBPMN    文件:SelectUsersPopupWindow.java   
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);
    }
  }
}
项目:metl    文件:EditAgentDeploymentPanel.java   
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;
}
项目:metl    文件:ImportXmlTemplateWindow.java   
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;
}
项目:metl    文件:EditXmlFormatPanel.java   
protected void buildXpathChoices() {
    SAXBuilder builder = new SAXBuilder();
    builder.setXMLReaderFactory(XMLReaders.NONVALIDATING);
    builder.setFeature("http://xml.org/sax/features/validation", false);
    Setting setting = component.findSetting(XmlFormatter.XML_FORMATTER_TEMPLATE);
    xpathChoices = new TreeSet<String>();
    if (StringUtils.isNotBlank(setting.getValue())) {
        try {
            Document document = builder.build(new StringReader(setting.getValue()));

            buildXpathChoicesFromElement("/" + document.getRootElement().getName(),
                    document.getRootElement());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    ComboBox combo = (ComboBox) grid.getColumn("xpath").getEditorField();
    combo.removeAllItems();
    combo.addItems(xpathChoices);
}
项目:field-binder    文件:SearchPatternComboBox.java   
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());
    }
}
项目:primecloud-controller    文件:WinServerEdit.java   
@Override
public void attach() {
    setHeight(TAB_HEIGHT);
    setMargin(false, true, false, true);
    setSpacing(false);

    // サーバサイズ
    sizeSelect = new ComboBox(ViewProperties.getCaption("field.serverSize"));
    sizeSelect.setNullSelectionAllowed(false);
    form.getLayout().addComponent(sizeSelect);

    // キーペア
    keySelect = new ComboBox(ViewProperties.getCaption("field.keyPair"));
    keySelect.setNullSelectionAllowed(false);
    form.getLayout().addComponent(keySelect);

    addComponent(form);
}
项目:primecloud-controller    文件:WinServerAddSimple.java   
@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();
}
项目:dhconvalidator    文件:UserSwitchPanel.java   
/**
 * 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);
}
项目:mycollab    文件:TimeZoneSelectionField.java   
public TimeZoneSelectionField(boolean isVerticalDisplay) {
    this.isVerticalDisplay = isVerticalDisplay;
    areaSelection = new ValueComboBox(false, TimezoneVal.getAreas());
    areaSelection.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
            setCboTimeZone((String) areaSelection.getValue());
        }
    });
    timezoneSelection = new ComboBox();
    timezoneSelection.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
    String area = (String) areaSelection.getItemIds().iterator().next();
    areaSelection.setValue(area);
    setCboTimeZone(area);
}
项目:mycollab    文件:DateSelectionField.java   
public DateSelectionField() {
    cboMonth = new ComboBox();
    cboMonth.setNullSelectionAllowed(true);
    cboMonth.setPageLength(12);
    cboMonth.setImmediate(true);

    addMonthItems();
    cboMonth.setWidth("117px");

    cboDate = new ComboBox();
    cboDate.setNullSelectionAllowed(true);
    cboDate.setImmediate(true);

    addDayItems();
    cboDate.setWidth("80px");

    cboYear = new ComboBox();
    cboYear.setNullSelectionAllowed(true);
    cboYear.setImmediate(true);

    addYearItems();
    cboYear.setWidth("80px");
}
项目:FiWare-Template-Handler    文件:EnumFormPropertyRenderer.java   
@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;
}
项目:FiWare-Template-Handler    文件:SelectUsersPopupWindow.java   
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);
    }
  }
}
项目:extacrm    文件:MainSettingsForm.java   
@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;
}
项目:gazpachoquest    文件:OldLoginView.java   
private ComboBox createLanguageSelector() {
    ComboBox languageSelector = new ComboBox("com.vaadin.demo.dashboard.DashboardUI.Language");
    languageSelector.setImmediate(true);
    languageSelector.setNullSelectionAllowed(false);
    addLocale(Locale.ENGLISH, languageSelector);
    addLocale(Locale.FRENCH, languageSelector);
    addLocale(new Locale("es"), languageSelector);
    // languageSelector.setValue(I18NStaticService.getI18NServive().getLocale());
    /*-languageSelector.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            Locale locale = (Locale) (event.getProperty().getValue());
            I18NStaticService.getI18NServive().setLocale(locale);
            getUI().requestRepaintAll();
        }
    });*/
    return languageSelector;
}
项目:konekti    文件:LocaleField.java   
private VerticalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("100.0%");
    setHeight("100.0%");

    // comboBox_1
    defaultLocaleField = new ComboBox();
    defaultLocaleField.setImmediate(false);
    defaultLocaleField.setWidth("100.0%");
    defaultLocaleField.setHeight("-1px");
    mainLayout.addComponent(defaultLocaleField);

    return mainLayout;
}
项目:hypothesis    文件:ExportScorePresenterImpl.java   
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());
        }
    });
}