本文整理汇总了Java中com.vaadin.v7.data.Item类的典型用法代码示例。如果您正苦于以下问题:Java Item类的具体用法?Java Item怎么用?Java Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Item类属于com.vaadin.v7.data包,在下文中一共展示了Item类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateData
import com.vaadin.v7.data.Item; //导入依赖的package包/类
@Override
public void generateData(Object itemId, Item item, JsonObject jsonRow) {
JsonObject jsonData = jsonRow.getObject("d");
for (String key : jsonData.keys()) {
if (getColumn(key).getRenderer() == this) {
// 2: VERY IMPORTANT get the component from the connector tracker !!!
// if you use a GeneratedPropertyContainer and call get Value you will
// get a different component
if (jsonData.get(key) != Json.createNull()) {
Component current = lookupComponent(jsonData, key);
trackComponent(itemId, current);
}
}
}
}
开发者ID:datenhahn,项目名称:componentrenderer,代码行数:20,代码来源:ComponentRenderer.java
示例2: testAddComponentColumn
import com.vaadin.v7.data.Item; //导入依赖的package包/类
@Test
public void testAddComponentColumn() {
ComponentGrid grid = createTestGrid();
Item firstItem = grid.getContainerDataSource().getItem(grid.getContainerDataSource().getIdByIndex(0));
assertThat((String) firstItem.getItemProperty(COLUMN_CAPTION).getValue(), is(FOO_0));
grid.addComponentColumn(COLUMN_CAPTION, new ComponentGenerator<ExampleBean>() {
@Override
public Component getComponent(ExampleBean bean) {
return new Label(bean.getCaption());
}
});
firstItem = grid.getContainerDataSource().getItem(grid.getContainerDataSource().getIdByIndex(0));
assertThat(firstItem.getItemProperty(COLUMN_CAPTION).getValue(), is(instanceOf(Label.class)));
Label firstLabel = (Label) firstItem.getItemProperty(COLUMN_CAPTION).getValue();
assertThat(firstLabel.getValue(), is(FOO_0));
}
开发者ID:datenhahn,项目名称:componentrenderer,代码行数:21,代码来源:ComponentGridTest.java
示例3: testSetRows
import com.vaadin.v7.data.Item; //导入依赖的package包/类
@Test
public void testSetRows() {
ComponentGrid grid = createTestGrid();
assertThat(grid.getContainerDataSource().getItemIds().size(), is(10));
List<ExampleBean> newBeans = new ArrayList<>();
for(int i=0;i<2;i++) {
ExampleBean bean = new ExampleBean();
bean.setCaption("new" +i);
bean.setIsSomething(true);
newBeans.add(bean);
}
grid.setRows(newBeans);
assertThat(grid.getContainerDataSource().getItemIds().size(), is(2));
Item firstItem = grid.getContainerDataSource().getItem(grid.getContainerDataSource().getIdByIndex(0));
assertThat((String)firstItem.getItemProperty(COLUMN_CAPTION).getValue(), is("new0"));
}
开发者ID:datenhahn,项目名称:componentrenderer,代码行数:23,代码来源:ComponentGridTest.java
示例4: testAddComponentColumn
import com.vaadin.v7.data.Item; //导入依赖的package包/类
@Test
public void testAddComponentColumn() {
Grid grid = createTestGrid();
ComponentGridDecorator<ExampleBean> decorator = new ComponentGridDecorator<>(grid, ExampleBean.class);
Item firstItem = grid.getContainerDataSource().getItem(grid.getContainerDataSource().getIdByIndex(0));
assertThat((String) firstItem.getItemProperty(COLUMN_CAPTION).getValue(), is(FOO_0));
decorator.addComponentColumn(COLUMN_CAPTION, new ComponentGenerator<ExampleBean>() {
@Override
public Component getComponent(ExampleBean bean) {
return new Label(bean.getCaption());
}
});
firstItem = grid.getContainerDataSource().getItem(grid.getContainerDataSource().getIdByIndex(0));
assertThat(firstItem.getItemProperty(COLUMN_CAPTION).getValue(), is(instanceOf(Label.class)));
Label firstLabel = (Label) firstItem.getItemProperty(COLUMN_CAPTION).getValue();
assertThat(firstLabel.getValue(), is(FOO_0));
}
开发者ID:datenhahn,项目名称:componentrenderer,代码行数:22,代码来源:ComponentGridDecoratorTest.java
示例5: testSetRows
import com.vaadin.v7.data.Item; //导入依赖的package包/类
@Test
public void testSetRows() {
Grid grid = createTestGrid();
ComponentGridDecorator<ExampleBean> decorator = new ComponentGridDecorator<>(grid, ExampleBean.class);
assertThat(grid.getContainerDataSource().getItemIds().size(), is(10));
List<ExampleBean> newBeans = new ArrayList<>();
for(int i=0;i<2;i++) {
ExampleBean bean = new ExampleBean();
bean.setCaption("new" +i);
bean.setIsSomething(true);
newBeans.add(bean);
}
decorator.setRows(newBeans);
assertThat(grid.getContainerDataSource().getItemIds().size(), is(2));
Item firstItem = grid.getContainerDataSource().getItem(grid.getContainerDataSource().getIdByIndex(0));
assertThat((String)firstItem.getItemProperty(COLUMN_CAPTION).getValue(), is("new0"));
}
开发者ID:datenhahn,项目名称:componentrenderer,代码行数:24,代码来源:ComponentGridDecoratorTest.java
示例6: ensureRowRefreshListener
import com.vaadin.v7.data.Item; //导入依赖的package包/类
protected void ensureRowRefreshListener(boolean isEnabled) {
if (isEnabled && reloadDataEfficientlyAfterEditor == null) {
reloadDataEfficientlyAfterEditor = new FieldGroup.CommitHandler() {
private static final long serialVersionUID = -9107206992771475209L;
@Override
public void preCommit(FieldGroup.CommitEvent commitEvent) throws FieldGroup.CommitException {
}
@Override
public void postCommit(FieldGroup.CommitEvent commitEvent) throws FieldGroup.CommitException {
Item itemDataSource = commitEvent.getFieldBinder().
getItemDataSource();
if (itemDataSource instanceof ListContainer.DynaBeanItem) {
ListContainer<T>.DynaBeanItem<T> dynaBeanItem = (ListContainer<T>.DynaBeanItem<T>) itemDataSource;
T bean = dynaBeanItem.getBean();
refreshRow(bean);
}
}
};
getEditorFieldGroup().addCommitHandler(
reloadDataEfficientlyAfterEditor);
}
}
开发者ID:viritin,项目名称:viritin,代码行数:26,代码来源:MGrid.java
示例7: loopAllEntitiesAndProperties
import com.vaadin.v7.data.Item; //导入依赖的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));
}
开发者ID:viritin,项目名称:viritin,代码行数:22,代码来源:ListContainerLoopPerformanceTest.java
示例8: loopAllEntitiesAndPropertiesWithBeanItemContainer
import com.vaadin.v7.data.Item; //导入依赖的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));
}
开发者ID:viritin,项目名称:viritin,代码行数:25,代码来源:ListContainerLoopPerformanceTest.java
示例9: getValue
import com.vaadin.v7.data.Item; //导入依赖的package包/类
@Override
public String getValue(Item item, Object itemId, Object propertyId) {
Person p = (Person)itemId;
StringBuilder displayValue = new StringBuilder();
List<Address> addresses = p.getAddresses();
if (addresses != null && !addresses.isEmpty()) {
displayValue.append("Addresses: ");
for (Address address : addresses) {
if (address == null) {
continue;
}
displayValue.append(address.getZipCode());
displayValue.append("; ");
displayValue.append(address.getCity());
displayValue.append("; ");
displayValue.append(address.getStreet());
}
}
return displayValue.toString();
}
开发者ID:viritin,项目名称:viritin,代码行数:21,代码来源:GeneratedPropertyListContainerExample.java
示例10: NativeSelectInForm
import com.vaadin.v7.data.Item; //导入依赖的package包/类
public NativeSelectInForm() {
setDescription("NativeSelect in forms should work fine on Android");
BeanItem<Bean> bi = new BeanItem<Bean>(new Bean());
Form form = new Form();
form.setCaption("Old deprecated form");
form.setFormFieldFactory(new FormFieldFactory() {
@Override
public Field<?> createField(Item item, Object propertyId,
Component uiContext) {
return createNativeSelect();
}
});
form.setItemDataSource(bi);
form.setBuffered(false);
addComponent(form);
NativeSelect select = createNativeSelect();
FormLayout layout = new FormLayout();
layout.setCaption("New field group in a form layout");
layout.addComponent(select);
FieldGroup fg = new FieldGroup(bi);
fg.bind(select, "aString");
fg.setBuffered(false);
addComponent(layout);
}
开发者ID:vaadin,项目名称:touchkit,代码行数:27,代码来源:NativeSelectInForm.java
示例11: MeetingRoomForm
import com.vaadin.v7.data.Item; //导入依赖的package包/类
public MeetingRoomForm() {
setFormFieldFactory(new DefaultFieldFactory() {
@Override
public Field createField(Item item, Object propertyId,
Component uiContext) {
Field field = super
.createField(item, propertyId, uiContext);
if (propertyId.equals("roomType")) {
roomTypes = new NativeSelect("Room Type");
roomTypes.setNewItemsAllowed(false);
roomTypes.setNullSelectionAllowed(false);
getRoomTypes();
field = roomTypes;
return field;
} else {
return null;
}
}
});
}
开发者ID:vaadin,项目名称:touchkit,代码行数:25,代码来源:MeetingRoomView.java
示例12: testCustomField
import com.vaadin.v7.data.Item; //导入依赖的package包/类
@Test
public void testCustomField() {
Grid grid = createTestGrid();
ComponentGridDecorator<ExampleBean> decorator = new ComponentGridDecorator<>(grid, ExampleBean.class);
decorator.addComponentColumn(COLUMN_CAPTION, new ComponentGenerator<ExampleBean>() {
@Override
public Component getComponent(ExampleBean bean) {
return new Label(bean.getCaption());
}
});
Item item = grid.getContainerDataSource().getItem(grid.getContainerDataSource().getIdByIndex(0));
Property prop = item.getItemProperty(COLUMN_CAPTION)
;
ComponentCustomField field = new ComponentCustomField();
HorizontalLayout layout = (HorizontalLayout)field.initContent();
assertThat(layout, not(hasItem(isA(Label.class))));
field.setPropertyDataSource(prop);
assertThat(field.getValue(), instanceOf(Label.class));
assertThat(layout, hasItem(isA(Label.class)));
}
开发者ID:datenhahn,项目名称:componentrenderer,代码行数:28,代码来源:ComponentCustomFieldTest.java
示例13: testGetValue
import com.vaadin.v7.data.Item; //导入依赖的package包/类
@Test
public void testGetValue() {
ExampleBean bean = new ExampleBean();
bean.setCaption(LABEL_TEST_CAPTION);
Label label = (Label) generator.getValue(mock(Item.class), bean, "nocolumn");
assertThat(label.getValue(), is(LABEL_TEST_CAPTION));
Label label2 = (Label) generator.getValue(mock(Item.class), bean, "nocolumn");
assertThat(label, not(sameInstance(label2)));
}
开发者ID:datenhahn,项目名称:componentrenderer,代码行数:11,代码来源:ComponentPropertyGeneratorTest.java
示例14: createTreeTable
import com.vaadin.v7.data.Item; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private TreeTable createTreeTable() {
table = new TreeTable();
table.addContainerProperty("id", String.class, null);
for (int i = 0; i < 10; ++i) {
Item item = table.addItem(i);
item.getItemProperty("id").setValue(i + " foobar");
}
return table;
}
开发者ID:vaadin,项目名称:context-menu,代码行数:11,代码来源:ContextMenuTreeTable.java
示例15: createVaadin7Grid
import com.vaadin.v7.data.Item; //导入依赖的package包/类
private Grid createVaadin7Grid() {
Grid grid = new Grid();
grid.setCaption("Vaadin 7 Grid");
grid.setHeightMode(HeightMode.ROW);
grid.setHeightByRows(3);
IndexedContainer container = new IndexedContainer();
container.addContainerProperty(FIRST_NAME, String.class, "");
container.addContainerProperty(LAST_NAME, String.class, "");
container.addContainerProperty(SHOE_SIZE, String.class, "");
grid.setContainerDataSource(container);
Item item = container.addItem("foo");
item.getItemProperty(FIRST_NAME).setValue("John");
item.getItemProperty(LAST_NAME).setValue("Doe");
item.getItemProperty(SHOE_SIZE).setValue("48");
GridContextMenu contextMenu2 = new GridContextMenu(grid);
contextMenu2.addGridHeaderContextMenuListener(e -> {
contextMenu2.removeItems();
contextMenu2.addItem(getInfo(e),
f -> Notification.show("did something"));
});
contextMenu2.addGridBodyContextMenuListener(e -> {
contextMenu2.removeItems();
contextMenu2.addItem(getInfo(e),
f -> Notification.show("did something"));
});
return grid;
}
开发者ID:vaadin,项目名称:context-menu,代码行数:34,代码来源:ContextmenuUI.java
示例16: getSelectedTables
import com.vaadin.v7.data.Item; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<String> getSelectedTables() {
listOfTablesTable.commit();
List<String> select = new ArrayList<String>();
Collection<Object> itemIds = (Collection<Object>) listOfTablesTable.getItemIds();
for (Object itemId : itemIds) {
Item item = listOfTablesTable.getItem(itemId);
CheckBox checkBox = (CheckBox) item.getItemProperty("selected").getValue();
if (checkBox.getValue().equals(Boolean.TRUE) && checkBox.isEnabled()) {
select.add((String) itemId);
}
}
return select;
}
开发者ID:JumpMind,项目名称:sqlexplorer-vaadin,代码行数:15,代码来源:TableSelectionLayout.java
示例17: selectAll
import com.vaadin.v7.data.Item; //导入依赖的package包/类
public void selectAll() {
@SuppressWarnings("unchecked")
Collection<Object> itemIds = (Collection<Object>) listOfTablesTable.getItemIds();
for (Object itemId : itemIds) {
Item item = listOfTablesTable.getItem(itemId);
CheckBox checkBox = (CheckBox) item.getItemProperty("selected").getValue();
if (checkBox.isEnabled()) {
checkBox.setValue(Boolean.TRUE);
}
}
}
开发者ID:JumpMind,项目名称:sqlexplorer-vaadin,代码行数:12,代码来源:TableSelectionLayout.java
示例18: selectNone
import com.vaadin.v7.data.Item; //导入依赖的package包/类
public void selectNone() {
@SuppressWarnings("unchecked")
Collection<Object> itemIds = (Collection<Object>) listOfTablesTable.getItemIds();
for (Object itemId : itemIds) {
Item item = listOfTablesTable.getItem(itemId);
CheckBox checkBox = (CheckBox) item.getItemProperty("selected").getValue();
if (checkBox.isEnabled()) {
checkBox.setValue(Boolean.FALSE);
}
}
}
开发者ID:JumpMind,项目名称:sqlexplorer-vaadin,代码行数:12,代码来源:TableSelectionLayout.java
示例19: getPrimaryKeys
import com.vaadin.v7.data.Item; //导入依赖的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;
}
开发者ID:JumpMind,项目名称:sqlexplorer-vaadin,代码行数:16,代码来源:TabularResultLayout.java
示例20: getSelectedTables
import com.vaadin.v7.data.Item; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<String> getSelectedTables() {
tableSelectionLayout.listOfTablesTable.commit();
List<String> select = new ArrayList<String>();
Collection<Object> itemIds = (Collection<Object>) tableSelectionLayout.listOfTablesTable
.getItemIds();
for (Object itemId : itemIds) {
Item item = tableSelectionLayout.listOfTablesTable.getItem(itemId);
CheckBox checkBox = (CheckBox) item.getItemProperty("selected").getValue();
if (checkBox.getValue().equals(Boolean.TRUE) && checkBox.isEnabled()) {
select.add((String) itemId);
}
}
return select;
}
开发者ID:JumpMind,项目名称:sqlexplorer-vaadin,代码行数:16,代码来源:DbFillDialog.java
注:本文中的com.vaadin.v7.data.Item类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论