Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ private PageDTO createPageBean(String sitemapName, @Nullable String title, @Null
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)*) ']')? &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ protected Sitemap buildSitemap(RootUIComponent rootComponent) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ private void applyConfig(@Nullable Map<String, Object> config) {
} 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ public void getDefaultWidgets() {
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)));
Expand Down