use of com.vaadin.flow.component.select.Select in project karnak by OsiriX-Foundation.
the class MonitorView method buildwadoNodeListSelector.
private void buildwadoNodeListSelector() {
wadoNodeListSelector = new Select<>();
wadoNodeListSelector.setEmptySelectionAllowed(false);
WadoNodeList pacsProdWadoNodeList = Util.readWadoNodes(this.getClass().getResource("/config/pacs-wado-web.csv"), "Public web");
wadoNodeListSelector.setItems(pacsProdWadoNodeList);
wadoNodeListSelector.addValueChangeListener((ValueChangeListener<ValueChangeEvent<WadoNodeList>>) event -> logic.wadoNodeListSelected(event.getValue()));
if (!pacsProdWadoNodeList.isEmpty()) {
wadoNodeListSelector.setValue(pacsProdWadoNodeList);
}
}
use of com.vaadin.flow.component.select.Select in project linkki by linkki-framework.
the class GenericAvailableValuesAspectDefinitionTest method testHandleNullItems_NativeSelect_NoNull.
@Test
public void testHandleNullItems_NativeSelect_NoNull() {
GenericAvailableValuesAspectDefinition hasItemsAvailableValuesAspectDefinition = new GenericAvailableValuesAspectDefinition(AvailableValuesType.DYNAMIC);
Select<TestEnum> nativeSelect = new Select<>();
ComponentWrapper componentWrapper = new NoLabelComponentWrapper(nativeSelect, WrapperType.FIELD);
hasItemsAvailableValuesAspectDefinition.handleNullItems(componentWrapper, new LinkedList<>(Arrays.asList(TestEnum.TWO)));
assertThat(nativeSelect.isEmptySelectionAllowed(), is(false));
}
use of com.vaadin.flow.component.select.Select in project komunumo-server by komunumo.
the class PageDialog method createForm.
@Override
public void createForm(@NotNull final FormLayout formLayout, @NotNull final Binder<Page> binder) {
final var parent = new Select<>(PageParent.values());
final var pageUrl = new TextField("URL");
final var title = new TextField("Title");
final var content = new RichTextEditor();
parent.setLabel("Parent");
parent.setRequiredIndicatorVisible(true);
parent.addValueChangeListener(changeEvent -> pageUrl.setPrefixComponent(new Span("%s/".formatted(URLUtil.createReadableUrl(changeEvent.getValue().getLiteral())))));
pageUrl.setRequiredIndicatorVisible(true);
pageUrl.setValueChangeMode(EAGER);
title.setRequiredIndicatorVisible(true);
title.setValueChangeMode(EAGER);
formLayout.add(parent, pageUrl, title, new CustomLabel("Content"), content);
binder.forField(parent).withValidator(Objects::nonNull, "Please select the parent navigation").bind(Page::getParent, Page::setParent);
binder.forField(pageUrl).withValidator(new StringLengthValidator("Please enter the URL of the page (max. 255 chars)", 1, 255)).bind(Page::getPageUrl, Page::setPageUrl);
binder.forField(title).withValidator(new StringLengthValidator("Please enter the title of the page (max. 255 chars)", 1, 255)).bind(Page::getTitle, Page::setTitle);
binder.forField(content.asHtml()).withValidator(new StringLengthValidator("The content is too long (max. 8'000 chars)", 0, 8_000)).bind(Page::getContent, Page::setContent);
}
use of com.vaadin.flow.component.select.Select in project komunumo-server by komunumo.
the class MailTemplateDialog method createForm.
@Override
public void createForm(@NotNull final FormLayout formLayout, @NotNull final Binder<MailTemplateRecord> binder) {
final var id = new Select<>(mailTemplateIds.stream().map(MailTemplateId::name).toArray(String[]::new));
id.setRequiredIndicatorVisible(true);
id.setLabel("ID");
formLayout.add(id);
final var subject = new TextField("Subject");
subject.setRequiredIndicatorVisible(true);
subject.setValueChangeMode(EAGER);
formLayout.add(subject);
final var contentText = new TextArea();
contentText.setRequiredIndicatorVisible(true);
formLayout.add(new CustomLabel("Content as plain text"), contentText);
final var contentHTML = new RichTextEditor();
contentHTML.setRequiredIndicatorVisible(true);
formLayout.add(new CustomLabel("Content as formatted HTML"), contentHTML);
binder.forField(id).withValidator(Objects::nonNull, "Please select the ID").bind(MailTemplateRecord::getId, MailTemplateRecord::setId);
binder.forField(subject).withValidator(new StringLengthValidator("Please enter the subject (max. 255 chars)", 1, 255)).bind(MailTemplateRecord::getSubject, MailTemplateRecord::setSubject);
binder.forField(contentText).withValidator(new StringLengthValidator("Please enter the content as plain text (max. 8'000 chars)", 1, 8_000)).bind(MailTemplateRecord::getContentText, MailTemplateRecord::setContentText);
binder.forField(contentHTML.asHtml()).withValidator(new StringLengthValidator("Please enter the content as formattet HTML (max. 8'000 chars)", 1, 8_000)).bind(MailTemplateRecord::getContentHtml, MailTemplateRecord::setContentHtml);
afterOpen = () -> id.setReadOnly(id.getValue() != null);
}
use of com.vaadin.flow.component.select.Select in project Test-Bench-Data by DanielMartensson.
the class UserSettingsView method init.
@PostConstruct
public void init() {
// Create a text field, password field and a button
Select<String> selectedUser = new Select<String>(masterName, slaveName);
selectedUser.setLabel("Select user");
PasswordField newPassword = new PasswordField("New password");
Button save = new Button("Save new password");
// Add a listener to the button
save.addClickListener(e -> {
// Check if it's selected
if (selectedUser.isEmpty())
return;
// See if you have right to change the password
if (userPasswordService.loggedInUserIsMaster()) {
userPasswordService.changePassword(selectedUser.getValue(), newPassword.getValue());
Notification.show("Success!", 3000, Position.BOTTOM_START);
} else {
Notification.show("You don't have master rights to change password!", 3000, Position.BOTTOM_START);
}
});
add(selectedUser, newPassword, save);
}
Aggregations