當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。