Search in sources :

Example 26 with CheckBox

use of com.vaadin.ui.CheckBox in project Activiti by Activiti.

the class ChangeProcessSuspensionStatePopupWindow method addIncludeProcessInstancesSection.

protected void addIncludeProcessInstancesSection(boolean suspend) {
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
    includeProcessInstancesCheckBox = new CheckBox(suspend ? i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_INCLUDE_PROCESS_INSTANCES_DESCRIPTION) : i18nManager.getMessage(Messages.PROCESS_ACTIVATE_POPUP_INCLUDE_PROCESS_INSTANCES_DESCRIPTION), true);
    verticalLayout.addComponent(includeProcessInstancesCheckBox);
}
Also used : CheckBox(com.vaadin.ui.CheckBox) Label(com.vaadin.ui.Label)

Example 27 with CheckBox

use of com.vaadin.ui.CheckBox in project Activiti by Activiti.

the class BooleanFormPropertyRenderer method getPropertyField.

@Override
public Field getPropertyField(FormProperty formProperty) {
    CheckBox checkBox = new CheckBox(getPropertyLabel(formProperty));
    checkBox.setRequired(formProperty.isRequired());
    checkBox.setEnabled(formProperty.isWritable());
    if (formProperty.getValue() != null) {
        Boolean value = new Boolean(Boolean.parseBoolean(formProperty.getValue()));
        checkBox.setValue(value);
    }
    return checkBox;
}
Also used : CheckBox(com.vaadin.ui.CheckBox)

Example 28 with CheckBox

use of com.vaadin.ui.CheckBox in project linkki by linkki-framework.

the class UICheckBoxIntegrationTest method testSetValueWithPrimitiveBooleanInModelObject.

@Test
public void testSetValueWithPrimitiveBooleanInModelObject() {
    TestModelObjectWithPrimitiveBoolean modelObject = new TestModelObjectWithPrimitiveBoolean();
    CheckBox checkBox = createFirstComponent(modelObject);
    assertThat(modelObject.getValue(), is(false));
    checkBox.setValue(Boolean.TRUE);
    assertThat(modelObject.getValue(), is(true));
    checkBox.setValue(Boolean.FALSE);
    assertThat(modelObject.getValue(), is(false));
    checkBox.setValue(true);
    assertThat(modelObject.getValue(), is(true));
    checkBox.setValue(false);
    assertThat(modelObject.getValue(), is(false));
    modelObject.setValue(true);
    // updateUi(); not needed at the moment
    assertThat(checkBox.getValue(), is(true));
    modelObject.setValue(false);
    // updateUi(); not needed at the moment
    assertThat(checkBox.getValue(), is(false));
}
Also used : CheckBox(com.vaadin.ui.CheckBox) Test(org.junit.Test)

Example 29 with CheckBox

use of com.vaadin.ui.CheckBox in project linkki by linkki-framework.

the class UICheckBoxIntegrationTest method testNullInputIfRequired.

@Test
@Override
public void testNullInputIfRequired() {
    CheckBox checkBox = getDynamicComponent();
    getDefaultPmo().setRequired(true);
    updateUi();
    assertThat(checkBox.isRequired(), is(true));
    checkBox.setValue(false);
    assertThat(getDefaultModelObject().getValue(), is(false));
    checkBox.setValue(null);
    assertThat(getDefaultModelObject().getValue(), is(nullValue()));
}
Also used : CheckBox(com.vaadin.ui.CheckBox) Test(org.junit.Test)

Example 30 with CheckBox

use of com.vaadin.ui.CheckBox in project VaadinUtils by rlsutton1.

the class TableCheckBoxSelect method getGenerator.

protected ColumnGenerator getGenerator() {
    return new ColumnGenerator() {

        private static final long serialVersionUID = -6659059346271729122L;

        @Override
        public Object generateCell(final Table source, final Object itemId, Object columnId) {
            final CheckBox checkbox = new CheckBox();
            checkbox.setWidth("25");
            checkbox.setHeight("20");
            // important that the following code is executed before the
            // value change listener is added
            boolean inList = markedIds.contains(itemId);
            checkbox.setValue(inList);
            checkbox.setId("checkboxSelect");
            if (!markedIds.isTrackingSelected()) {
                checkbox.setValue(!inList);
            }
            checkbox.addValueChangeListener(new ValueChangeListener() {

                private static final long serialVersionUID = 9170497247408214336L;

                @Override
                public void valueChange(Property.ValueChangeEvent event) {
                    if ((Boolean) event.getProperty().getValue() == markedIds.isTrackingSelected()) {
                        markedIds.add(itemId);
                    } else {
                        markedIds.remove(itemId);
                    }
                    notifyValueChange();
                }
            });
            checkbox.setImmediate(true);
            return checkbox;
        }
    };
}
Also used : Table(com.vaadin.ui.Table) CheckBox(com.vaadin.ui.CheckBox) Property(com.vaadin.data.Property)

Aggregations

CheckBox (com.vaadin.ui.CheckBox)40 Button (com.vaadin.ui.Button)8 ClickListener (com.vaadin.ui.Button.ClickListener)7 HorizontalLayout (com.vaadin.ui.HorizontalLayout)6 ClickEvent (com.vaadin.ui.Button.ClickEvent)5 VerticalLayout (com.vaadin.ui.VerticalLayout)5 SplitCheckBox (au.com.vaadinutils.crud.splitFields.SplitCheckBox)4 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)4 ValueChangeListener (com.vaadin.data.Property.ValueChangeListener)4 TextField (com.vaadin.ui.TextField)4 Test (org.junit.Test)4 Item (com.vaadin.data.Item)3 Property (com.vaadin.data.Property)3 ComboBox (com.vaadin.ui.ComboBox)3 Component (com.vaadin.ui.Component)3 Label (com.vaadin.ui.Label)3 ArrayList (java.util.ArrayList)3 Chart (com.vaadin.addon.charts.Chart)2 Configuration (com.vaadin.addon.charts.model.Configuration)2 DataLabels (com.vaadin.addon.charts.model.DataLabels)2