當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。