本文整理匯總了Java中com.vaadin.ui.ComboBox.select方法的典型用法代碼示例。如果您正苦於以下問題:Java ComboBox.select方法的具體用法?Java ComboBox.select怎麽用?Java ComboBox.select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.ComboBox
的用法示例。
在下文中一共展示了ComboBox.select方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: populateNetworks
import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
private void populateNetworks(ComboBox networkComboBox, List<OsNetworkDto> networkList) {
try {
networkComboBox.removeAllItems();
if (networkList != null) {
// Calling List Network Service
BeanItemContainer<OsNetworkDto> networkListContainer = new BeanItemContainer<>(OsNetworkDto.class,
networkList);
networkComboBox.setContainerDataSource(networkListContainer);
networkComboBox.setItemCaptionPropertyId("name");
if (networkList.size() > 0) {
networkComboBox.select(networkListContainer.getIdByIndex(0));
}
}
} catch (Exception e) {
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
log.error("Error getting Network List", e);
}
}
示例2: 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;
}
示例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: selectUser
import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
protected void selectUser(String userId, String userName) {
if (!selectedUsersTable.containsId(userId)) {
Item item = selectedUsersTable.addItem(userId);
item.getItemProperty("userName").setValue(userName);
if (showRoles) {
ComboBox comboBox = new ComboBox(null, Arrays.asList(
i18nManager.getMessage(Messages.TASK_ROLE_CONTRIBUTOR),
i18nManager.getMessage(Messages.TASK_ROLE_IMPLEMENTER),
i18nManager.getMessage(Messages.TASK_ROLE_MANAGER),
i18nManager.getMessage(Messages.TASK_ROLE_SPONSOR)));
comboBox.select(i18nManager.getMessage(Messages.TASK_ROLE_CONTRIBUTOR));
comboBox.setNewItemsAllowed(true);
item.getItemProperty("role").setValue(comboBox);
}
}
}
示例5: 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());
}
});
}
示例6: buildSelection
import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
@Override
protected ComboBox buildSelection() {
final ComboBox selectionType = new ComboBox();
selectionType.setTextInputAllowed(false);
selectionType.setNullSelectionAllowed(false);
selectionType.addItem(Messages.getString("Caption.Item.Selected"));
selectionType.addItem(Messages.getString("Caption.Item.All"));
selectionType.select(Messages.getString("Caption.Item.Selected"));
selectionType.addValueChangeListener(e -> {
allSelected = selectionType.getValue().equals(Messages.getString("Caption.Item.All"));
mainEvent.fire(new MainUIEvent.UserSelectionChangedEvent());
});
return selectionType;
}
示例7: buildSelection
import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
@Override
protected ComboBox buildSelection() {
final ComboBox selectionType = new ComboBox();
selectionType.setTextInputAllowed(false);
selectionType.setNullSelectionAllowed(false);
selectionType.addItem(Messages.getString("Caption.Item.Selected"));
selectionType.addItem(Messages.getString("Caption.Item.All"));
selectionType.select(Messages.getString("Caption.Item.Selected"));
selectionType.addValueChangeListener(e -> {
allSelected = selectionType.getValue().equals(Messages.getString("Caption.Item.All"));
mainEvent.fire(new MainUIEvent.GroupSelectionChangedEvent());
});
return selectionType;
}
示例8: 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;
}
示例9: setup
import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
private void setup() {
// Devices
ComboBox devicesComboBox = new ComboBox("Actors");
devicesComboBox.setNullSelectionItemId(false);
devicesComboBox.setContainerDataSource(
new BeanItemContainer<>(
DeviceViewDTO.class,
deviceSetupService.getAllActors().stream()
.map(deviceDTO -> modelMapper.map(deviceDTO, DeviceViewDTO.class))
.collect(Collectors.toList())
)
);
DeviceDTO selectedDeviceDTO = deviceSetupService
.getDeviceDtoByIdAndType(actionDTO.getDevId(), actionDTO.getDevType());
if (selectedDeviceDTO != null) {
devicesComboBox.select(modelMapper.map(selectedDeviceDTO, DeviceViewDTO.class));
}
devicesComboBox.addValueChangeListener(event -> {
DeviceViewDTO selected = (DeviceViewDTO) event.getProperty().getValue();
actionDTO.setDevId(selected.getDevId());
actionDTO.setDevType(selected.getType());
changeListener.accept(actionDTO);
});
mainLayout.addComponent(devicesComboBox);
// Target
TextField targetTextField = new TextField("Target", actionDTO.getParameter());
targetTextField.addValueChangeListener(event -> {
actionDTO.setParameter((String) event.getProperty().getValue());
changeListener.accept(actionDTO);
});
mainLayout.addComponent(targetTextField);
}
示例10: initGroupProperties
import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
protected void initGroupProperties() {
detailsGrid = new GridLayout(2, 3);
detailsGrid.setSpacing(true);
detailLayout.setMargin(true, true, true, false);
detailLayout.addComponent(detailsGrid);
// id
Label idLabel = new Label(i18nManager.getMessage(Messages.GROUP_ID) + ": ");
idLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
detailsGrid.addComponent(idLabel);
Label idValueLabel = new Label(group.getId());
detailsGrid.addComponent(idValueLabel);
// name
Label nameLabel = new Label(i18nManager.getMessage(Messages.GROUP_NAME) + ": ");
nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
detailsGrid.addComponent(nameLabel);
if (!editingDetails) {
Label nameValueLabel = new Label(group.getName());
detailsGrid.addComponent(nameValueLabel);
} else {
nameTextField = new TextField(null, group.getName());
detailsGrid.addComponent(nameTextField);
}
// Type
Label typeLabel = new Label(i18nManager.getMessage(Messages.GROUP_TYPE) + ": ");
typeLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
detailsGrid.addComponent(typeLabel);
if (!editingDetails) {
Label typeValueLabel = new Label(group.getType());
detailsGrid.addComponent(typeValueLabel);
} else {
typeCombobox = new ComboBox(null, Arrays.asList("assignment", "security-role"));
typeCombobox.setNullSelectionAllowed(false);
typeCombobox.setInvalidAllowed(false);
typeCombobox.select(group.getType());
detailsGrid.addComponent(typeCombobox);
}
}
示例11: 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);
}
示例12: initElements
import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
protected void initElements() {
type2 = new ComboBox();
type2.setImmediate(true);
type2.setWidth(WIDTH);
lbMeta = new Label("Meta:");
cbMeta = new CheckBox();
cbMeta.setDescription("Is this element Meta data");
optional.setWidth(WIDTH);
type = new ComboBox();
type.setWidth(WIDTH);
type.setNullSelectionAllowed(false);
type.setImmediate(true);
type.addItem(SINGLE_FILE);
type.addItem(MULTI_FILE);
type.select(SINGLE_FILE);
type.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = -1134955257251483403L;
@Override
public void valueChange(ValueChangeEvent event) {
if(type.getValue().toString().contentEquals(SINGLE_FILE)) {
getSingleFileUI();
} else if(type.getValue().toString().contentEquals(MULTI_FILE)){
getMultipleFilesUI();
}
}
});
}
示例13: cargarCalificacionesEvaluacion
import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
public void cargarCalificacionesEvaluacion(EvaluacionBO evaluacion, UsuarioBO evaluador, List<TemaBO> temas, List<NivelDeConocimientoBO> nivelesDeConocimiento, List<CalificacionBO> calificacionesPrevias) {
tablaCalificacionesEvaluacion.removeAllItems();
for (TemaBO tema : temas) {
CalificacionBO calificacion = new CalificacionBO();
calificacion.setEvaluacion(evaluacion);
calificacion.setEvaluador(evaluador.getNombre());
calificacion.setTema(tema);
ComboBox comboBox = new ComboBox();
for (NivelDeConocimientoBO nivelDeConocimientoBO : nivelesDeConocimiento) {
comboBox.addItem(nivelDeConocimientoBO);
}
comboBox.setNullSelectionAllowed(false);
boolean noTieneCalificacion = true;
for (Iterator<CalificacionBO> iterator = calificacionesPrevias.iterator(); noTieneCalificacion && iterator.hasNext();) {
CalificacionBO calificacionBO = (CalificacionBO) iterator.next();
if (tema.equals(calificacionBO.getTema())) {
noTieneCalificacion = false;
comboBox.select(calificacionBO.getNivelDeConocimiento());
calificacion.setNivelDeConocimiento(calificacionBO.getNivelDeConocimiento());
}
}
if (noTieneCalificacion) {
comboBox.select(nivelesDeConocimiento.get(0));
calificacion.setNivelDeConocimiento(nivelesDeConocimiento.get(0));
}
tablaCalificacionesEvaluacion.addItem(new Object[] {tema.getId(), comboBox, tema.getNombre(), tema.getDescripcion()}, calificacion);
}
}
示例14: cargarCalificacionesEvaluacion
import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
public void cargarCalificacionesEvaluacion(EvaluacionBO evaluacion, UsuarioBO evaluador, List<TemaBO> temas, List<NivelDeConocimientoBO> nivelesDeConocimiento, List<CalificacionBO> calificacionesPrevias) {
tablaCalificacionesEvaluacion.removeAllItems();
for (TemaBO tema : temas) {
CalificacionBO calificacion = new CalificacionBO();
calificacion.setEvaluacion(evaluacion);
calificacion.setEvaluador(evaluador.getNombre());
calificacion.setTema(tema);
ComboBox comboBox = new ComboBox();
for (NivelDeConocimientoBO nivelDeConocimientoBO : nivelesDeConocimiento) {
comboBox.addItem(nivelDeConocimientoBO);
}
comboBox.setNullSelectionAllowed(false);
boolean noTieneCalificacion = true;
for (Iterator<CalificacionBO> iterator = calificacionesPrevias.iterator(); noTieneCalificacion && iterator.hasNext();) {
CalificacionBO calificacionBO = (CalificacionBO) iterator.next();
if (tema.equals(calificacionBO.getTema())) {
noTieneCalificacion = false;
comboBox.select(calificacionBO.getNivelDeConocimiento());
calificacion.setNivelDeConocimiento(calificacionBO.getNivelDeConocimiento());
}
}
if (noTieneCalificacion) {
comboBox.select(nivelesDeConocimiento.get(0));
calificacion.setNivelDeConocimiento(nivelesDeConocimiento.get(0));
}
String descripcion = "";
for (SubtemaBO subtema : tema.getSubtemas()) {
descripcion += subtema.getNombre() + ". ";
}
tablaCalificacionesEvaluacion.addItem(new Object[] {tema.getId(), comboBox, tema.getNombre(), descripcion}, calificacion);
}
}
示例15: 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());
}
}