本文整理了Java中com.vaadin.v7.data.Item.removeItemProperty()
方法的一些代码示例,展示了Item.removeItemProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item.removeItemProperty()
方法的具体详情如下:
包路径:com.vaadin.v7.data.Item
类名称:Item
方法名:removeItemProperty
[英]Removes the Property identified by ID from the Item.
This functionality is optional.
[中]从项中删除由ID标识的属性。
此功能是可选的。
代码示例来源:origin: info.magnolia.dam/magnolia-dam-app
@Override
public Item populateItem(T newValue, Item item) {
super.populateItem(newValue, item);
newValue.updateRelatedProperties();
// since DAM 2.0 we store filename + extension in the fileName property
getOrCreateProperty(item, AssetNodeTypes.AssetResource.FILENAME, String.class).setValue(newValue.getFileName());
if (newValue.isImage() && newValue.getFileSize() > 0) {
// Set
getOrCreateProperty(item, AssetNodeTypes.AssetResource.WIDTH, Long.class).setValue(newValue.getWidth());
getOrCreateProperty(item, AssetNodeTypes.AssetResource.HEIGHT, Long.class).setValue(newValue.getHeight());
// Remove
item.removeItemProperty("duration");
} else if (newValue.getDuration() > 0) {
// Set
getOrCreateProperty(item, "duration", Long.class).setValue(newValue.getDuration());
// Remove
item.removeItemProperty(AssetNodeTypes.AssetResource.WIDTH);
item.removeItemProperty(AssetNodeTypes.AssetResource.HEIGHT);
} else {
// Remove
item.removeItemProperty("duration");
item.removeItemProperty(AssetNodeTypes.AssetResource.WIDTH);
item.removeItemProperty(AssetNodeTypes.AssetResource.HEIGHT);
}
return item;
}
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-admincentral
@Test
public void executeRemovesProperty() throws RepositoryException, ActionExecutionException {
// GIVEN
Node node = session.getRootNode().addNode("underlying");
node.setProperty("property", "initial");
Item item = new JcrNodeAdapter(node);
item.removeItemProperty("property");
assertEquals(true, node.hasProperty("property"));
SaveDialogAction<SaveDialogActionDefinition> action = new SaveDialogAction<>(definition, item, validator, callback);
// WHEN
action.execute();
// THEN
node = session.getRootNode().getNode("underlying");
assertEquals(false, node.hasProperty("property"));
}
内容来源于网络,如有侵权,请联系作者删除!