Search in sources :

Example 21 with Checkbox

use of com.vaadin.flow.component.checkbox.Checkbox in project furms by unity-idm.

the class InvitationsView method createInvitationGrid.

private Grid<InvitationGridModel> createInvitationGrid(Map<InvitationId, Checkbox> checkboxes, Component mainContextMenu) {
    final Grid<InvitationGridModel> grid;
    grid = new DenseGrid<>(InvitationGridModel.class);
    grid.addComponentColumn(invitationGridModel -> {
        Checkbox checkbox = new Checkbox();
        checkboxes.put(invitationGridModel.id, checkbox);
        return new HorizontalLayout(checkbox, new Label(invitationGridModel.resourceName));
    }).setHeader(new HorizontalLayout(mainContextMenu, new Label(getTranslation("view.user-settings.invitations.grid.1"))));
    grid.addColumn(x -> x.role).setHeader(getTranslation("view.user-settings.invitations.grid.2")).setSortable(true);
    grid.addColumn(x -> x.originator).setHeader(getTranslation("view.user-settings.invitations.grid.3")).setSortable(true);
    grid.addColumn(x -> x.expiration.format(dateTimeFormatter)).setHeader(getTranslation("view.user-settings.invitations.grid.4")).setSortable(true);
    grid.addComponentColumn(x -> createContextMenu(x.id)).setHeader(getTranslation("view.user-settings.invitations.grid.5")).setTextAlign(ColumnTextAlign.END);
    return grid;
}
Also used : UTCTimeUtils.convertToZoneTime(io.imunity.furms.utils.UTCTimeUtils.convertToZoneTime) Component(com.vaadin.flow.component.Component) NotificationUtils.showErrorNotification(io.imunity.furms.ui.utils.NotificationUtils.showErrorNotification) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) LoggerFactory(org.slf4j.LoggerFactory) Label(com.vaadin.flow.component.html.Label) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog) MenuButton(io.imunity.furms.ui.components.MenuButton) HashMap(java.util.HashMap) InvitationNotExistingException(io.imunity.furms.api.validation.exceptions.InvitationNotExistingException) PageTitle(io.imunity.furms.ui.components.PageTitle) Route(com.vaadin.flow.router.Route) DenseGrid(io.imunity.furms.ui.components.DenseGrid) FurmsViewComponent(io.imunity.furms.ui.components.FurmsViewComponent) Map(java.util.Map) UserSettingsMenu(io.imunity.furms.ui.views.user_settings.UserSettingsMenu) Grid(com.vaadin.flow.component.grid.Grid) UIContext(io.imunity.furms.ui.user_context.UIContext) Logger(org.slf4j.Logger) MethodHandles(java.lang.invoke.MethodHandles) Set(java.util.Set) GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) Collectors(java.util.stream.Collectors) ZoneId(java.time.ZoneId) Checkbox(com.vaadin.flow.component.checkbox.Checkbox) DateTimeFormatter(java.time.format.DateTimeFormatter) ColumnTextAlign(com.vaadin.flow.component.grid.ColumnTextAlign) InvitationId(io.imunity.furms.domain.invitations.InvitationId) Optional(java.util.Optional) CLOSE_CIRCLE(com.vaadin.flow.component.icon.VaadinIcon.CLOSE_CIRCLE) CHECK_CIRCLE(com.vaadin.flow.component.icon.VaadinIcon.CHECK_CIRCLE) Dialog(com.vaadin.flow.component.dialog.Dialog) InviteeService(io.imunity.furms.api.invitations.InviteeService) ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout) Checkbox(com.vaadin.flow.component.checkbox.Checkbox) Label(com.vaadin.flow.component.html.Label) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 22 with Checkbox

use of com.vaadin.flow.component.checkbox.Checkbox in project furms by unity-idm.

the class SettingsView method sshKeyFromMandatory.

