本文整理汇总了Java中com.vaadin.ui.ComboBox.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.setEnabled方法的具体用法?Java ComboBox.setEnabled怎么用?Java ComboBox.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.ComboBox
的用法示例。
在下文中一共展示了ComboBox.setEnabled方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPolicyComboBox
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
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;
}
示例2: serviceTableClicked
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@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);
}
}
示例3: createDomainComboBox
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
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;
}
示例4: createEncapsulationTypeComboBox
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
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;
}
示例5: 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;
}
示例6: buildSelection
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
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());
}
});
}
示例7: getFailurePolicyComboBox
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private ComboBox getFailurePolicyComboBox() {
ComboBox failurePolicy = new ComboBox("Select Failure Policy");
failurePolicy.setTextInputAllowed(false);
failurePolicy.setNullSelectionAllowed(false);
failurePolicy.setImmediate(true);
failurePolicy.setRequired(true);
failurePolicy.setRequiredError("Failure Policy cannot be empty");
failurePolicy.addItems(FailurePolicyType.FAIL_OPEN, FailurePolicyType.FAIL_CLOSE);
failurePolicy.select(FailurePolicyType.FAIL_OPEN);
failurePolicy.setEnabled(false);
return failurePolicy;
}
示例8: 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);
}
示例9: populateServiceTable
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void populateServiceTable() throws Exception {
// TODO: Future. Convert this table into Bean container and add DTOs in
// it.
// creating Virtual System Table
this.serviceTable.addContainerProperty(PROPERTY_ID_CHAIN_ORDER, Long.class, null);
this.serviceTable.addContainerProperty(PROPERTY_ID_ENABLED, Boolean.class, false);
this.serviceTable.addContainerProperty(PROPERTY_ID_DA, String.class, null);
this.serviceTable.addContainerProperty(PROPERTY_ID_POLICY, ComboBox.class, null);
this.serviceTable.addContainerProperty(PROPERTY_ID_FAILURE_POLICY, ComboBox.class, null);
this.serviceTable.removeAllItems();
this.allBindings = this.listSecurityGroupBindingsBySgService
.dispatch(new BaseIdRequest(this.currentSecurityGroup.getId())).getMemberList();
for (VirtualSystemPolicyBindingDto binding : this.allBindings) {
List<PolicyDto> policies = binding.getPolicies();
ComboBox policyComboBox = getPolicyComboBox(policies);
policyComboBox.setRequired(policies != null && policies.size() > 0);
ComboBox failurePolicyComboBox = getFailurePolicyComboBox();
this.serviceTable.addItem(
new Object[] { binding.getOrder(), binding.getName(), policyComboBox, failurePolicyComboBox },
binding.getVirtualSystemId());
if (binding.isBinded() && !binding.getPolicyIds().isEmpty()) {
// For any existing bindings, set enabled and set the order
// value
this.serviceTable.getContainerProperty(binding.getVirtualSystemId(), PROPERTY_ID_ENABLED)
.setValue(true);
ComboBox comboBoxPolicy = (ComboBox) this.serviceTable
.getContainerProperty(binding.getVirtualSystemId(), PROPERTY_ID_POLICY).getValue();
comboBoxPolicy.setEnabled(policies != null && !isBindedWithMultiplePolicies(binding));
for (Object comboBoxItemId : comboBoxPolicy.getContainerDataSource().getItemIds()) {
if (comboBoxPolicy.getItem(comboBoxItemId).getItemProperty("id").getValue()
.equals(binding.getPolicyIds().iterator().next())) {
comboBoxPolicy.select(comboBoxItemId);
break;
}
}
}
ComboBox comboBoxFailurePolicy = (ComboBox) this.serviceTable
.getContainerProperty(binding.getVirtualSystemId(), PROPERTY_ID_FAILURE_POLICY).getValue();
if (binding.getFailurePolicyType() != FailurePolicyType.NA) {
if (binding.isBinded()) {
comboBoxFailurePolicy.setEnabled(true);
}
comboBoxFailurePolicy.setData(binding.getFailurePolicyType());
comboBoxFailurePolicy.select(binding.getFailurePolicyType());
} else {
comboBoxFailurePolicy.setData(null);
comboBoxFailurePolicy.setEnabled(false);
}
}
sortByChainOrder();
if (this.serviceTable.getItemIds().size() > 0) {
this.serviceTable.select(this.serviceTable.getItemIds().iterator().next());
}
}
示例10: 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);
}
}
示例11: 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);
}
}
}