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


Java ComboBox.setItemCaption方法代码示例

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


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

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

示例2: setLookupCaptions

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
public void setLookupCaptions(LookupField lookupField, Map<Object, String> captions) {
    ComboBox vLookupField = lookupField.unwrap(ComboBox.class);
    vLookupField.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT);
    for (Map.Entry<Object, String> entry : captions.entrySet()) {
        vLookupField.setItemCaption(entry.getKey(), entry.getValue());
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:9,代码来源:WebFilterHelper.java

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

示例4: addLocale

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private void addLocale(Locale locale, ComboBox languageSelector) {
    languageSelector.addItem(locale);
    languageSelector.setItemCaption(locale, "XX");
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:5,代码来源:OldLoginView.java

示例5: OldLoginView

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
public OldLoginView() {
    setSizeFull();

    // Language bar in the top-right corner for selecting
    // invitation interface language
    final HorizontalLayout languageBar = new HorizontalLayout();
    languageBar.setHeight("50px");
    // addComponent(languageBar);
    // setComponentAlignment(languageBar, Alignment.TOP_RIGHT);

    // Allow selecting a language. We are in a constructor of a
    // CustomComponent, so preselecting the current
    // language of the application can not be done before
    // this (and the selection) component are attached to
    // the application.
    final ComboBox languageSelector = new ComboBox("Select a language") {
        @Override
        public void attach() {
            super.attach();
            // setValue(getLocale());
        }
    };

    // for (int i=0; i<locales.length; i++) {
    String locale = "es";
    languageSelector.addItem(locale);
    languageSelector.setItemCaption(locale, "español");

    // Automatically select the current locale
    // if (locales[i].equals(getLocale()))
    languageSelector.setValue(locale);

    // }

    // Create the invitation input field
    invitationTextField = new TextField("Invitation key:");
    invitationTextField.setWidth("300px");
    invitationTextField.setRequired(true);
    invitationTextField.setInputPrompt("Your questionnair invitation key (eg. 12345678)");
    invitationTextField.setInvalidAllowed(false);

    // Create login button
    enterButton = new Button("Enter", this);

    // Add both to a panel
    VerticalLayout fields = new VerticalLayout(languageSelector, invitationTextField, enterButton);
    fields.setCaption("Please enter your invitation key to access the questionnair");
    fields.setSpacing(true);
    fields.setMargin(new MarginInfo(true, true, true, false));
    fields.setSizeUndefined();

    // The view root layout
    VerticalLayout viewLayout = new VerticalLayout(fields);
    viewLayout.setSizeFull();
    viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);
    viewLayout.setStyleName(Reindeer.LAYOUT_BLUE);
    setCompositionRoot(viewLayout);
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:59,代码来源:OldLoginView.java


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