* Extend sitemap syntax for switch to support press & release buttons
Mappings attribute for switch element now accepts one or two commands for each button.
If only one command is provided, the button is a click button, the command is sent to the item when the button is clicked.
If two commands are provided (separated by ":"), the button is a press & release button, the first command is sent to the item when the button is pressed and the second when the button is released.
Syntax example for a click button: Switch item=DemoSwitch mappings=[ ON="ON" ]
Syntax example for a press & release button: Switch item=DemoSwitch mappings=[ ON:OFF="ON" ]
Related to #3822
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* update reference to method / parameter names from documentation
* reflect that subscriptions for a whole page are possible in the documentation
* document that subscriptions to a whole sitemap are possible but discouraged
Signed-off-by: Tassilo Karge <tassilo.karge@web.de>
A static inner class does not keep an implicit reference to its enclosing instance.
This prevents a common cause of memory leaks and uses less memory per instance of the class.
Signed-off-by: Wouter Born <github@maindrain.net>
* [sitemap] Provide information about widget label source to clients
The label can be populated from a label specified on the respective
sitemap widget, or (if no label was specified) from the label of the
backing item. Allow clients to differentiate between both cases.
Related to openhab/openhab-webui#2065
Signed-off-by: Danny Baumann <dannybaumann@web.de>
This allows dynamic icons based on items states even with non OH icon sources.
This also allows overwritting the default handling with state done by the icon servlet.
Example: icon=[item1>0=temperature,==0=material:settings,f7:house]
Related to openhab/openhab-webui#1938
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Simplifies the code by using List.of, List.copyOf etc. where possible which results in less code and imports.
Signed-off-by: Wouter Born <github@maindrain.net>
Concerns labelcolor, valuecolor and visibility
Also fix wrong positions of ")" in Sitemap.xtext
Closes#3058
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* [Sitemap] Accept an optional icon for each value/label mapping
When set by the user, the icon can be used by UIs for switch element with mappings to render a button with the icon rather than the label.
Related to #3441
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
When set, the UI should not provide the item state when requestiong the
OH icon and should not request again the icon when the item state is
updated.
Related to openhab/openhab-android#3404
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* Improve threading in EventHandler
* refactor pagechangelistener to event
* One executor per subscriber type, not per subscriber
Signed-off-by: Jan N. Klug <github@klug.nrw>
* add input widget to UI SitemapProviderImpl
* inputHint in UIComponentSitemapProvider
* add input element to REST
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Related to openhab/openhab-webui#1755
Related to openhab/openhab-android#3285
This sitemap widget is not documented.
It is not implemented neither in Android app nor iOS app.
It was implemented in BasicUI but was buggy.
Support in BasicUI has been removed.
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* iconcolor attribute added to all sitemap elements
This attribute was already available in syntax for the Image element but
was probably not used by any UI.
It is now available for any sitemap element and allows defining a color
for the widget icon based on conditional statements on the item value.
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* Add more null annotations
* Fix mock name
Adds null annotations to most of the tests as well as a few other classes.
Also fixes a few other SAT findings.
Fixes ~300 SAT findings in total.
Signed-off-by: Wouter Born <github@maindrain.net>