本文整理匯總了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());
}