Search in sources :

Example 16 with CheckBox

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

the class TableCheckBoxSingleSelect 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");
            checkbox.setValue(itemId == selectedId);
            if (itemId == selectedId) {
                selectedCheckBox = checkbox;
            }
            checkbox.addValueChangeListener(new ValueChangeListener() {

                private static final long serialVersionUID = 9170497247408214336L;

                @Override
                public void valueChange(Property.ValueChangeEvent event) {
                    if (selectedCheckBox != null) {
                        selectedCheckBox.setValue(false);
                    }
                    if ((Boolean) event.getProperty().getValue() == true) {
                        selectedId = itemId;
                        selectedCheckBox = checkbox;
                    } else {
                        selectedCheckBox = null;
                        selectedId = null;
                    }
                    notifyValueChange();
                }
            });
            checkbox.setImmediate(true);
            return checkbox;
        }
    };
}
Also used : Table(com.vaadin.ui.Table) CheckBox(com.vaadin.ui.CheckBox) Property(com.vaadin.data.Property)

Example 17 with CheckBox

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

the class MultiColumnFormLayout method bindBooleanField.

public CheckBox bindBooleanField(String fieldLabel, String member) {
    CheckBox field = formHelper.bindBooleanField(this, fieldGroup, fieldLabel, member);
    this.fieldList.add(field);
    return field;
}
Also used : CheckBox(com.vaadin.ui.CheckBox)

Example 18 with CheckBox

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

the class FormHelper method bindBooleanField.

public CheckBox bindBooleanField(AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel, SingularAttribute<E, Boolean> member) {
    CheckBox field = bindBooleanField(form, group, fieldLabel, member.getName());
    this.fieldList.add(field);
    return field;
}
Also used : CheckBox(com.vaadin.ui.CheckBox) SplitCheckBox(au.com.vaadinutils.crud.splitFields.SplitCheckBox)

Example 19 with CheckBox

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

the class FormHelper method bindBooleanField.

public CheckBox bindBooleanField(AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel, String fieldName) {
    CheckBox field = new SplitCheckBox(fieldLabel);
    field.setWidth("100%");
    field.setImmediate(true);
    addValueChangeListeners(field);
    doBinding(group, fieldName, field);
    form.addComponent(field);
    return field;
}
Also used : CheckBox(com.vaadin.ui.CheckBox) SplitCheckBox(au.com.vaadinutils.crud.splitFields.SplitCheckBox) SplitCheckBox(au.com.vaadinutils.crud.splitFields.SplitCheckBox)

Example 20 with CheckBox

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

the class FormHelper method bindBooleanField.

public <M> CheckBox bindBooleanField(String fieldLabel, SingularAttribute<E, M> member) {
    CheckBox field = bindBooleanField(form, group, fieldLabel, member.getName());
    this.fieldList.add(field);
    return field;
}
Also used : CheckBox(com.vaadin.ui.CheckBox) SplitCheckBox(au.com.vaadinutils.crud.splitFields.SplitCheckBox)

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