当前位置: 首页>>代码示例>>Java>>正文


Java Item.getItemProperty方法代码示例

本文整理汇总了Java中com.vaadin.data.Item.getItemProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Item.getItemProperty方法的具体用法?Java Item.getItemProperty怎么用?Java Item.getItemProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.data.Item的用法示例。


在下文中一共展示了Item.getItemProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
				}
			}
		}
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:26,代码来源:ItemPropertyValueChangeListener.java

示例2: passesFilter

import com.vaadin.data.Item; //导入方法依赖的package包/类
/**
 * Pass le filtre
 * 
 * @param itemId
 * @param item
 * @return true si filtre ok
 */
@Override
public boolean passesFilter(Object itemId, Item item) {
	final Property<?> p = item.getItemProperty(propertyId);
	if (p == null) {
		return false;
	}
	Object propertyValue = p.getValue();
	if (propertyValue == null) {
		return false;
	}

	final String value = stripAccents(propertyValue.toString());
	if (!value.contains(filterString)) {
		return false;
	}
	return true;
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:25,代码来源:InsensitiveStringFilter.java

示例3: itemPropertyChanged

import com.vaadin.data.Item; //导入方法依赖的package包/类
@Override
public void itemPropertyChanged(Datasource.ItemPropertyChangeEvent e) {
    Item wrapper = getItemWrapper(e.getItem());

    // MetaProperty worked wrong with properties from inherited superclasses
    MetaClass metaClass = datasource.getMetaClass();
    String property = e.getProperty();
    MetaPropertyPath metaPropertyPath = metaClass.getPropertyPath(property);
    if (metaPropertyPath == null && DynamicAttributesUtils.isDynamicAttribute(property)) {
        metaPropertyPath = DynamicAttributesUtils.getMetaPropertyPath(metaClass, property);
    }
    if (metaPropertyPath == null) {
        return;
    }
    Property itemProperty = wrapper.getItemProperty(metaPropertyPath);
    if (itemProperty instanceof PropertyWrapper) {
        ((PropertyWrapper) itemProperty).fireValueChangeEvent();
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:DataGridIndexedCollectionDsWrapper.java

示例4: assignTargetToDs

import com.vaadin.data.Item; //导入方法依赖的package包/类
private void assignTargetToDs(final Item item, final Collection<Target> targetDetailsList) {
    if (item == null || item.getItemProperty("id") == null) {
        return;
    }

    if (targetDetailsList.isEmpty()) {
        getNotification().displayWarning(i18n.getMessage("targets.not.exists"));
        return;
    }

    final Long distId = (Long) item.getItemProperty("id").getValue();
    final Optional<DistributionSet> findDistributionSetById = distributionSetManagement.get(distId);
    if (!findDistributionSetById.isPresent()) {
        notification.displayWarning(i18n.getMessage("distributionset.not.exists"));
        return;
    }

    showOrHidePopupAndNotification(validate(targetDetailsList, findDistributionSetById.get()));
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:20,代码来源:DistributionTable.java

示例5: restore

import com.vaadin.data.Item; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public PropertyBox restore(Configuration<?> configuration, Item item) {
	if (item != null) {
		// check is a PropertyBoxItem
		if (PropertyBoxItem.class.isAssignableFrom(item.getClass())) {
			return ((PropertyBoxItem) item).getPropertyBox();
		}
		// build from properties
		List<Property> ps = new LinkedList<>();
		configuration.getProperties().forEach(p -> {
			if (p.getClass().isAssignableFrom(Property.class)) {
				ps.add((Property) p);
			}
		});
		if (ps.isEmpty()) {
			throw new UnsupportedOperationException("Failed to restore PropertyBox from item [" + item
					+ "]: it is not a PropertyBoxItem and container properties are not of ["
					+ Property.class.getName() + "] type");
		}
		PropertyBox.Builder box = PropertyBox.builder(ps).invalidAllowed(true);
		for (Property property : ps) {
			com.vaadin.data.Property<?> itemProperty = item.getItemProperty(property);
			if (itemProperty != null) {
				box.set(property, itemProperty.getValue());
			}
		}
		return box.build();
	}
	return null;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:32,代码来源:PropertyBoxItemAdapter.java

示例6: getContainerProperty

import com.vaadin.data.Item; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Property getContainerProperty(Object itemId, Object propertyId) {
	final Item item = getItem(itemId);
	if (item != null) {
		return item.getItemProperty(propertyId);
	}
	return null;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:10,代码来源:DefaultItemDataSourceContainer.java

示例7: bindFields

import com.vaadin.data.Item; //导入方法依赖的package包/类
private void bindFields(List<Field<?>> fields, Item itemDataSource) {
	for (Field<?> field : fields) {
		if (itemDataSource.getItemProperty(getPropertyId(field)) != null) {
			bind(field, getPropertyId(field));
		}
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:8,代码来源:DefaultItemListing.java

示例8: filterByProperty

import com.vaadin.data.Item; //导入方法依赖的package包/类
private boolean filterByProperty(final String prop, final Item item,
        final String text) {
    if (item == null || item.getItemProperty(prop) == null
            || item.getItemProperty(prop).getValue() == null) {
        return false;
    }
    String val = item.getItemProperty(prop).getValue().toString().trim()
            .toLowerCase();
    if (val.contains(text.toLowerCase().trim())) {
        return true;
    }
    return false;
}
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:14,代码来源:TransactionsView.java

示例9: fillContainer

import com.vaadin.data.Item; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void fillContainer(HierarchicalContainer container, List<MenuItem> items, MenuItem parent) {
    for (MenuItem item : items) {
        Item containerItem = container.addItem(item);
        Property<String> caption = containerItem.getItemProperty(PROPERTY_CAPTION);
        caption.setValue(samplesMenuConfig.getMenuItemCaption(item.getId()));
        container.setParent(item, parent);
        if (item.isMenu()) {
            fillContainer(container, item.getChildren(), item);
        } else {
            container.setChildrenAllowed(item, false);
        }
    }
}
 
开发者ID:cuba-platform,项目名称:sampler,代码行数:15,代码来源:SamplerFoldersPane.java

示例10: passesFilter

import com.vaadin.data.Item; //导入方法依赖的package包/类
@Override
public boolean passesFilter(Object itemId, Item item) throws UnsupportedOperationException {
    Property property = item.getItemProperty(propertyId);
    if (property == null || !property.getType().equals(String.class))
        return false;

    String value = (String) property.getValue();
    return match(value) || checkParents((MenuItem) itemId);
}
 
开发者ID:cuba-platform,项目名称:sampler,代码行数:10,代码来源:SamplerFoldersPane.java

示例11: itemPropertyChanged

import com.vaadin.data.Item; //导入方法依赖的package包/类
@Override
public void itemPropertyChanged(Datasource.ItemPropertyChangeEvent e) {
    Item wrapper = getItemWrapper(e.getItem());

    // MetaProperty worked wrong with properties from inherited superclasses
    MetaPropertyPath metaPropertyPath = datasource.getMetaClass().getPropertyPath(e.getProperty());
    if (metaPropertyPath == null) {
        return;
    }
    Property itemProperty = wrapper.getItemProperty(metaPropertyPath);
    if (itemProperty instanceof PropertyWrapper) {
        ((PropertyWrapper) itemProperty).fireValueChangeEvent();
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:15,代码来源:CollectionDsWrapper.java

示例12: 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());

}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:73,代码来源:TestItems.java

示例13: getContainerProperty

import com.vaadin.data.Item; //导入方法依赖的package包/类
@Override
public Property getContainerProperty(Object itemId, Object propertyId) {
    final Item item = getItem(itemId);
    return item == null ? null : item.getItemProperty(propertyId);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:6,代码来源:CollectionDsWrapper.java

示例14: OptionsDsWrapper

import com.vaadin.data.Item; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public OptionsDsWrapper(CollectionDatasource datasource, Collection<MetaPropertyPath> properties, boolean autoRefresh) {
    this.datasource = datasource;
    this.autoRefresh = autoRefresh;

    final View view = datasource.getView();
    final MetaClass metaClass = datasource.getMetaClass();

    if (properties == null) {
        createProperties(view, metaClass);
    } else {
        this.properties.addAll(properties);
    }

    dsStateChangeListener = e -> itemsCache.clear();

    dsItemPropertyChangeListener = e -> {
        Item wrapper = getItemWrapper(e.getItem());

        // MetaProperty worked wrong with properties from inherited superclasses
        MetaPropertyPath metaPropertyPath = datasource.getMetaClass().getPropertyPath(e.getProperty());
        if (metaPropertyPath == null) {
            return;
        }
        Property itemProperty = wrapper.getItemProperty(metaPropertyPath);
        if (itemProperty instanceof PropertyWrapper) {
            ((PropertyWrapper) itemProperty).fireValueChangeEvent();
        }
    };

    cdsCollectionChangeListener = e -> {
        final boolean prevIgnoreListeners = ignoreListeners;
        try {
            itemsCache.clear();
            fireItemSetChanged();
        } finally {
            ignoreListeners = prevIgnoreListeners;
        }
    };

    weakDsListenerAdapter = new WeakDsListenerAdapter(datasource, dsItemPropertyChangeListener, dsStateChangeListener, cdsCollectionChangeListener);
    datasource.addCollectionChangeListener(weakDsListenerAdapter);
    datasource.addStateChangeListener(weakDsListenerAdapter);
    datasource.addItemPropertyChangeListener(weakDsListenerAdapter);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:46,代码来源:OptionsDsWrapper.java

示例15: getItemNameProperty

import com.vaadin.data.Item; //导入方法依赖的package包/类
private Property getItemNameProperty(final Object tokenId) {
    final Item item = tokenField.getContainerDataSource().getItem(tokenId);
    return item.getItemProperty(NAME_PROPERTY);
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:5,代码来源:AbstractTagToken.java


注:本文中的com.vaadin.data.Item.getItemProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。