@Override public String getLabel(String itemName) { return itemUIRegistry.getLabel(itemName); }
@Override public String getIcon(String itemName) { return itemUIRegistry.getCategory(itemName); }
protected String getState(Widget w) { State state = itemUIRegistry.getState(w); if (state != null) { return state.toString(); } else { return "NULL"; } }
private void addItemWithName(Set<Item> items, String itemName) { if (itemName != null) { try { Item item = itemUIRegistry.getItem(itemName); items.add(item); } catch (ItemNotFoundException e) { // ignore } } }
private String buildProxyUrl(String sitemapName, Widget widget, URI uri) { String wId = itemUIRegistry.getWidgetId(widget); StringBuilder sb = new StringBuilder(); sb.append(uri.getScheme()).append("://").append(uri.getHost()); if (uri.getPort() >= 0) { sb.append(":").append(uri.getPort()); } sb.append("/proxy?sitemap=").append(sitemapName).append(".sitemap&widgetId=").append(wId); return sb.toString(); }
@Override public Widget getWidget(String itemName) { for (ItemUIProvider provider : itemUIProviders) { Widget currentWidget = provider.getWidget(itemName); if (currentWidget != null) { return resolveDefault(currentWidget); } } return null; }
@Override public Collection<Item> getItems(String pattern) { Collection<org.eclipse.smarthome.core.items.Item> eshItems = itemUIRegistry.getItems(pattern); Collection<Item> ohItems = new HashSet<>(eshItems.size()); for (org.eclipse.smarthome.core.items.Item eshItem : eshItems) { ohItems.add(ItemMapper.mapToOpenHABItem(eshItem)); } return ohItems; }
@Reference protected void setItemUIRegistry(org.eclipse.smarthome.ui.items.ItemUIRegistry itemUIRegistry) { this.itemUIRegistry = itemUIRegistry; itemUIRegistry.addRegistryChangeListener(this); }
@Override public Item getItemByPattern(String name) throws ItemNotFoundException, ItemNotUniqueException { org.eclipse.smarthome.core.items.Item eshItem; try { eshItem = itemUIRegistry.getItemByPattern(name); } catch (org.eclipse.smarthome.core.items.ItemNotFoundException e) { throw new ItemNotFoundException(name); } catch (org.eclipse.smarthome.core.items.ItemNotUniqueException e) { throw new ItemNotUniqueException(name, null); } return ItemMapper.mapToOpenHABItem(eshItem); }
/** * Returns formatted value of the item associated to widget * * @param w widget to get value for * @return value to use for the widget */ public String getValue(Widget w) { return getValue(itemUIRegistry.getLabel(w)); }
private void addItemWithName(Set<Item> items, String itemName) { if (itemName != null) { try { Item item = itemUIRegistry.getItem(itemName); items.add(item); } catch (ItemNotFoundException e) { // ignore } } }
protected String getCategory(Widget w) { return itemUIRegistry.getCategory(w); }
private String buildProxyUrl(String sitemapName, Widget widget, URI uri) { String wId = itemUIRegistry.getWidgetId(widget); StringBuilder sb = new StringBuilder(); sb.append(uri.getScheme()).append("://").append(uri.getHost()); if (uri.getPort() >= 0) { sb.append(":").append(uri.getPort()); } sb.append("/proxy?sitemap=").append(sitemapName).append(".sitemap&widgetId=").append(wId); return sb.toString(); }
@Override public Widget getWidget(String itemName) { for (ItemUIProvider provider : itemUIProviders) { Widget currentWidget = provider.getWidget(itemName); if (currentWidget != null) { return resolveDefault(currentWidget); } } return null; }
@Override public Collection<Item> getItems() { Collection<org.eclipse.smarthome.core.items.Item> eshItems = itemUIRegistry.getItems(); Collection<Item> ohItems = new HashSet<>(eshItems.size()); for (org.eclipse.smarthome.core.items.Item eshItem : eshItems) { ohItems.add(ItemMapper.mapToOpenHABItem(eshItem)); } return ohItems; }
@Override public String getLabel(Widget w) { return itemUIRegistry.getLabel(w.getItem()); }
@Override public Item getItem(String name) throws ItemNotFoundException { org.eclipse.smarthome.core.items.Item eshItem; try { eshItem = itemUIRegistry.getItem(name); } catch (org.eclipse.smarthome.core.items.ItemNotFoundException e) { throw new ItemNotFoundException(name); } return ItemMapper.mapToOpenHABItem(eshItem); }
@Override public String getIcon(Widget w) { return itemUIRegistry.getCategory(w.getItem()); }
/** * Retrieves the label for a widget * * @param w the widget to retrieve the label for * @return the label to use for the widget */ public String getLabel(Widget w) { return getLabel(itemUIRegistry.getLabel(w)); }
/** * Returns whether the item associated to widget has a value or not * * @param w widget * @return true if the item associated to widget has a value */ public boolean hasValue(Widget w) { return hasValue(itemUIRegistry.getLabel(w)); }