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());
}
}
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();
}
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;
}
}
}
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(" ", 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);
}
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;
}
Aggregations