本文整理汇总了Java中com.vaadin.v7.data.Property.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getValue方法的具体用法?Java Property.getValue怎么用?Java Property.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.v7.data.Property
的用法示例。
在下文中一共展示了Property.getValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loopAllEntitiesAndProperties
import com.vaadin.v7.data.Property; //导入方法依赖的package包/类
public void loopAllEntitiesAndProperties() throws IOException {
NullOutputStream nullOutputStream = new NullOutputStream();
List<Person> listOfPersons = Service.getListOfPersons(100 * 1000);
long currentTimeMillis = System.currentTimeMillis();
ListContainer<Person> listContainer = new ListContainer<>(
listOfPersons);
Collection<?> ids = listContainer.getContainerPropertyIds();
for (int i = 0; i < listContainer.size(); i++) {
Item item = listContainer.getItem(listOfPersons.get(i));
for (Object propertyId : ids) {
Property itemProperty = item.getItemProperty(propertyId);
final Object value = itemProperty.getValue();
nullOutputStream.write(value.toString().getBytes());
LOG.log(Level.FINEST, "Property: %s", value);
}
}
LOG.
log(Level.INFO,
"Looping all properties in 100 000 Items took {0}ms",
(System.currentTimeMillis() - currentTimeMillis));
}
示例2: loopAllEntitiesAndPropertiesWithBeanItemContainer
import com.vaadin.v7.data.Property; //导入方法依赖的package包/类
public void loopAllEntitiesAndPropertiesWithBeanItemContainer() throws IOException {
NullOutputStream nullOutputStream = new NullOutputStream();
List<Person> listOfPersons = Service.getListOfPersons(100 * 1000);
long currentTimeMillis = System.currentTimeMillis();
BeanItemContainer<Person> c = new BeanItemContainer<>(
Person.class, listOfPersons);
Collection<?> ids = c.getContainerPropertyIds();
for (int i = 0; i < c.size(); i++) {
Item item = c.getItem(listOfPersons.get(i));
for (Object propertyId : ids) {
Property itemProperty = item.getItemProperty(propertyId);
final Object value = itemProperty.getValue();
nullOutputStream.write(value.toString().getBytes());
LOG.log(Level.FINEST, "Property: %s", value);
}
}
// ~ 350ms in 1.34, MacBook Pro (Retina, Mid 2012) 2.3Gz i7
// ~ + 3-10ms in 1.35, when changing ListContainer to use PropertyUtils instead of WrapDynaBean
LOG.
log(Level.INFO,
"BIC from core: Looping all properties in 100 000 Items took {0}ms",
(System.currentTimeMillis() - currentTimeMillis));
}
示例3: setPropertyDataSource
import com.vaadin.v7.data.Property; //导入方法依赖的package包/类
@Override
public void setPropertyDataSource(Property newDataSource)
{
super.setPropertyDataSource(newDataSource);
if (newDataSource != null) {
layout.removeAllComponents();
Component value = (Component) newDataSource.getValue();
if (value != null) {
layout.addComponent(value);
}
}
}
示例4: getPrimaryKeys
import com.vaadin.v7.data.Property; //导入方法依赖的package包/类
protected Object[] getPrimaryKeys() {
String[] columnNames = resultTable.getPrimaryKeyColumnNames();
Object[] pks = new Object[columnNames.length];
Item row = grid.getContainerDataSource().getItem(grid.getEditedItemId());
int index = 0;
for (String columnName : columnNames) {
Property<?> p = row.getItemProperty(columnName);
if (p != null) {
pks[index++] = p.getValue();
} else {
return null;
}
}
return pks;
}
示例5: createTable
import com.vaadin.v7.data.Property; //导入方法依赖的package包/类
public static Table createTable() {
Table table = new Table() {
private static final long serialVersionUID = 1L;
@Override
protected String formatPropertyValue(Object rowId, Object colId, Property<?> property) {
if (property.getValue() != null) {
if (property.getType() == Date.class) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss aaa");
return df.format((Date) property.getValue());
} else if (Number.class.isAssignableFrom(property.getType())) {
return property.getValue().toString();
}
}
return super.formatPropertyValue(rowId, colId, property);
}
};
table.setCellStyleGenerator(new CellStyleGenerator() {
private static final long serialVersionUID = 1L;
@Override
public String getStyle(Table source, Object itemId, Object propertyId) {
if (propertyId != null && propertyId.equals("#")) {
return "rowheader";
}
return null;
}
});
return table;
}
示例6: validateField
import com.vaadin.v7.data.Property; //导入方法依赖的package包/类
private boolean validateField(final JcrNodeAdapter jcrNodeAdapter) {
boolean validField = true;
Property<?> vanityUrl = jcrNodeAdapter.getItemProperty(PN_VANITY_URL);
Property<?> site = jcrNodeAdapter.getItemProperty(PN_SITE);
if (vanityUrl.getValue() != null && site.getValue() != null) {
Node vanityUrlNode = _vanityUrlService.queryForVanityUrlNode(vanityUrl.getValue().toString(), site.getValue().toString());
validField = vanityUrlNode == null;
}
return validField;
}
示例7: testListContainer
import com.vaadin.v7.data.Property; //导入方法依赖的package包/类
@Test
public void testListContainer() {
ListContainer<Entity> listContainer = getTestListContainer();
Entity entity = listContainer.getIdByIndex(0);
Item dynaBeanItem = listContainer.getItem(entity);
Property itemProperty = dynaBeanItem.getItemProperty("property");
Assert.assertNotNull(itemProperty);
Assert.assertEquals("foo", itemProperty.getValue());
// Should not be reported by default...
boolean contains = listContainer.getContainerPropertyIds().contains(
"detail.property");
Assert.assertFalse(contains);
// But should be found if explicitly requested
Property nestedProperty = dynaBeanItem.
getItemProperty("detail.property");
Assert.assertNotNull(nestedProperty);
Assert.assertEquals("bar", nestedProperty.getValue());
Assert.assertEquals(String.class, nestedProperty.getType());
Property indexedProperty = dynaBeanItem.
getItemProperty("numbers[2]");
Assert.assertNotNull(indexedProperty);
Assert.assertEquals((entity.getId() + 1) * 3l, indexedProperty.
getValue());
Assert.assertEquals(Long.class, indexedProperty.getType());
Property mappedProperty = dynaBeanItem.
getItemProperty("stringToInteger(id)");
Assert.assertNotNull(mappedProperty);
Assert.
assertEquals(entity.getId().intValue(), mappedProperty.
getValue());
Assert.assertEquals(Integer.class, mappedProperty.getType());
Property thirdLevel = dynaBeanItem.
getItemProperty("detailList[1].property");
Assert.assertNotNull(thirdLevel);
Assert.assertEquals("bar", thirdLevel.getValue());
Assert.assertEquals(String.class, thirdLevel.getType());
Property awkward = dynaBeanItem.
getItemProperty("detailList[1].moreDetails[0]");
Assert.assertNotNull(awkward);
Detail2 value = (Detail2) awkward.getValue();
Assert.assertEquals(Integer.valueOf(69), value.getProperty());
Assert.assertEquals(Detail2.class, awkward.getType());
Property weird = dynaBeanItem.
getItemProperty("detailList[1].detail2.property");
Assert.assertNotNull(weird);
Assert.assertEquals(69, weird.getValue());
Assert.assertEquals(Integer.class, weird.getType());
Property weirdest = dynaBeanItem.
getItemProperty("detailList[1].moreDetails[1].property");
Assert.assertNotNull(weirdest);
Assert.assertEquals(69, weirdest.getValue());
Assert.assertEquals(Integer.class, weirdest.getType());
Property nonTypedListItem = dynaBeanItem.
getItemProperty("detailList[1].nonTypedDetails[0]");
Assert.assertNotNull(weirdest);
final Detail2 value1 = (Detail2) nonTypedListItem.getValue();
// Is of type Detail2, but reported type should be Object
// (can't be inspected)
Assert.assertEquals(Integer.valueOf(69), value1.getProperty());
Assert.assertEquals(Object.class, nonTypedListItem.getType());
}