本文整理汇总了Java中com.vaadin.ui.ComboBox.setItemCaptionMode方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.setItemCaptionMode方法的具体用法?Java ComboBox.setItemCaptionMode怎么用?Java ComboBox.setItemCaptionMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.ComboBox
的用法示例。
在下文中一共展示了ComboBox.setItemCaptionMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEditFields
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@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;
}
示例2: TimeZoneSelectionField
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
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);
}
示例3: 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());
}
}
示例4: attach
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@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);
keySelect.addContainerProperty(KEY_CAPTION_ID, String.class, null);
keySelect.setItemCaptionPropertyId(KEY_CAPTION_ID);
keySelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
// Windowsの場合はキーペアを無効にする
if (StringUtils.startsWith(image.getImage().getOs(), PCCConstant.OS_NAME_WIN)) {
keySelect.setEnabled(false);
}
form.getLayout().addComponent(keySelect);
// クラスタ
clusterSelect = new ComboBox(ViewProperties.getCaption("field.cluster"));
clusterSelect.setNullSelectionAllowed(false);
form.getLayout().addComponent(clusterSelect);
// ルートサイズ
rootSizeField = new TextField(ViewProperties.getCaption("field.rootSize"));
rootSizeField.setImmediate(true);
form.getLayout().addComponent(rootSizeField);
addComponent(form);
}
示例5: NewTicketWindow
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
NewTicketWindow(Date date, final Integer prjId, final Integer milestoneId, boolean isIncludeMilestone) {
super(UserUIContext.getMessage(TicketI18nEnum.NEW));
MVerticalLayout content = new MVerticalLayout();
withModal(true).withResizable(false).withCenter().withWidth("1200px").withContent(content);
typeSelection = new ComboBox();
typeSelection.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
typeSelection.addItem(UserUIContext.getMessage(TaskI18nEnum.SINGLE));
typeSelection.setItemIcon(UserUIContext.getMessage(TaskI18nEnum.SINGLE), ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK));
}
if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) {
typeSelection.addItem(UserUIContext.getMessage(BugI18nEnum.SINGLE));
typeSelection.setItemIcon(UserUIContext.getMessage(BugI18nEnum.SINGLE), ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG));
}
if (isIncludeMilestone && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) {
typeSelection.addItem(UserUIContext.getMessage(MilestoneI18nEnum.SINGLE));
typeSelection.setItemIcon(UserUIContext.getMessage(MilestoneI18nEnum.SINGLE), ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE));
}
typeSelection.setNullSelectionAllowed(false);
if (CollectionUtils.isNotEmpty(typeSelection.getItemIds())) {
typeSelection.select(typeSelection.getItemIds().iterator().next());
} else {
throw new SecureAccessException();
}
typeSelection.setNullSelectionAllowed(false);
typeSelection.addValueChangeListener(valueChangeEvent -> doChange(date, prjId, milestoneId));
GridFormLayoutHelper formLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 1);
formLayoutHelper.addComponent(typeSelection, UserUIContext.getMessage(GenericI18Enum.FORM_TYPE), 0, 0);
formLayout = new CssLayout();
formLayout.setWidth("100%");
content.with(formLayoutHelper.getLayout(), formLayout);
doChange(date, prjId, milestoneId);
}
示例6: build
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public Field<?> build(Class<?> clazz, String name) {
ComboBox combo = new ComboBox();
fillComboBox(combo, clazz, name);
combo.setItemCaptionMode(ItemCaptionMode.ID);
return combo;
}
示例7: addBooleanFilter
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
* Ajoute un filtre de Boolean sur une liste de colonnes
*
* @param filterRow
* @param container
* @param property
* @param labelTrue
* @param labelFalse
* @param labelNull
*/
private void addBooleanFilter(String property, String labelTrue, String labelFalse, String labelNull) {
HeaderCell cell = getFilterCell(property);
ComboBox cbOuiNon = new ComboBox();
cbOuiNon.setTextInputAllowed(false);
List<BooleanPresentation> liste = new ArrayList<BooleanPresentation>();
BooleanPresentation nullObject = new BooleanPresentation(BooleanValue.ALL,
applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()), null);
liste.add(nullObject);
if (labelTrue != null) {
liste.add(new BooleanPresentation(BooleanValue.TRUE, labelTrue, FontAwesome.CHECK_SQUARE_O));
}
if (labelFalse != null) {
liste.add(new BooleanPresentation(BooleanValue.FALSE, labelFalse, FontAwesome.SQUARE_O));
}
if (labelNull != null) {
liste.add(new BooleanPresentation(BooleanValue.NULL, labelNull, FontAwesome.HOURGLASS_HALF));
}
BeanItemContainer<BooleanPresentation> containerOuiNon = new BeanItemContainer<BooleanPresentation>(
BooleanPresentation.class, liste);
cbOuiNon.setNullSelectionItemId(nullObject);
cbOuiNon.setImmediate(true);
cbOuiNon.setContainerDataSource(containerOuiNon);
cbOuiNon.setItemCaptionPropertyId("libelle");
cbOuiNon.setItemCaptionMode(ItemCaptionMode.PROPERTY);
cbOuiNon.setItemIconPropertyId("icone");
cbOuiNon.setWidth(100, Unit.PERCENTAGE);
cbOuiNon.addStyleName(ValoTheme.COMBOBOX_TINY);
cbOuiNon.addValueChangeListener(change -> {
container.removeContainerFilters(property);
if (cbOuiNon.getValue() != null) {
BooleanPresentation value = (BooleanPresentation) cbOuiNon.getValue();
if (value != null) {
BooleanValue booleanValue = value.getValeur();
switch (booleanValue) {
case TRUE:
container.addContainerFilter(new Equal(property, true));
break;
case FALSE:
container.addContainerFilter(new Equal(property, false));
break;
case NULL:
container.addContainerFilter(new Equal(property, null));
break;
default:
break;
}
}
fireFilterListener();
}
});
cell.setComponent(cbOuiNon);
}
示例8: VcloudDetailTab
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
public VcloudDetailTab(InstanceDto instance, PlatformDto platform, ImageDto image) {
this.instance = instance;
this.platform = platform;
this.image = image;
setHeight(TAB_HEIGHT);
setMargin(false, true, false, true);
setSpacing(false);
//ストレージタイプ
storageTypeSelect = new ComboBox(ViewProperties.getCaption("field.storageType"));
storageTypeSelect.setWidth(WIDTH_COMBOBOX);
storageTypeSelect.setNullSelectionAllowed(false);
storageTypeSelect.setItemCaptionPropertyId(CID_STORAGE_TYPE);
storageTypeSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
//サーバサイズ
sizeSelect = new ComboBox(ViewProperties.getCaption("field.serverSize"));
sizeSelect.setWidth(WIDTH_COMBOBOX);
sizeSelect.setNullSelectionAllowed(false);
//キーペア
keySelect = new ComboBox(ViewProperties.getCaption("field.keyPair"));
keySelect.setWidth(KEY_PAIR_WIDTH_COMBOBOX);
keySelect.setNullSelectionAllowed(false);
keySelect.setItemCaptionPropertyId(CID_KEY_PAIR);
keySelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
// Windowsの場合はキーペアを無効にする
if (StringUtils.startsWith(image.getImage().getOs(), PCCConstant.OS_NAME_WIN)) {
keySelect.setEnabled(false);
}
Label spacer = new Label(" ");
spacer.addStyleName("desc-padding-horizontal");
spacer.setHeight("5px");
//データディスクテーブル
dataDiskTable = new DataDiskTable();
//データディスクボタン
dataDiskTableButtons = new DataDiskTableButtons();
form.getLayout().addComponent(storageTypeSelect);
form.getLayout().addComponent(sizeSelect);
form.getLayout().addComponent(keySelect);
form.getLayout().addComponent(spacer);
form.getLayout().addComponent(dataDiskTable);
form.getLayout().addComponent(dataDiskTableButtons);
addComponent(form);
// サーバがStopped以外の場合は、変更不可とする
InstanceStatus status = InstanceStatus.fromStatus(instance.getInstance().getStatus());
if (status != InstanceStatus.STOPPED) {
storageTypeSelect.setEnabled(false);
sizeSelect.setEnabled(false);
keySelect.setEnabled(false);
}
}
示例9: AzureDetailTab
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
public AzureDetailTab(InstanceDto instance, PlatformDto platform, ImageDto image) {
this.instance = instance;
this.platform = platform;
this.image = image;
setHeight(TAB_HEIGHT);
setMargin(false, true, false, true);
setSpacing(false);
sizeSelect = new ComboBox(ViewProperties.getCaption("field.serverSize"));
sizeSelect.setWidth(COMBOBOX_WIDTH);
sizeSelect.setNullSelectionAllowed(false);
availabilitySetSelect = new ComboBox(ViewProperties.getCaption("field.availabilitySet"));
availabilitySetSelect.setWidth(COMBOBOX_WIDTH);
availabilitySetSelect.setNullSelectionAllowed(false);
locationField = new TextField(ViewProperties.getCaption("field.location"));
locationField.setImmediate(true);
locationField.setWidth(TEXT_WIDTH);
affinityField = new TextField(ViewProperties.getCaption("field.affinityGroup"));
affinityField.setImmediate(true);
affinityField.setWidth(TEXT_WIDTH);
cloudServiceField = new TextField(ViewProperties.getCaption("field.cloudService"));
cloudServiceField.setImmediate(true);
cloudServiceField.setWidth(TEXT_WIDTH);
subnetSelect = new ComboBox(ViewProperties.getCaption("field.subnet"));
subnetSelect.setImmediate(true);
subnetSelect.setWidth(COMBOBOX_WIDTH);
subnetSelect.setNullSelectionAllowed(false);
subnetSelect.setItemCaptionPropertyId(CIDR_BLOCK_CAPTION_ID);
subnetSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
storageAccountField = new TextField(ViewProperties.getCaption("field.storageAccount"));
storageAccountField.setImmediate(true);
storageAccountField.setWidth(COMBOBOX_WIDTH);
Label spacer = new Label(" ");
spacer.addStyleName("desc-padding-horizontal");
spacer.setHeight("5px");
form.getLayout().addComponent(sizeSelect);
form.getLayout().addComponent(availabilitySetSelect);
form.getLayout().addComponent(subnetSelect);
form.getLayout().addComponent(spacer);
HorizontalLayout layout = new HorizontalLayout();
layout.setSpacing(true);
layout.setMargin(false);
form.getLayout().addComponent(layout);
addComponent(form);
InstanceStatus status = InstanceStatus.fromStatus(instance.getInstance().getStatus());
if (status != InstanceStatus.STOPPED) {
// サーバがStopped以外の場合は、詳細設定タブ自体を変更不可とする
form.setEnabled(false);
} else {
// 停止時は、いくつかの項目を変更不可とする
locationField.setEnabled(false);
// サーバが作成済みのとき、変更不可
if (StringUtils.isNotEmpty(instance.getAzureInstance().getInstanceName())) {
subnetSelect.setEnabled(false);
// TODO 可用性セットが設定済みの場合も変更可能かもしれないが、
// 現段階では、APIから可用性セットの情報を取得できないのでサーバー作成済みの場合、変更不可とする
availabilitySetSelect.setEnabled(false);
}
}
}
示例10: OpenStackDetailTab
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
public OpenStackDetailTab(InstanceDto instance, PlatformDto platform, ImageDto image) {
this.instance = instance;
this.platform = platform;
this.image = image;
setHeight(TAB_HEIGHT);
setMargin(false, true, false, true);
setSpacing(false);
sizeSelect = new ComboBox(ViewProperties.getCaption("field.serverSize"));
sizeSelect.setWidth(COMBOBOX_WIDTH);
sizeSelect.setNullSelectionAllowed(false);
zoneSelect = new ComboBox(ViewProperties.getCaption("field.zone"));
zoneSelect.setWidth(COMBOBOX_WIDTH);
zoneSelect.setNullSelectionAllowed(false);
zoneSelect.setItemCaptionPropertyId(ZONE_CAPTION_ID);
zoneSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
grpSelect = new ComboBox(ViewProperties.getCaption("field.securityGroup"));
grpSelect.setWidth(COMBOBOX_WIDTH);
grpSelect.setImmediate(true);
grpSelect.setNullSelectionAllowed(false);
keySelect = new ComboBox(ViewProperties.getCaption("field.keyPair"));
keySelect.setWidth(COMBOBOX_WIDTH);
keySelect.setNullSelectionAllowed(false);
Label spacer = new Label(" ");
spacer.addStyleName("desc-padding-horizontal");
spacer.setHeight("5px");
form.getLayout().addComponent(sizeSelect);
form.getLayout().addComponent(zoneSelect);
form.getLayout().addComponent(grpSelect);
form.getLayout().addComponent(keySelect);
form.getLayout().addComponent(spacer);
HorizontalLayout layout = new HorizontalLayout();
layout.setSpacing(true);
layout.setMargin(false);
form.getLayout().addComponent(layout);
addComponent(form);
InstanceStatus status = InstanceStatus.fromStatus(instance.getInstance().getStatus());
if (status != InstanceStatus.STOPPED) {
// サーバがStopped以外の場合は、詳細設定タブ自体を変更不可とする
form.setEnabled(false);
} else {
// 停止時は、いくつかの項目を変更不可とする
if (StringUtils.isNotEmpty(instance.getOpenstackInstance().getInstanceId())) {
// 一度でも起動した場合、項目を変更不可とする
form.setEnabled(false);
}
}
}
示例11: attach
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
public void attach() {
// メインフォーム
Form mainForm = new Form();
Layout mainLayout = mainForm.getLayout();
addComponent(mainForm);
// ロードバランサ名
nameField = new TextField(ViewProperties.getCaption("field.loadBalancerName"));
nameField.setReadOnly(true);
mainLayout.addComponent(nameField);
// サービス名
serviceField = new TextField(ViewProperties.getCaption("field.loadBalancerService"));
serviceField.setReadOnly(true);
mainLayout.addComponent(serviceField);
// ロードバランサ設定パネル
Panel panel = new Panel(ViewProperties.getCaption("field.loadBalancerConfig"));
((Layout) panel.getContent()).setMargin(false, false, false, true);
mainLayout.addComponent(panel);
// サブフォーム
subForm = new Form();
FormLayout sublayout = (FormLayout) this.subForm.getLayout();
sublayout.setMargin(false);
sublayout.setSpacing(false);
panel.getContent().addComponent(subForm);
subForm.setHeight("200px");
// ロードバランサポート
loadBalancerPortField = new TextField(ViewProperties.getCaption("field.loadBalancerPort"));
loadBalancerPortField.setWidth(TEXT_WIDTH);
sublayout.addComponent(loadBalancerPortField);
// サービスポート
servicePortField = new TextField(ViewProperties.getCaption("field.loadBalancerServicePort"));
servicePortField.setWidth(TEXT_WIDTH);
sublayout.addComponent(servicePortField);
// プロトコル
protocolSelect = new ComboBox(ViewProperties.getCaption("field.loadBalancerProtocol"));
protocolSelect.setWidth(TEXT_WIDTH);
protocolSelect.setImmediate(true);
sublayout.addComponent(protocolSelect);
protocolSelect.addListener(new Property.ValueChangeListener() {
@Override
public void valueChange(Property.ValueChangeEvent event) {
protocolValueChange(event);
}
});
// SSLキー
sslKeySelect = new ComboBox(ViewProperties.getCaption("field.loadBalancerSSLKey"));
sslKeySelect.setWidth(TEXT_WIDTH);
sslKeySelect.addContainerProperty(SSLKEY_CAPTION_ID, String.class, null);
sslKeySelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
sslKeySelect.setItemCaptionPropertyId(SSLKEY_CAPTION_ID);
sublayout.addComponent(sslKeySelect);
initValidation();
}
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:63,代码来源:WinLoadBalancerConfigListener.java
示例12: attach
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
public void attach() {
setHeight(TAB_HEIGHT);
setMargin(false, true, false, true);
setSpacing(false);
// フォーム
Form form = new Form();
form.setSizeFull();
addComponent(form);
// ロードバランサ名
loadBalancerNameField = new TextField(ViewProperties.getCaption("field.loadBalancerName"));
form.getLayout().addComponent(loadBalancerNameField);
// コメント
commentField = new TextField(ViewProperties.getCaption("field.comment"));
commentField.setWidth("95%");
form.getLayout().addComponent(commentField);
// プラットフォーム
cloudLabel = new Label();
cloudLabel.setCaption(ViewProperties.getCaption("field.cloud"));
cloudLabel.addStyleName("icon-label");
form.getLayout().addComponent(cloudLabel);
// ロードバランサ種別
typeLabel = new Label();
typeLabel.setCaption(ViewProperties.getCaption("field.loadBalancerType"));
typeLabel.addStyleName("icon-label");
form.getLayout().addComponent(typeLabel);
// 割り当てサービス
serviceSelect = new ComboBox();
serviceSelect.setCaption(ViewProperties.getCaption("field.loadBalancerService"));
serviceSelect.setNullSelectionAllowed(false);
serviceSelect.addContainerProperty(SERVICE_CAPTION_ID, String.class, null);
serviceSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
serviceSelect.setItemCaptionPropertyId(SERVICE_CAPTION_ID);
form.getLayout().addComponent(serviceSelect);
// アルゴリズム
algorithmSelect = new ComboBox();
algorithmSelect.setCaption(ViewProperties.getCaption("field.algorithm"));
algorithmSelect.setNullSelectionAllowed(false);
form.getLayout().addComponent(algorithmSelect);
// パブリックポート
publicPortField = new TextField(ViewProperties.getCaption("field.publicport"));
publicPortField.setWidth("95%");
form.getLayout().addComponent(publicPortField);
// プライベートポート
privatePortField = new TextField(ViewProperties.getCaption("field.privateport"));
privatePortField.setWidth("95%");
form.getLayout().addComponent(privatePortField);
initValidation();
}
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:60,代码来源:WinCloudStackLoadBalancerEdit.java
示例13: initContent
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
protected Component initContent() {
// A vertical layout with undefined width
final VerticalLayout box = new VerticalLayout();
box.setSizeUndefined();
final ComboBox productSelect = new ComboBox();
productSelect.setInputPrompt("Выберите продукт...");
productSelect.setImmediate(true);
productSelect.setNullSelectionAllowed(false);
// Инициализация контейнера
final ExtaDbContainer<TProduct> clientsCont = new ExtaDbContainer<>(productCls);
clientsCont.addContainerFilter(new Compare.Equal("active", true));
clientsCont.sort(new Object[]{"name"}, new boolean[]{true});
// Устанавливаем контент выбора
productSelect.setFilteringMode(FilteringMode.CONTAINS);
productSelect.setContainerDataSource(clientsCont);
productSelect.setItemCaptionMode(ItemCaptionMode.PROPERTY);
productSelect.setItemCaptionPropertyId("name");
productSelect.addStyleName(ExtaTheme.COMBOBOX_BORDERLESS);
productSelect.setPropertyDataSource(getPropertyDataSource());
productSelect.addValueChangeListener(e -> setValue((TProduct) productSelect.getConvertedValue()));
// productSelect.setValue(getValue());
clientsCont.setSingleSelectConverter(productSelect);
productSelect.setWidth(100, Unit.PERCENTAGE);
box.addComponent(productSelect);
// The layout shrinks to fit this label
final Label label = new Label(getFieldTextLabel());
label.addStyleName("ea-widthfittin-label");
label.setWidthUndefined();
label.setHeight("0px"); // Hide: Could be 0px
box.addComponent(label);
addValueChangeListener(e -> label.setValue(getFieldTextLabel()));
return box;
}
示例14: buildToolbarLayout
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@AutoGenerated
private HorizontalLayout buildToolbarLayout() {
toolbarLayout = new HorizontalLayout();
toolbarLayout.setImmediate(false);
toolbarLayout.setSpacing(true);
ButtonGroup editionButtonGroup = new ButtonGroup();
toolbarLayout.addComponent(editionButtonGroup);
// btnOpenProtocol
btnOpenProtocol = new Button();
btnOpenProtocol.setCaption("Iniciar Job");
btnOpenProtocol.setImmediate(true);
btnOpenProtocol.setWidth("-1px");
btnOpenProtocol.setHeight("-1px");
btnOpenProtocol.setIcon(new ThemeResource("../konekti/images/icons/job-toolbar/bell--arrow.png"));
editionButtonGroup.addButton(btnOpenProtocol);
// btnRecoverProtocol
btnRecoverProtocol = new Button();
btnRecoverProtocol.setCaption("Iniciar Job");
btnRecoverProtocol.setImmediate(true);
btnRecoverProtocol.setWidth("-1px");
btnRecoverProtocol.setHeight("-1px");
btnRecoverProtocol.setIcon(new ThemeResource("../konekti/images/icons/job-toolbar/bell--arrow.png"));
editionButtonGroup.addButton(btnRecoverProtocol);
lblBoxProtocol = new Label("Buzón Protocolo:");
lblBoxProtocol.setVisible(false);
lblBoxProtocol.setWidth("-1px");
lblBoxProtocol.setHeight("-1px");
toolbarLayout.addComponent(lblBoxProtocol);
cmbBoxProtocol = new ComboBox();
cmbBoxProtocol.setVisible(false);
cmbBoxProtocol.setImmediate(true);
cmbBoxProtocol.setWidth("-1px");
cmbBoxProtocol.setHeight("-1px");
cmbBoxProtocol.setNullSelectionAllowed(false);
cmbBoxProtocol.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
cmbBoxProtocol.setItemCaptionPropertyId("box");
toolbarLayout.addComponent(cmbBoxProtocol);
lblTypeProtocol = new Label("Tipo Protocolo:");
lblTypeProtocol.setWidth("-1px");
lblTypeProtocol.setHeight("-1px");
toolbarLayout.addComponent(lblTypeProtocol);
cmbTypeProtocol = new ComboBox();
cmbTypeProtocol.setImmediate(true);
cmbTypeProtocol.setWidth("-1px");
cmbTypeProtocol.setHeight("-1px");
cmbTypeProtocol.setNullSelectionAllowed(true);
cmbTypeProtocol.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
cmbTypeProtocol.setItemCaptionPropertyId("direction");
toolbarLayout.addComponent(cmbTypeProtocol);
return toolbarLayout;
}
示例15: getContent
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
public Component getContent()
{
if (form == null)
{
form = new SimpleFormLayout();
form.setMargin(true);
final Label label = new Label("<h1>Please enter your Group's details.</h1>", ContentMode.HTML);
label.setContentMode(ContentMode.HTML);
form.addComponent(label);
groupName = new TextField("Group Name");
form.addComponent(groupName);
groupTypeField = new ComboBox("Group Type");
groupTypeField.setItemCaptionMode(ItemCaptionMode.ID_TOSTRING);
groupTypeField.setTextInputAllowed(false);
groupTypeField.setRequired(true);
loadGroupTypes();
form.addComponent(groupTypeField);
phoneNo = new TextField("Phone No.");
form.addComponent(phoneNo);
street = new TextField("Street");
form.addComponent(street);
city = new TextField("City/Suburb");
form.addComponent(city);
state = new TextField("State");
form.addComponent(state);
postcode = new TextField("Postcode/Zip Code");
form.addComponent(postcode);
countries = new ComboBox("Country");
loadCountries(countries);
form.addComponent(countries);
groupName.addValidator(
new StringLengthValidator("Group Name must be between 6 and 255 characters long.", 6, 255, false));
groupName.addValidator(value -> {
// tell the user if their group name is unique.
GroupDao groupDao = new DaoFactory().getGroupDao();
String groupNameString = ((String) value).trim();
if (groupNameString.length() > 0)
{
if (groupDao.findByName(groupNameString) != null)
throw new Validator.InvalidValueException("Group name already exists. Please choose another.");
}
});
}
return form;
}