use of com.vaadin.data.Property.ValueChangeListener 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.data.Property.ValueChangeListener 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.data.Property.ValueChangeListener in project Activiti by Activiti.
the class SimpleTableEditor method initButtons.
protected void initButtons(GridLayout layout) {
final Button saveButton = new Button(ExplorerApp.get().getI18nManager().getMessage(Messages.PROCESS_EDITOR_SAVE));
saveButton.setEnabled(nameField.getValue() != null && !"".equals((String) nameField.getValue()));
toolBar.addButton(saveButton);
saveButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
save();
}
});
// Dependending on namefield value, save button is enabled
nameField.addListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
if (nameField.getValue() != null && !"".equals((String) nameField.getValue())) {
saveButton.setEnabled(true);
} else {
saveButton.setEnabled(false);
}
}
});
}
use of com.vaadin.data.Property.ValueChangeListener in project Activiti by Activiti.
the class AccountSelectionPopup method initImapComponent.
protected void initImapComponent() {
imapForm = new Form();
imapForm.setDescription(i18nManager.getMessage(Messages.IMAP_DESCRIPTION));
final TextField imapServer = new TextField(i18nManager.getMessage(Messages.IMAP_SERVER));
imapForm.getLayout().addComponent(imapServer);
final TextField imapPort = new TextField(i18nManager.getMessage(Messages.IMAP_PORT));
imapPort.setWidth(30, UNITS_PIXELS);
// Default imap port (non-ssl)
imapPort.setValue(143);
imapForm.getLayout().addComponent(imapPort);
final CheckBox useSSL = new CheckBox(i18nManager.getMessage(Messages.IMAP_SSL));
useSSL.setValue(false);
useSSL.setImmediate(true);
imapForm.getLayout().addComponent(useSSL);
useSSL.addListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
imapPort.setValue(((Boolean) useSSL.getValue()) ? 993 : 143);
}
});
final TextField imapUserName = new TextField(i18nManager.getMessage(Messages.IMAP_USERNAME));
imapForm.getLayout().addComponent(imapUserName);
final PasswordField imapPassword = new PasswordField(i18nManager.getMessage(Messages.IMAP_PASSWORD));
imapForm.getLayout().addComponent(imapPassword);
// Matching listener
imapClickListener = new ClickListener() {
public void buttonClick(ClickEvent event) {
Map<String, Object> accountDetails = createAccountDetails("imap", imapUserName.getValue().toString(), imapPassword.getValue().toString(), "server", imapServer.getValue().toString(), "port", imapPort.getValue().toString(), "ssl", imapPort.getValue().toString());
fireEvent(new SubmitEvent(AccountSelectionPopup.this, SubmitEvent.SUBMITTED, accountDetails));
}
};
}
use of com.vaadin.data.Property.ValueChangeListener in project Activiti by Activiti.
the class TabbedSelectionWindow method initSelectionTable.
protected void initSelectionTable() {
selectionTable = new Table();
selectionTable.setSizeUndefined();
selectionTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
selectionTable.setSelectable(true);
selectionTable.setImmediate(true);
selectionTable.setNullSelectionAllowed(false);
selectionTable.setWidth(150, UNITS_PIXELS);
selectionTable.setHeight(100, UNITS_PERCENTAGE);
selectionTable.setCellStyleGenerator(new CellStyleGenerator() {
private static final long serialVersionUID = 1L;
public String getStyle(Object itemId, Object propertyId) {
if ("name".equals(propertyId)) {
return ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST_LAST_COLUMN;
}
return null;
}
});
selectionTable.addStyleName(ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST);
selectionTable.addContainerProperty("type", Embedded.class, null);
selectionTable.setColumnWidth("type", 22);
selectionTable.addContainerProperty("name", String.class, null);
// Listener to switch to the selected component
selectionTable.addListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
String name = (String) event.getProperty().getValue();
if (name != null) {
currentSelection = name;
currentComponent = components.get(name);
selectedComponentLayout.removeComponent(selectedComponentLayout.getComponent(0, 0));
if (currentComponent != null) {
currentComponent.setSizeFull();
selectedComponentLayout.addComponent(currentComponent, 0, 0);
okButton.setEnabled(true);
} else {
okButton.setEnabled(false);
}
}
}
});
windowLayout.addComponent(selectionTable);
}
Aggregations