From 0b03addd101e1762782e7e73073709b04030cf82 Mon Sep 17 00:00:00 2001 From: Simon Kaufmann Date: Wed, 2 May 2018 18:15:57 +0200 Subject: [PATCH] refresh internal widget collection on sitemap change This partially reverts #3846. fixes #5522 Signed-off-by: Simon Kaufmann --- .../smarthome/io/rest/sitemap/SitemapSubscriptionService.java | 4 +++- .../io/rest/sitemap/internal/PageChangeListener.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/SitemapSubscriptionService.java b/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/SitemapSubscriptionService.java index 15ca9483b53..c65694b85bc 100644 --- a/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/SitemapSubscriptionService.java +++ b/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/SitemapSubscriptionService.java @@ -281,9 +281,11 @@ public void modelChanged(String modelName, EventType type) { for (Entry listenerEntry : pageChangeListeners.entrySet()) { String sitemapWithPage = listenerEntry.getKey(); String sitemapName = extractSitemapName(sitemapWithPage); + String pageId = extractPageId(sitemapWithPage); if (sitemapName.equals(changedSitemapName)) { - listenerEntry.getValue().sitemapContentChanged(); + EList widgets = collectWidgets(sitemapName, pageId); + listenerEntry.getValue().sitemapContentChanged(widgets); } } } diff --git a/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/internal/PageChangeListener.java b/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/internal/PageChangeListener.java index 1a873657819..3848cba841f 100644 --- a/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/internal/PageChangeListener.java +++ b/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/internal/PageChangeListener.java @@ -257,7 +257,9 @@ private boolean definesVisibilityOrColor(Widget w, String name) { return false; } - public void sitemapContentChanged() { + public void sitemapContentChanged(EList widgets) { + updateItemsAndWidgets(widgets); + SitemapChangedEvent changeEvent = new SitemapChangedEvent(); changeEvent.pageId = pageId; changeEvent.sitemapName = sitemapName;