Add Input widget to main UI sitemap configuration and REST API (#3431)

* add input widget to UI SitemapProviderImpl
* inputHint in UIComponentSitemapProvider
* add input element to REST

Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
This commit is contained in:
Mark Herwege 2023-04-13 20:04:47 +02:00 committed by GitHub
parent e535510483
commit 44a146f5a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View File

@ -75,6 +75,7 @@ import org.openhab.core.model.sitemap.sitemap.Chart;
import org.openhab.core.model.sitemap.sitemap.ColorArray;
import org.openhab.core.model.sitemap.sitemap.Frame;
import org.openhab.core.model.sitemap.sitemap.Image;
import org.openhab.core.model.sitemap.sitemap.Input;
import org.openhab.core.model.sitemap.sitemap.LinkableWidget;
import org.openhab.core.model.sitemap.sitemap.Mapping;
import org.openhab.core.model.sitemap.sitemap.Mapview;
@ -558,6 +559,10 @@ public class SitemapResource
bean.mappings.add(mappingBean);
}
}
if (widget instanceof Input) {
Input inputWidget = (Input) widget;
bean.inputHint = inputWidget.getInputHint();
}
if (widget instanceof Slider) {
Slider sliderWidget = (Slider) widget;
bean.sendFrequency = sliderWidget.getFrequency();

View File

@ -47,6 +47,7 @@ public class WidgetDTO {
public BigDecimal minValue;
public BigDecimal maxValue;
public BigDecimal step;
public String inputHint;
public String url;
public String encoding;
public String service;

View File

@ -45,6 +45,7 @@ import org.openhab.core.model.sitemap.sitemap.impl.DefaultImpl;
import org.openhab.core.model.sitemap.sitemap.impl.FrameImpl;
import org.openhab.core.model.sitemap.sitemap.impl.GroupImpl;
import org.openhab.core.model.sitemap.sitemap.impl.ImageImpl;
import org.openhab.core.model.sitemap.sitemap.impl.InputImpl;
import org.openhab.core.model.sitemap.sitemap.impl.MappingImpl;
import org.openhab.core.model.sitemap.sitemap.impl.MapviewImpl;
import org.openhab.core.model.sitemap.sitemap.impl.SelectionImpl;
@ -235,6 +236,11 @@ public class UIComponentSitemapProvider implements SitemapProvider, RegistryChan
addWidgetMappings(selectionWidget.getMappings(), component);
widget = selectionWidget;
break;
case "Input":
InputImpl inputWidget = (InputImpl) SitemapFactory.eINSTANCE.createInput();
widget = inputWidget;
setWidgetPropertyFromComponentConfig(widget, component, "inputHint", SitemapPackage.INPUT__INPUT_HINT);
break;
case "Setpoint":
SetpointImpl setpointWidget = (SetpointImpl) SitemapFactory.eINSTANCE.createSetpoint();
widget = setpointWidget;