Fix a wrongly failing validation rule for sitemap (#4240)

Problem introduced by #4223

checkFramesInWidgetList for LinkableWidget was triggering an error when the Buttongrid element has no parameter set.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
pull/4253/head
lolodomo 2024-05-26 16:02:54 +02:00 committed by GitHub
parent 42a31317d1
commit ad74d5a296
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 7 deletions

View File

@ -179,7 +179,7 @@ Input:
('visibility=[' (Visibility+=VisibilityRule (',' Visibility+=VisibilityRule)*) ']')?);
Buttongrid:
'Buttongrid' (('item=' item=ItemRef)? & ('label=' label=(ID | STRING))? &
{Buttongrid} 'Buttongrid' (('item=' item=ItemRef)? & ('label=' label=(ID | STRING))? &
(('icon=' icon=Icon) |
('icon=[' (IconRules+=IconRule (',' IconRules+=IconRule)*) ']') |
('staticIcon=' staticIcon=Icon))? &

View File

@ -16,7 +16,6 @@
package org.openhab.core.model.sitemap.validation
import org.openhab.core.model.sitemap.sitemap.Button
import org.openhab.core.model.sitemap.sitemap.ButtonDefinition
import org.openhab.core.model.sitemap.sitemap.Buttongrid
import org.openhab.core.model.sitemap.sitemap.Frame
import org.openhab.core.model.sitemap.sitemap.LinkableWidget
@ -112,13 +111,10 @@ class SitemapValidator extends AbstractSitemapValidator {
@Check
def void checkWidgetsInButtongrid(Buttongrid grid) {
var nb = 0
for (ButtonDefinition b : grid.getButtons) {
nb = nb + 1
}
val nb = grid.getButtons.size()
if (nb > 0 && grid.item === null) {
error("To use the \"buttons\" parameter in a Buttongrid, the \"item\" parameter is required",
SitemapPackage.Literals.BUTTONGRID.getEStructuralFeature(SitemapPackage.BUTTONGRID__CHILDREN));
SitemapPackage.Literals.BUTTONGRID.getEStructuralFeature(SitemapPackage.BUTTONGRID__ITEM));
}
for (Widget w : grid.children) {
if (!(w instanceof Button)) {