[sitemap] Add releaseOnly parameter to Slider sitemap element (#4084)

Related to #3430

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
pull/4091/head
lolodomo 2024-02-12 20:12:19 +01:00 committed by GitHub
parent 0efaf23d4e
commit a906d09b40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 8 additions and 1 deletions

View File

@ -584,6 +584,7 @@ public class SitemapResource
if (widget instanceof Slider sliderWidget) {
bean.sendFrequency = sliderWidget.getFrequency();
bean.switchSupport = sliderWidget.isSwitchEnabled();
bean.releaseOnly = sliderWidget.isReleaseOnly();
bean.minValue = sliderWidget.getMinValue();
bean.maxValue = sliderWidget.getMaxValue();
bean.step = sliderWidget.getStep();

View File

@ -55,6 +55,7 @@ public class WidgetDTO {
// widget-specific attributes
public final List<MappingDTO> mappings = new ArrayList<>();
public Boolean switchSupport;
public Boolean releaseOnly;
public Integer sendFrequency;
public Integer refresh;
public Integer height;

View File

@ -127,7 +127,8 @@ Slider:
('icon=[' (IconRules+=IconRule (',' IconRules+=IconRule)*) ']') |
('staticIcon=' staticIcon=Icon))? &
('sendFrequency=' frequency=INT)? & (switchEnabled?='switchSupport')? &
('minValue=' minValue=Number)? & ('maxValue=' maxValue=Number)? & ('step=' step=Number)? &
(releaseOnly?='releaseOnly')? & ('minValue=' minValue=Number)? &
('maxValue=' maxValue=Number)? & ('step=' step=Number)? &
('labelcolor=[' (LabelColor+=ColorArray (',' LabelColor+=ColorArray)*) ']')? &
('valuecolor=[' (ValueColor+=ColorArray (',' ValueColor+=ColorArray)*) ']')? &
('iconcolor=[' (IconColor+=ColorArray (',' IconColor+=ColorArray)*) ']')? &

View File

@ -240,6 +240,8 @@ public class UIComponentSitemapProvider implements SitemapProvider, RegistryChan
setWidgetPropertyFromComponentConfig(widget, component, "step", SitemapPackage.SLIDER__STEP);
setWidgetPropertyFromComponentConfig(widget, component, "switchEnabled",
SitemapPackage.SLIDER__SWITCH_ENABLED);
setWidgetPropertyFromComponentConfig(widget, component, "releaseOnly",
SitemapPackage.SLIDER__RELEASE_ONLY);
setWidgetPropertyFromComponentConfig(widget, component, "sendFrequency",
SitemapPackage.SLIDER__FREQUENCY);
break;

View File

@ -284,6 +284,7 @@ public class ItemUIRegistryImpl implements ItemUIRegistry {
} else if (DimmerItem.class.equals(itemType)) {
Slider slider = SitemapFactory.eINSTANCE.createSlider();
slider.setSwitchEnabled(true);
slider.setReleaseOnly(true);
return slider;
} else if (ImageItem.class.equals(itemType)) {
return SitemapFactory.eINSTANCE.createImage();

View File

@ -815,6 +815,7 @@ public class ItemUIRegistryImplTest {
defaultWidget = uiRegistry.getDefaultWidget(DimmerItem.class, ITEM_NAME);
assertThat(defaultWidget, is(instanceOf(Slider.class)));
assertThat(((Slider) defaultWidget).isSwitchEnabled(), is(true));
assertThat(((Slider) defaultWidget).isReleaseOnly(), is(true));
defaultWidget = uiRegistry.getDefaultWidget(ImageItem.class, ITEM_NAME);
assertThat(defaultWidget, is(instanceOf(Image.class)));