本文整理汇总了Java中com.vaadin.ui.TwinColSelect.addValueChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java TwinColSelect.addValueChangeListener方法的具体用法?Java TwinColSelect.addValueChangeListener怎么用?Java TwinColSelect.addValueChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.TwinColSelect
的用法示例。
在下文中一共展示了TwinColSelect.addValueChangeListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initContent
import com.vaadin.ui.TwinColSelect; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Component initContent() {
final TwinColSelect twin = new TwinColSelect();
twin.setRows(10);
twin.setNullSelectionAllowed(true);
twin.setMultiSelect(true);
twin.setImmediate(true);
twin.setLeftColumnCaption("Доступные бренды");
twin.setRightColumnCaption("Бренды юр.лица");
twin.addValueChangeListener(event -> {
final Set selected = (Set) twin.getValue();
setValue(selected);
});
final Property dataSource = getPropertyDataSource();
final Set<String> set = dataSource != null ? (Set<String>) dataSource.getValue() : null;
if (set != null) {
twin.setValue(newHashSet(set));
}
for (final String item : lookup(MotorBrandRepository.class).loadAllNames()) {
twin.addItem(item);
}
return twin;
}
示例2: GroupEditPanel
import com.vaadin.ui.TwinColSelect; //导入方法依赖的package包/类
public GroupEditPanel(ApplicationContext context, Group group) {
this.context = context;
this.group = group;
FormLayout layout = new FormLayout();
TextField nameField = new TextField("Group Name", StringUtils.trimToEmpty(group.getName()));
nameField.addValueChangeListener(new NameChangeListener());
layout.addComponent(nameField);
nameField.focus();
readOnly = new CheckBox("Read Only");
readOnly.setEnabled(isNotBlank(group.getName()));
readOnly.setImmediate(true);
readOnly.setValue(group.isReadOnly());
readOnly.addValueChangeListener(new ReadOnlyChangeListener());
layout.addComponent(readOnly);
privSelect = new TwinColSelect();
privSelect.setEnabled(isNotBlank(group.getName()));
for (Privilege priv : Privilege.values()) {
privSelect.addItem(priv.name());
}
lastPrivs = new HashSet<String>();
for (GroupPrivilege groupPriv : group.getGroupPrivileges()) {
lastPrivs.add(groupPriv.getName());
}
privSelect.setValue(lastPrivs);
privSelect.setRows(20);
privSelect.setNullSelectionAllowed(true);
privSelect.setMultiSelect(true);
privSelect.setImmediate(true);
privSelect.setLeftColumnCaption("Available privileges");
privSelect.setRightColumnCaption("Selected privileges");
privSelect.addValueChangeListener(new PrivilegeChangeListener());
layout.addComponent(privSelect);
addComponent(layout);
setMargin(true);
}