本文整理汇总了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;
}
示例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());
}
}
示例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;
}
示例4: addLocale
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private void addLocale(Locale locale, ComboBox languageSelector) {
languageSelector.addItem(locale);
languageSelector.setItemCaption(locale, "XX");
}
示例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);
}