private Checkbox sshKeyFromMandatory(Binder<SiteSettingsDto> binder) {
    Checkbox sshKeyFromMandatoryCheckbox = new Checkbox(getTranslation("view.site-admin.settings.form.sshKeyFromOptionMandatory"));
    binder.forField(sshKeyFromMandatoryCheckbox).bind(SiteSettingsDto::isSshKeyFromOptionMandatory, SiteSettingsDto::setSshKeyFromOptionMandatory);
    return sshKeyFromMandatoryCheckbox;
}
Also used : Checkbox(com.vaadin.flow.component.checkbox.Checkbox)

Example 23 with Checkbox

use of com.vaadin.flow.component.checkbox.Checkbox in project furms by unity-idm.

the class SettingsView method prohibitOldSSHKey.

private Checkbox prohibitOldSSHKey(Binder<SiteSettingsDto> binder) {
    Checkbox prohibitOldSSHkeys = new Checkbox(getTranslation("view.site-admin.settings.form.prohibitOldSSHkeys"));
    binder.forField(prohibitOldSSHkeys).bind(SiteSettingsDto::isProhibitOldsshKeys, SiteSettingsDto::setProhibitOldsshKeys);
    return prohibitOldSSHkeys;
}
Also used : Checkbox(com.vaadin.flow.component.checkbox.Checkbox)

Example 24 with Checkbox

use of com.vaadin.flow.component.checkbox.Checkbox in project linkki by linkki-framework.

the class OverflowIssues method vaadinBugCheckbox.

// Vaadin Bug https://github.com/vaadin/flow-components/issues/2873
private void vaadinBugCheckbox() {
    add(new Label("Checkbox Outline should be rectangular:"));
    HorizontalLayout wrapper = new HorizontalLayout();
    Checkbox cb = new Checkbox();
    cb.setLabel("I am a checkbox");
    cb.getStyle().set("outline", "auto");
    wrapper.add(cb);
    add(wrapper);
}
Also used : Checkbox(com.vaadin.flow.component.checkbox.Checkbox) Label(com.vaadin.flow.component.html.Label) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 25 with Checkbox

use of com.vaadin.flow.component.checkbox.Checkbox in project linkki by linkki-framework.

the class UICheckBoxIntegrationTest method testSetReadOnly.

@Test
void testSetReadOnly() {
    Checkbox checkBox = getComponentById("dynamicReadonlyCheckBox");
    assertThat(checkBox, is(instanceOf(LinkkiCheckBox.class)));
    assertThat(checkBox.isReadOnly(), is(false));
    assertThat(checkBox.isEnabled(), is(true));
    assertThat(checkBox.getElement().hasAttribute("readonly"), is(false));
    getDefaultPmo().setDynamicReadonlyCheckBoxReadOnly(true);
    modelChanged();
    assertThat(checkBox.isReadOnly(), is(true));
    assertThat(checkBox.isEnabled(), is(false));
    assertThat(checkBox.getElement().hasAttribute("readonly"), is(true));
}
Also used : Checkbox(com.vaadin.flow.component.checkbox.Checkbox) Test(org.junit.jupiter.api.Test)

Aggregations

Checkbox (com.vaadin.flow.component.checkbox.Checkbox)68 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)16 Div (com.vaadin.flow.component.html.Div)14 TextField (com.vaadin.flow.component.textfield.TextField)14 Route (com.vaadin.flow.router.Route)14 Button (com.vaadin.flow.component.button.Button)12 Grid (com.vaadin.flow.component.grid.Grid)12 Label (com.vaadin.flow.component.html.Label)12 Collectors (java.util.stream.Collectors)10 Component (com.vaadin.flow.component.Component)8 NativeButton (com.vaadin.flow.component.html.NativeButton)8 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)8 Optional (java.util.Optional)8 Binder (com.vaadin.flow.data.binder.Binder)7 EmailValidator (com.vaadin.flow.data.validator.EmailValidator)7 Set (java.util.Set)7 FurmsViewComponent (io.imunity.furms.ui.components.FurmsViewComponent)6 PageTitle (io.imunity.furms.ui.components.PageTitle)6 NotificationUtils.showErrorNotification (io.imunity.furms.ui.utils.NotificationUtils.showErrorNotification)6 DateTimeFormatter (java.time.format.DateTimeFormatter)6