本文整理了Java中org.eclipse.smarthome.core.items.Item.getLabel()
方法的一些代码示例,展示了Item.getLabel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item.getLabel()
方法的具体详情如下:
包路径:org.eclipse.smarthome.core.items.Item
类名称:Item
方法名:getLabel
[英]Returns the label of the item or null if no label is set.
[中]返回项目的标签,如果未设置标签,则返回null。
代码示例来源:origin: eclipse/smarthome
/**
* Creates a {@link Predicate} which can be used to filter {@link Item}s for a given label.
*
* @param label to filter
* @return created {@link Predicate}
*/
public static Predicate<Item> hasLabel(String label) {
return i -> label.equalsIgnoreCase(i.getLabel());
}
}
代码示例来源:origin: eclipse/smarthome
@Override
protected PersistedItem toPersistableElement(Item item) {
PersistedItem persistedItem = new PersistedItem(
item instanceof GroupItem ? ITEM_TYPE_GROUP : toItemFactoryName(item));
if (item instanceof GroupItem) {
GroupItem groupItem = (GroupItem) item;
String baseItemType = null;
Item baseItem = groupItem.getBaseItem();
if (baseItem != null) {
baseItemType = toItemFactoryName(baseItem);
}
persistedItem.baseItemType = baseItemType;
addFunctionToPersisedItem(persistedItem, groupItem);
}
persistedItem.label = item.getLabel();
persistedItem.groupNames = new ArrayList<>(item.getGroupNames());
persistedItem.tags = new HashSet<>(item.getTags());
persistedItem.category = item.getCategory();
return persistedItem;
}
代码示例来源:origin: eclipse/smarthome
public ItemBuilderImpl(Set<ItemFactory> itemFactories, Item item) {
this.itemFactories = itemFactories;
this.itemType = item.getType();
this.name = item.getName();
this.category = item.getCategory();
this.groups = item.getGroupNames();
this.label = item.getLabel();
this.tags = item.getTags();
if (item instanceof GroupItem) {
this.baseItem = ((GroupItem) item).getBaseItem();
this.groupFunction = ((GroupItem) item).getFunction();
}
}
代码示例来源:origin: eclipse/smarthome
private static void fillProperties(ItemDTO itemDTO, Item item) {
if (item instanceof GroupItem) {
GroupItem groupItem = (GroupItem) item;
GroupItemDTO groupItemDTO = (GroupItemDTO) itemDTO;
if (groupItem.getBaseItem() != null) {
groupItemDTO.groupType = groupItem.getBaseItem().getType();
groupItemDTO.function = mapFunction(groupItem.getFunction());
}
}
itemDTO.name = item.getName();
itemDTO.type = item.getType();
itemDTO.label = item.getLabel();
itemDTO.tags = item.getTags();
itemDTO.category = item.getCategory();
itemDTO.groupNames = item.getGroupNames();
}
代码示例来源:origin: openhab/openhab-core
/**
* Creates a {@link Predicate} which can be used to filter {@link Item}s for a given label.
*
* @param label to filter
* @return created {@link Predicate}
*/
public static Predicate<Item> hasLabel(String label) {
return i -> label.equalsIgnoreCase(i.getLabel());
}
}
代码示例来源:origin: org.eclipse.smarthome.ui/org.eclipse.smarthome.ui
@Override
public String getLabel(String itemName) {
if (itemRegistry != null) {
Item item = itemRegistry.get(itemName);
return item != null ? item.getLabel() : null;
}
return null;
}
代码示例来源:origin: org.eclipse.smarthome.ui/org.eclipse.smarthome.ui
@Override
public String getLabel(String itemName) {
for (ItemUIProvider provider : itemUIProviders) {
String currentLabel = provider.getLabel(itemName);
if (currentLabel != null) {
return currentLabel;
}
}
try {
Item item = getItem(itemName);
if (item.getLabel() != null) {
return item.getLabel();
}
} catch (ItemNotFoundException e) {
}
return null;
}
代码示例来源:origin: openhab/openhab-core
@Override
public String getLabel(String itemName) {
for (ItemUIProvider provider : itemUIProviders) {
String currentLabel = provider.getLabel(itemName);
if (currentLabel != null) {
return currentLabel;
}
}
try {
Item item = getItem(itemName);
if (item.getLabel() != null) {
return item.getLabel();
}
} catch (ItemNotFoundException e) {
}
return null;
}
代码示例来源:origin: openhab/openhab-core
private void addItem(Locale locale, HashMap<Item, ArrayList<HashSet<String>>> target, HashSet<String> tokens,
Item item) {
HashSet<String> nt = new HashSet<String>(tokens);
nt.addAll(tokenize(locale, item.getLabel()));
ArrayList<HashSet<String>> list = target.get(item);
if (list == null) {
target.put(item, list = new ArrayList<HashSet<String>>());
}
list.add(nt);
if (item instanceof GroupItem) {
for (Item member : ((GroupItem) item).getMembers()) {
addItem(locale, target, nt, member);
}
}
}
代码示例来源:origin: openhab/openhab-core
/**
* All the tokens (name parts) of the names of all the items in the {@link ItemRegistry}.
*
* @param locale The locale that is to be used for preparing the tokens.
* @return the identifier tokens
*/
HashSet<String> getAllItemTokens(Locale locale) {
if (allItemTokens == null) {
allItemTokens = new HashMap<Locale, HashSet<String>>();
}
HashSet<String> localeTokens = allItemTokens.get(locale);
if (localeTokens == null) {
allItemTokens.put(locale, localeTokens = new HashSet<String>());
for (Item item : itemRegistry.getAll()) {
localeTokens.addAll(tokenize(locale, item.getLabel()));
}
}
return localeTokens;
}
代码示例来源:origin: stackoverflow.com
+ "] at item: [" + i.getLabel() + "]");
代码示例来源:origin: openhab/openhab-core
@Override
protected PersistedItem toPersistableElement(Item item) {
PersistedItem persistedItem = new PersistedItem(
item instanceof GroupItem ? ITEM_TYPE_GROUP : toItemFactoryName(item));
if (item instanceof GroupItem) {
GroupItem groupItem = (GroupItem) item;
String baseItemType = null;
Item baseItem = groupItem.getBaseItem();
if (baseItem != null) {
baseItemType = toItemFactoryName(baseItem);
}
persistedItem.baseItemType = baseItemType;
addFunctionToPersisedItem(persistedItem, groupItem);
}
persistedItem.label = item.getLabel();
persistedItem.groupNames = new ArrayList<>(item.getGroupNames());
persistedItem.tags = new HashSet<>(item.getTags());
persistedItem.category = item.getCategory();
return persistedItem;
}
代码示例来源:origin: openhab/openhab-core
public ItemBuilderImpl(Set<ItemFactory> itemFactories, Item item) {
this.itemFactories = itemFactories;
this.itemType = item.getType();
this.name = item.getName();
this.category = item.getCategory();
this.groups = item.getGroupNames();
this.label = item.getLabel();
this.tags = item.getTags();
if (item instanceof GroupItem) {
this.baseItem = ((GroupItem) item).getBaseItem();
this.groupFunction = ((GroupItem) item).getFunction();
}
}
代码示例来源:origin: openhab/openhab-core
private static void fillProperties(ItemDTO itemDTO, Item item) {
if (item instanceof GroupItem) {
GroupItem groupItem = (GroupItem) item;
GroupItemDTO groupItemDTO = (GroupItemDTO) itemDTO;
if (groupItem.getBaseItem() != null) {
groupItemDTO.groupType = groupItem.getBaseItem().getType();
groupItemDTO.function = mapFunction(groupItem.getFunction());
}
}
itemDTO.name = item.getName();
itemDTO.type = item.getType();
itemDTO.label = item.getLabel();
itemDTO.tags = item.getTags();
itemDTO.category = item.getCategory();
itemDTO.groupNames = item.getGroupNames();
}
内容来源于网络,如有侵权,请联系作者删除!