Skip to content

Commit

Permalink
Add Input widget to main UI sitemap configuration and REST API (openh…
Browse files Browse the repository at this point in the history
…ab#3431)

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

Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
GitOrigin-RevId: 44a146f
  • Loading branch information
mherwege authored and splatch committed Jul 12, 2023
1 parent 51db37e commit e44b96f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
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;
Expand Down Expand Up @@ -558,6 +559,10 @@ private PageDTO createPageBean(String sitemapName, @Nullable String title, @Null
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
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;
Expand Down Expand Up @@ -235,6 +236,11 @@ protected Sitemap buildSitemap(RootUIComponent rootComponent) {
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;
Expand Down

0 comments on commit e44b96f

Please sign in to comment.