本文整理汇总了Java中com.vaadin.ui.TwinColSelect类的典型用法代码示例。如果您正苦于以下问题:Java TwinColSelect类的具体用法?Java TwinColSelect怎么用?Java TwinColSelect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TwinColSelect类属于com.vaadin.ui包,在下文中一共展示了TwinColSelect类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetFieldTypeForAnonymousInstanceOfGenericCollectionField
import com.vaadin.ui.TwinColSelect; //导入依赖的package包/类
@Test
public void testGetFieldTypeForAnonymousInstanceOfGenericCollectionField() {
@SuppressWarnings("serial")
TwinColSelect<String> r = new TwinColSelect<String>() {};
assertTrue(binder.getPresentationTypeForField(r).isPresent());
assertEquals(Set.class, binder.getPresentationTypeForField(r).get());
}
示例2: testGetFieldTypeForHasGenericTypeOfGenericCollectionField
import com.vaadin.ui.TwinColSelect; //导入依赖的package包/类
@Test
public void testGetFieldTypeForHasGenericTypeOfGenericCollectionField() {
@SuppressWarnings({ "rawtypes" })
EGTypeComponentAdapter<Set> r = new EGTypeComponentAdapter<>(Set.class, new TwinColSelect<String>());
assertTrue(binder.getPresentationTypeForField(r).isPresent());
assertEquals(Set.class, binder.getPresentationTypeForField(r).get());
}
示例3: testBindSet
import com.vaadin.ui.TwinColSelect; //导入依赖的package包/类
@Test
public void testBindSet() {
when(converterRegistry.getConverter(Set.class, Set.class)).thenReturn(null);
@SuppressWarnings("serial")
EasyBinding<TestEntity, Set<String>, Set<String>> binding = binder.bind(new TwinColSelect<String>(){}, "testSet");
assertNotNull(binding);
verify(converterRegistry, times(1)).getConverter(Set.class, Set.class);
}
示例4: testBindEnumSetToSet
import com.vaadin.ui.TwinColSelect; //导入依赖的package包/类
@Test
public void testBindEnumSetToSet() {
@SuppressWarnings({ "unchecked", "rawtypes" })
Converter<Set, EnumSet> c = mock(Converter.class);
when(converterRegistry.getConverter(Set.class, EnumSet.class)).thenReturn(c);
@SuppressWarnings("serial")
EasyBinding<TestEntity, Set<TestEnum>, EnumSet<TestEnum>> binding = binder.bind(new TwinColSelect<TestEnum>(){}, "testEnumSet");
assertNotNull(binding);
verify(converterRegistry, times(1)).getConverter(Set.class, EnumSet.class);
}
示例5: testBindWithConverter
import com.vaadin.ui.TwinColSelect; //导入依赖的package包/类
@Test
public void testBindWithConverter() {
when(converterRegistry.getConverter(Set.class, EnumSet.class)).thenReturn(null);
@SuppressWarnings({ "unchecked" })
Converter<Set<TestEnum>, EnumSet<TestEnum>> c = mock(Converter.class);
@SuppressWarnings("serial")
EasyBinding<TestEntity, Set<TestEnum>, EnumSet<TestEnum>> binding = binder.bind(new TwinColSelect<TestEnum>(){}, "testEnumSet", c);
assertNotNull(binding);
verify(converterRegistry, never()).getConverter(Set.class, EnumSet.class);
}
示例6: fillLeftDefault
import com.vaadin.ui.TwinColSelect; //导入依赖的package包/类
/**
* @param list
* @param tcs
*/
private void fillLeftDefault(List<String> list, TwinColSelect tcs) {
for (String item : list) {
if (tcs.getItem(item) == null) {
// not presented -> add
tcs.addItem(item);
}
}
}
示例7: 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;
}
示例8: newTwinColSelect
import com.vaadin.ui.TwinColSelect; //导入依赖的package包/类
/**
* Crate a {@link TwinColSelect}
*/
public static TwinColSelect newTwinColSelect() {
TwinColSelect select = new TwinColSelect();
select.setLocale(LocaleContextHolder.getLocale());
return select;
}
示例9: 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);
}
示例10: buildMainLayout
import com.vaadin.ui.TwinColSelect; //导入依赖的package包/类
@AutoGenerated
private AbsoluteLayout buildMainLayout() {
// common part: create layout
mainLayout = new AbsoluteLayout();
mainLayout.setImmediate(false);
mainLayout.setWidth("700px");
mainLayout.setHeight("480px");
// top-level component properties
setWidth("700px");
setHeight("480px");
// resutadoAprendizajeSelect
resutadoAprendizajeSelect = new TwinColSelect();
resutadoAprendizajeSelect.setImmediate(false);
resutadoAprendizajeSelect.setWidth("100.0%");
resutadoAprendizajeSelect.setHeight("-1px");
mainLayout.addComponent(resutadoAprendizajeSelect,
"top:60.0px;right:63.0px;left:80.0px;");
// label_1
label_1 = new Label();
label_1.setImmediate(false);
label_1.setWidth("229px");
label_1.setHeight("-1px");
label_1.setValue("Resultados de Aprendizaje Disponibles:");
mainLayout.addComponent(label_1, "top:20.0px;left:80.0px;");
// label_2
label_2 = new Label();
label_2.setImmediate(false);
label_2.setWidth("229px");
label_2.setHeight("-1px");
label_2.setValue("Resultados de Aprendizaje Asociados:");
mainLayout.addComponent(label_2, "top:20.0px;left:380.0px;");
// label_3
label_3 = new Label();
label_3.setImmediate(false);
label_3.setWidth("89px");
label_3.setHeight("18px");
label_3.setValue("Competencia:");
mainLayout.addComponent(label_3, "top:222.0px;left:80.0px;");
// btGuardarCompetencia
btGuardarCompetencia = new NativeButton();
btGuardarCompetencia.setCaption("Guardar");
btGuardarCompetencia.setImmediate(true);
btGuardarCompetencia.setWidth("-1px");
btGuardarCompetencia.setHeight("-1px");
mainLayout.addComponent(btGuardarCompetencia,
"top:418.0px;left:566.0px;");
// textDescripcion
textDescripcion = new TextArea();
textDescripcion.setImmediate(false);
textDescripcion.setWidth("560px");
textDescripcion.setHeight("140px");
textDescripcion.setMaxLength(100);
mainLayout.addComponent(textDescripcion, "top:260.0px;left:80.0px;");
return mainLayout;
}
示例11: getTwinColSelect
import com.vaadin.ui.TwinColSelect; //导入依赖的package包/类
/**
* <p>
* Returns a Vaadin TwinColSelect object with an implicit
* ValueChangeListener that writes the selected options directly to the R
* workspace. See {@link RContainer#getListSelect} for examples, and how to
* (re)set the values and set the listener explicitly.
* </p>
*
* @param optionsInName
* The R character vector name to contain the different choices.
* Repeated elements will be ignored.
* @param selectedOutName
* The R character variable to immediately write the selection
* to.
* @return Vaadin TwinColSelect object.
*/
public TwinColSelect getTwinColSelect(String optionsInName,
final String selectedOutName) {
final TwinColSelect tcs = new TwinColSelect();
buildSelectOptions(tcs, optionsInName);
buildSelectListener(tcs, selectedOutName);
return tcs;
}
示例12: withRows
import com.vaadin.ui.TwinColSelect; //导入依赖的package包/类
/**
* Sets the number of rows in the selects. If the number of rows is set to 0
* or less, the actual number of displayed rows is determined implicitly by
* the selects.
* <p>
* If a height if set (using {@link #setHeight(String)} or
* {@link #setHeight(float, Unit)}) it overrides the number of rows. Leave
* the height undefined to use this method.
*
* @param rows
* the number of rows to set.
* @return this (for method chaining)
* @see TwinColSelect#setRows(int)
*/
@SuppressWarnings("unchecked")
public default THIS withRows(int rows) {
((TwinColSelect<ITEM>) this).setRows(rows);
return (THIS) this;
}
示例13: withLeftColumnCaption
import com.vaadin.ui.TwinColSelect; //导入依赖的package包/类
/**
* Sets the text shown above the left column. {@code null} clears the
* caption.
*
* @param leftColumnCaption
* The text to show, {@code null} to clear
* @return this (for method chaining)
* @see TwinColSelect#setLeftColumnCaption(String)
*/
@SuppressWarnings("unchecked")
public default THIS withLeftColumnCaption(String leftColumnCaption) {
((TwinColSelect<ITEM>) this).setLeftColumnCaption(leftColumnCaption);
return (THIS) this;
}
示例14: withRightColumnCaption
import com.vaadin.ui.TwinColSelect; //导入依赖的package包/类
/**
* Sets the text shown above the right column. {@code null} clears the
* caption.
*
* @param rightColumnCaption
* The text to show, {@code null} to clear
* @return this (for method chaining)
* @see TwinColSelect#setRightColumnCaption(String)
*/
@SuppressWarnings("unchecked")
public default THIS withRightColumnCaption(String rightColumnCaption) {
((TwinColSelect<ITEM>) this).setRightColumnCaption(rightColumnCaption);
return (THIS) this;
}