Search in sources :

Example 1 with CheckBox

use of com.vaadin.ui.CheckBox in project opennms by OpenNMS.

the class CheckboxGenerator method selectAll.

public void selectAll(Table source) {
    m_selectAll = true;
    m_selectedCheckboxes.clear();
    m_notSelectedCheckboxes.clear();
    // Check all of the checkboxes
    for (CheckBox button : m_checkboxes) {
        button.setValue(true);
        m_selectedCheckboxes.add((Integer) button.getData());
    }
}
Also used : CheckBox(com.vaadin.ui.CheckBox)

Example 2 with CheckBox

use of com.vaadin.ui.CheckBox in project opennms by OpenNMS.

the class CheckboxGenerator method clearSelectedIds.

public void clearSelectedIds(Table source) {
    m_selectAll = false;
    // Uncheck all of the checkboxes
    for (CheckBox button : m_checkboxes) {
        button.setValue(false);
    }
    m_selectedCheckboxes.clear();
    m_notSelectedCheckboxes.clear();
}
Also used : CheckBox(com.vaadin.ui.CheckBox)

Example 3 with CheckBox

use of com.vaadin.ui.CheckBox in project opennms by OpenNMS.

the class CheckboxGenerator method generateCell.

@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
    final Property<Integer> property = source.getContainerProperty(itemId, m_valueProperty);
    if (property.getValue() == null) {
        return null;
    } else {
        if (SecurityContextHolder.getContext().toString().contains(Authentication.ROLE_READONLY)) {
            // Do not render the checkboxes for read-only users
            return null;
        } else {
            final CheckBox button = new CheckBox();
            button.setData(property.getValue());
            button.setValue(isSelected((Integer) property.getValue()));
            button.addValueChangeListener(new ValueChangeListener() {

                private static final long serialVersionUID = 2991986878904005830L;

                @Override
                public void valueChange(ValueChangeEvent event) {
                    if (Boolean.TRUE.equals(event.getProperty().getValue())) {
                        m_selectedCheckboxes.add(property.getValue());
                        m_notSelectedCheckboxes.remove(property.getValue());
                    } else {
                        m_selectedCheckboxes.remove(property.getValue());
                        m_notSelectedCheckboxes.add(property.getValue());
                    }
                }
            });
            m_checkboxes.add(button);
            return button;
        }
    }
}
Also used : ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) CheckBox(com.vaadin.ui.CheckBox)

Example 4 with CheckBox

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

the class ChangeProcessSuspensionStatePopupWindow method addTimeSection.

protected void addTimeSection(boolean suspend) {
    Label timeLabel = new Label(suspend ? i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_DESCRIPTION) : i18nManager.getMessage(Messages.PROCESS_ACTIVATE_POPUP_TIME_DESCRIPTION));
    verticalLayout.addComponent(timeLabel);
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
    nowCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_NOW), true);
    nowCheckBox.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE);
    nowCheckBox.setImmediate(true);
    nowCheckBox.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            if (nowCheckBox.booleanValue() == true) {
                dateField.setValue(null);
                dateCheckBox.setValue(false);
            } else {
                dateCheckBox.setValue(true);
                dateField.setValue(new Date());
            }
        }
    });
    verticalLayout.addComponent(nowCheckBox);
    HorizontalLayout dateLayout = new HorizontalLayout();
    verticalLayout.addComponent(dateLayout);
    dateCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_DATE));
    dateCheckBox.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE);
    dateCheckBox.setImmediate(true);
    dateCheckBox.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            if (dateCheckBox.booleanValue() == true) {
                dateField.setValue(new Date());
                nowCheckBox.setValue(false);
            } else {
                dateField.setValue(null);
                nowCheckBox.setValue(true);
            }
        }
    });
    dateLayout.addComponent(dateCheckBox);
    dateField = new DateField();
    dateField.setImmediate(true);
    dateField.addListener(new ValueChangeListener() {

        public void valueChange(ValueChangeEvent event) {
            if (dateField.getValue() != null) {
                nowCheckBox.setValue(false);
                dateCheckBox.setValue(true);
            }
        }
    });
    dateLayout.addComponent(dateField);
}
Also used : ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) CheckBox(com.vaadin.ui.CheckBox) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) DateField(com.vaadin.ui.DateField) ClickListener(com.vaadin.ui.Button.ClickListener) Date(java.util.Date) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 5 with CheckBox

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

the class FormPopupWindow method getFormPropertyDefinition.

protected FormPropertyDefinition getFormPropertyDefinition(Item item) {
    String type = (String) ((ComboBox) item.getItemProperty(PropertyTable.ID_PROPERTY_TYPE).getValue()).getValue();
    FormPropertyDefinition result = null;
    if (type.equals("number")) {
        result = new NumberPropertyDefinition();
    } else if (type.equals("date")) {
        result = new DatePropertyDefinition();
    } else {
        result = new TextPropertyDefinition();
    }
    // Set generic properties
    result.setName((String) item.getItemProperty(PropertyTable.ID_PROPERTY_NAME).getValue());
    result.setMandatory((Boolean) ((CheckBox) item.getItemProperty(PropertyTable.ID_PROPERTY_REQUIRED).getValue()).getValue());
    return result;
}
Also used : NumberPropertyDefinition(org.activiti.workflow.simple.definition.form.NumberPropertyDefinition) TextPropertyDefinition(org.activiti.workflow.simple.definition.form.TextPropertyDefinition) CheckBox(com.vaadin.ui.CheckBox) FormPropertyDefinition(org.activiti.workflow.simple.definition.form.FormPropertyDefinition) DatePropertyDefinition(org.activiti.workflow.simple.definition.form.DatePropertyDefinition)

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 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 DataSeries (com.vaadin.addon.charts.model.DataSeries)2