Search in sources :

Example 36 with Checkbox

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

the class SectionHeaderBehaviorComponent method createClosableSection.

public static LinkkiSection createClosableSection() {
    LinkkiSection section = (LinkkiSection) VaadinUiCreator.createComponent(new ClosableSectionPmo(), new BindingContext());
    section.addHeaderButton(new Button("Button 1"));
    section.addHeaderComponent(new ComboBox<String>("Filter", "item1"));
    section.addHeaderButton(new Button("Button 2"));
    section.addHeaderComponent(new Checkbox("Check"));
    // expected order: button 2, button 1, combo box, check box, close toggle
    return section;
}
Also used : Button(com.vaadin.flow.component.button.Button) Checkbox(com.vaadin.flow.component.checkbox.Checkbox) LinkkiSection(org.linkki.core.vaadin.component.section.LinkkiSection) BindingContext(org.linkki.core.binding.BindingContext)

Example 37 with Checkbox

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

the class UICheckBoxIntegrationTest method testCaptionBinding.

@Test
void testCaptionBinding() {
    Checkbox checkBoxWithNoCaption = getDynamicComponent();
    assertThat(checkBoxWithNoCaption.getLabel(), is(emptyString()));
    Checkbox checkBox = getStaticComponent();
    assertThat(checkBox.getLabel(), is(AnnotationTestPmo.TEST_CAPTION));
    Checkbox checkBoxWithDerivedCaption = getComponentById("foo");
    assertThat(checkBoxWithDerivedCaption.getLabel(), is("Foo"));
}
Also used : Checkbox(com.vaadin.flow.component.checkbox.Checkbox) Test(org.junit.jupiter.api.Test)

Example 38 with Checkbox

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

the class UICheckBoxIntegrationTest method testSetValueWithPrimitiveBooleanInModelObject.

@Test
void testSetValueWithPrimitiveBooleanInModelObject() {
    TestModelObjectWithPrimitiveBoolean modelObject = new TestModelObjectWithPrimitiveBoolean();
    Checkbox checkBox = createFirstComponent(modelObject);
    assertThat(modelObject.getValue(), is(false));
    TestUiUtil.setUserOriginatedValue(checkBox, Boolean.TRUE);
    assertThat(modelObject.getValue(), is(true));
    TestUiUtil.setUserOriginatedValue(checkBox, Boolean.FALSE);
    assertThat(modelObject.getValue(), is(false));
    TestUiUtil.setUserOriginatedValue(checkBox, true);
    assertThat(modelObject.getValue(), is(true));
    TestUiUtil.setUserOriginatedValue(checkBox, false);
    assertThat(modelObject.getValue(), is(false));
    modelObject.setValue(true);
    getBindingContext().modelChanged();
    assertThat(checkBox.getValue(), is(true));
    modelObject.setValue(false);
    getBindingContext().modelChanged();
    assertThat(checkBox.getValue(), is(false));
}
Also used : Checkbox(com.vaadin.flow.component.checkbox.Checkbox) Test(org.junit.jupiter.api.Test)

Example 39 with Checkbox

use of com.vaadin.flow.component.checkbox.Checkbox in project ArchCNL by Mari-Wie.

the class ConditionStatementComponent method initializeLayout.

private void initializeLayout() {
    conditionBox = new HorizontalLayout();
    conditionBox.setMargin(false);
    startLabelTextfield = new Label("that(");
    conditionBox.setVerticalComponentAlignment(Alignment.END, startLabelTextfield);
    List<String> firstStatements = Arrays.asList(" ", "a", "an", "equal-to", "equal-to a", "equal-to an");
    modifierCombobox = new ComboBox<String>("Modifier", firstStatements);
    modifierCombobox.setValue("a");
    modifierCombobox.addValueChangeListener(e -> {
        firstComboboxListener(modifierCombobox.getValue());
    });
    createRelationCombobox();
    createConceptCombobox();
    createVariableTextfield();
    endLabelTextfield = new Label(")");
    conditionBox.setVerticalComponentAlignment(Alignment.END, endLabelTextfield);
    andCheckbox = new Checkbox("and...");
    conditionBox.setVerticalComponentAlignment(Alignment.END, andCheckbox);
    andCheckbox.addClickListener(e -> addCondition(andCheckbox.getValue()));
    conditionBox.add(startLabelTextfield, relationCombobox, modifierCombobox, conceptCombobox, endLabelTextfield, andCheckbox);
    add(conditionBox);
}
Also used : Checkbox(com.vaadin.flow.component.checkbox.Checkbox) Label(com.vaadin.flow.component.html.Label) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 40 with Checkbox

use of com.vaadin.flow.component.checkbox.Checkbox in project ArchCNL by Mari-Wie.

the class SubjectComponent method initializeLayout.

private void initializeLayout() {
    newCondition = new ConditionStatementComponent();
    newCondition.addListener(RelationListUpdateRequestedEvent.class, this::fireEvent);
    newCondition.addListener(ConceptListUpdateRequestedEvent.class, this::fireEvent);
    subjectLayout = new HorizontalLayout();
    one_DescriptorCombobox = new ComboBox<String>("Modifier", descriptorList);
    one_DescriptorCombobox.setValue("Every");
    one_DescriptorCombobox.addValueChangeListener(e -> {
        updateUI();
    });
    two_ConceptCombobox = createConceptCombobox();
    three_ConditionCheckbox = new Checkbox("that... (add condition)");
    three_ConditionCheckbox.addClickListener(e -> updateUI());
    subjectLayout.setVerticalComponentAlignment(Alignment.END, three_ConditionCheckbox);
    subjectLayout.add(one_DescriptorCombobox, two_ConceptCombobox, three_ConditionCheckbox);
    add(subjectLayout);
}
Also used : Checkbox(com.vaadin.flow.component.checkbox.Checkbox) ConditionStatementComponent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.components.conditioncomponents.ConditionStatementComponent) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

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