本文整理汇总了Java中com.vaadin.data.Item.getItemPropertyIds方法的典型用法代码示例。如果您正苦于以下问题:Java Item.getItemPropertyIds方法的具体用法?Java Item.getItemPropertyIds怎么用?Java Item.getItemPropertyIds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.data.Item
的用法示例。
在下文中一共展示了Item.getItemPropertyIds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ItemPropertyValueChangeListener
import com.vaadin.data.Item; //导入方法依赖的package包/类
/**
* Constructor
* @param item Item
* @param itemStore Item store
*/
public ItemPropertyValueChangeListener(Item item, ItemStore<Item> itemStore) {
super();
this.item = new WeakReference<>(item);
this.itemStore = itemStore;
if (item != null) {
// add value change listener to track property modifications
Collection<?> itemPropertyIds = item.getItemPropertyIds();
if (itemPropertyIds != null) {
trackedItemProperties = new HashSet<>(itemPropertyIds.size());
for (Object itemPropertyId : itemPropertyIds) {
Property<?> itemProperty = item.getItemProperty(itemPropertyId);
if (itemProperty instanceof ValueChangeNotifier) {
((ValueChangeNotifier) itemProperty).addValueChangeListener(this);
trackedItemProperties.add(new WeakReference<>(itemProperty));
}
}
}
}
}
示例2: testPropertyBoxItem
import com.vaadin.data.Item; //导入方法依赖的package包/类
@Test
public void testPropertyBoxItem() {
PropertyBox box = PropertyBox.builder(TestData.PROPERTIES).set(TestData.ID, "id")
.set(TestData.DESCRIPTION, "des").set(TestData.SEQUENCE, 1).set(TestData.OBSOLETE, true).build();
final Item item = PropertyBoxItem.create(box);
Collection<?> ids = item.getItemPropertyIds();
assertNotNull(ids);
assertEquals(4, ids.size());
assertTrue(ids.contains(TestData.ID));
assertTrue(ids.contains(TestData.DESCRIPTION));
assertTrue(ids.contains(TestData.SEQUENCE));
assertTrue(ids.contains(TestData.OBSOLETE));
Property<?> p = item.getItemProperty(TestData.ID);
assertNotNull(p);
Class<?> type = p.getType();
assertEquals(String.class, type);
Object value = p.getValue();
assertEquals("id", value);
p = item.getItemProperty(TestData.DESCRIPTION);
assertNotNull(p);
type = p.getType();
assertEquals(String.class, type);
value = p.getValue();
assertEquals("des", value);
p = item.getItemProperty(TestData.SEQUENCE);
assertNotNull(p);
type = p.getType();
assertEquals(Integer.class, type);
value = p.getValue();
assertEquals(1, value);
p = item.getItemProperty(TestData.OBSOLETE);
assertNotNull(p);
type = p.getType();
assertTrue(Boolean.class.isAssignableFrom(type));
value = p.getValue();
assertEquals(Boolean.TRUE, value);
p = item.getItemProperty(TestData.OBSOLETE);
assertNotNull(p);
p = item.getItemProperty("invalid");
assertNull(p);
TestUtils.expectedException(UnsupportedOperationException.class, new Runnable() {
@Override
public void run() {
item.addItemProperty("invalid", null);
}
});
TestUtils.expectedException(UnsupportedOperationException.class, new Runnable() {
@Override
public void run() {
item.removeItemProperty("invalid");
}
});
Item item2 = PropertyBoxItem.create(box);
p = item2.getItemProperty(TestData.ID);
assertNotNull(p);
assertFalse(p.isReadOnly());
}