Skip to content

Commit eb1b836

Browse files
authored
[sitemap] New parameter staticIcon (#2153)
* [sitemap] New parameter staticIcon Related to openhab/openhab-core#3735 Signed-off-by: Laurent Garnier <lg.hc@free.fr> * Review comment: choosing the icon Signed-off-by: Laurent Garnier <lg.hc@free.fr> --------- Signed-off-by: Laurent Garnier <lg.hc@free.fr>
1 parent b76f5e7 commit eb1b836

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

ui/sitemaps.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ sitemap demo label="My home automation" {
3838
Switch item=Lights icon="light"
3939
Text item=LR_Temperature label="Livingroom [%.1f °C]"
4040
Group item=Heating
41-
Text item=LR_Multimedia_Summary label="Multimedia [%s]" icon="video" {
41+
Text item=LR_Multimedia_Summary label="Multimedia [%s]" staticIcon="video" {
4242
Selection item=LR_TV_Channel mappings=[0="off", 1="DasErste", 2="BBC One", 3="Cartoon Network"]
4343
Slider item=LR_TV_Volume
4444
}
@@ -82,7 +82,7 @@ Frame label="Demo" {
8282
Switch item=Lights icon="light"
8383
Text item=LR_Temperature label="Livingroom [%.1f °C]"
8484
Group item=Heating
85-
Text item=LR_Multimedia_Summary label="Multimedia [%s]" icon="video" {
85+
Text item=LR_Multimedia_Summary label="Multimedia [%s]" staticIcon="video" {
8686
Selection item=LR_TV_Channel mappings=[0="off", 1="DasErste", 2="BBC One", 3="Cartoon Network"]
8787
Slider item=LR_TV_Volume
8888
}
@@ -99,7 +99,7 @@ Different elements can be used on the previous or next hierarchy level.
9999
When using code blocks behind other element types such as `Text` or `Group`, these UI elements will, in addition to their normal function, be links to a new view, presenting the nested elements.
100100

101101
```java
102-
Text item=LR_Multimedia_Summary label="Multimedia [%s]" icon="video" {
102+
Text item=LR_Multimedia_Summary label="Multimedia [%s]" staticIcon="video" {
103103
Selection item=LR_TV_Channel mappings=[0="off", 1="DasErste", 2="BBC One", 3="Cartoon Network"]
104104
Slider item=LR_TV_Volume
105105
}
@@ -176,11 +176,13 @@ This provides the flexibility to present Items in the way desired in your home a
176176
- Common parameters, also known from [items definition]({{base}}/configuration/items.html#item-syntax):
177177
- `item` defines the name of the Item you want to present (e.g. `Temperature`), [more details]({{base}}/configuration/items.html#item-name).
178178
- `label` sets the textual description displayed next to the preprocessed Item data (e.g. "`Now [%s °C]`"), [more details]({{base}}/configuration/items.html#item-label).
179-
- `icon` chooses the name of the icon file to show next to the element, [more details]({{base}}/configuration/items.html#icons).
179+
- `icon` chooses the icon to show next to the element, [more details]({{base}}/configuration/items.html#icons).
180180

181181
- When an [Item]({{base}}/configuration/items.html) is defined, you have the opportunity to assign a label and/or an icon at that point.
182182
If no label or icon are specified in the Sitemap, then the label and/or icon you assigned to the Item will be displayed.
183-
Setting a value for `label` or `icon` of a Sitemap element will override the values defined for the linked Item.
183+
Setting a value for `label` or `icon` or `staticIcon` of a Sitemap element will override the values defined for the linked Item.
184+
185+
- The parameters `icon` and `staticIcon` are exclusive; both allow choosing the icon to show next to the element but `staticIcon` also indicates not to try to create a dynamic icon (using the current state of a linked item). The value of these two parameters can optionally be enclosed in double quotes.
184186

185187
It has to be considered that if the label defined in a Channel or an Item contains text and state, these representations have to be overwritten separately in the Sitemap.
186188
In the following example an Item which has a label and state defined is overwritten.
@@ -207,7 +209,7 @@ UoM = [Units of Measurement]({{base}}/concepts/units-of-measurement.html)
207209
### Element Type 'Frame'
208210

209211
```java
210-
Frame [label="<labelname>"] [icon="<icon>"] {
212+
Frame [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>] {
211213
[additional sitemap elements]
212214
}
213215
```
@@ -228,7 +230,7 @@ Frame label="Demo" {
228230
### Element Type 'Default'
229231

230232
```java
231-
Default item=<itemname> [label="<labelname>"] [icon="<iconname>"]
233+
Default item=<itemname> [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>]
232234
```
233235

234236
Presents an Item using the default UI representation specified by the type of the given Item.
@@ -237,7 +239,7 @@ E.g., a `Dimmer` Item will be represented as a [Slider](#element-type-slider) el
237239
### Element Type 'Text'
238240

239241
```java
240-
Text [item=<itemname>] [label="<labelname>"] [icon="<iconname>"]
242+
Text [item=<itemname>] [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>]
241243
```
242244

243245
Presents data as normal text.
@@ -247,15 +249,15 @@ Please refer to the documentation on [item State Presentation]({{base}}/configur
247249
**Example:**
248250

249251
```java
250-
Text item=Temperature label="Livingroom [%.1f °C]" icon="temperature"
252+
Text item=Temperature label="Livingroom [%.1f °C]" staticIcon=temperature
251253
```
252254

253255
![Presentation of the Text element in BasicUI](images/sitemap_demo_text.png)
254256

255257
### Element Type 'Group'
256258

257259
```java
258-
Group item=<itemname> [label="<labelname>"] [icon="<iconname>"]
260+
Group item=<itemname> [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>]
259261
```
260262

261263
Clicking on a Group element will reveal a new view showing all group items using the [Default](#element-type-default) element type.
@@ -279,7 +281,7 @@ Group item=gTemperature label="Room Temperatures [%.1f °C]"
279281
### Element Type 'Switch'
280282

281283
```java
282-
Switch item=<itemname> [label="<labelname>"] [icon="<iconname>"] [mappings="<mapping definition>"]
284+
Switch item=<itemname> [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>] [mappings="<mapping definition>"]
283285
```
284286

285287
Switches are one of the more common elements of a typical Sitemap.
@@ -292,7 +294,7 @@ Note that Switch elements can be rendered differently on the user interface, bas
292294
**Examples:**
293295

294296
```java
295-
Switch item=LR_CeilingLight label="Ceiling Light" icon="light"
297+
Switch item=LR_CeilingLight label="Ceiling Light" icon=light
296298
Switch item=LR_TV_Channel label="TV Channel" mappings=[0="DasErste", 1="BBC One", 2="Cartoon Network"]
297299
```
298300

@@ -302,7 +304,7 @@ Switch item=LR_TV_Channel label="TV Channel" mappings=[0="DasErste", 1="BBC One"
302304
### Element Type 'Selection'
303305

304306
```java
305-
Selection item=<itemname> [label="<labelname>"] [icon="<iconname>"] [mappings="<mapping definition>"]
307+
Selection item=<itemname> [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>] [mappings="<mapping definition>"]
306308
```
307309

308310
The Selection element type renders the options as a dropdown menu or as a modal dialog prompt, depending on the user interface.
@@ -321,7 +323,7 @@ Selection item=LR_TV_Channel label="TV Channel" mappings=[0="DasErste", 1="BBC O
321323
### Element Type 'Setpoint'
322324

323325
```java
324-
Setpoint item=<itemname> [label="<labelname>"] [icon="<iconname>"] minValue=<min value> maxValue=<max value> step=<step value>
326+
Setpoint item=<itemname> [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>] minValue=<min value> maxValue=<max value> step=<step value>
325327
```
326328

327329
- `minValue` (defaults to 0) and `maxValue` (defaults to 100) limit the possible range of the value (both included in the range).
@@ -338,7 +340,7 @@ Setpoint item=KI_Temperature label="Kitchen [%.1f °C]" minValue=4.5 maxValue=30
338340
### Element Type 'Slider'
339341

340342
```java
341-
Slider item=<itemname> [label="<labelname>"] [icon="<iconname>"] [sendFrequency="frequency"] [switchSupport] [minValue=<min value>] [maxValue=<max value>] [step=<step value>]
343+
Slider item=<itemname> [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>] [sendFrequency="frequency"] [switchSupport] [minValue=<min value>] [maxValue=<max value>] [step=<step value>]
342344
```
343345

344346
This type presents a value as a user-adjustable control which slides from left (0) to right (100).
@@ -364,7 +366,7 @@ Slider item=KI_Temperature label="Kitchen"
364366
### Element Type 'Colorpicker'
365367

366368
```java
367-
Colorpicker item=<itemname> [label="<labelname>"] [icon="<iconname>"] [sendFrequency=<sendFrequency>]
369+
Colorpicker item=<itemname> [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>] [sendFrequency=<sendFrequency>]
368370
```
369371

370372
This element is a combined control for something like a rgb or rgbw light where you can adjust brightness as well es the color hue.
@@ -377,15 +379,15 @@ The middle button opens an overlay to finetune your color. A color wheel let you
377379
**Example:**
378380

379381
```java
380-
Colorpicker item=LR_LEDLight_Color label="LED Light Color" icon="colorwheel"
382+
Colorpicker item=LR_LEDLight_Color label="LED Light Color" staticIcon=colorwheel
381383
```
382384

383385
![Presentation of the Colorpicker element in BasicUI](images/sitemap_demo_colorpicker.png)
384386

385387
### Element Type 'Input'
386388

387389
```java
388-
Input item=<itemname> [label="<labelname>"] [icon="<iconname>"] [inputHint="<inputHint>"]
390+
Input item=<itemname> [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>] [inputHint="<inputHint>"]
389391
```
390392

391393
This element allows entering of text, numbers and dates/times and updating the underlying items.
@@ -401,15 +403,15 @@ Note that this element type may not be supported on all user interfaces that sup
401403
**Example:**
402404

403405
```java
404-
Input item=Meter_Reading label="Meter [%.0f %unit%]" icon="energy" inputHint="number"
406+
Input item=Meter_Reading label="Meter [%.0f %unit%]" staticIcon=energy inputHint="number"
405407
```
406408

407409
![Presentation of the Input element in BasicUI](images/sitemap_demo_input.png)
408410

409411
### Element Type 'Webview'
410412

411413
```java
412-
Webview item=<itemname> [label="<labelname>"] [icon="<iconname>"] url="<url>" [height=<heightvalue>]
414+
Webview item=<itemname> [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>] url="<url>" [height=<heightvalue>]
413415
```
414416

415417
The content of a webpage will be presented live on your user interface next to other Sitemap elements.
@@ -428,7 +430,7 @@ Webview url="https://www.openhab.org" height=5
428430
### Element Type 'Mapview'
429431

430432
```java
431-
Mapview [item=<itemname>] [label="<labelname>"] [icon="<iconname>"] [height=<heightvalue>]
433+
Mapview [item=<itemname>] [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>] [height=<heightvalue>]
432434
```
433435

434436
Displays an [OSM](https://www.openstreetmap.org) map based on a given Location Item.
@@ -446,7 +448,7 @@ Mapview item=Demo_Location height=5
446448
### Element Type 'Image'
447449

448450
```java
449-
Image [item=<itemname>] [icon="<iconname>"] url="<url of image>" [label="<labelname>"] [refresh=xxxx]
451+
Image [item=<itemname>] [icon=<iconref>] [staticIcon=<iconref>] url="<url of image>" [label="<labelname>"] [refresh=xxxx]
450452
```
451453

452454
This element type is able to present an image.
@@ -471,7 +473,7 @@ Image url="https://192.168.1.203:8080/?action=snapshot" refresh=10000
471473
### Element Type 'Video'
472474

473475
```java
474-
Video [item=<itemname>] [icon="<iconname>"] url="<url of video to embed>" [encoding="<video encoding>"]
476+
Video [item=<itemname>] [icon=<iconref>] [staticIcon=<iconref>] url="<url of video to embed>" [encoding="<video encoding>"]
475477
```
476478

477479
Allows you to display a video as part of your Sitemap.
@@ -496,7 +498,7 @@ Video url="https://demo.openhab.org/Hue.m4v"
496498
### Element Type 'Chart'
497499

498500
```java
499-
Chart item=<itemname> [icon="<iconname>"] [label="<labelname>"] [refresh=xxxx]
501+
Chart item=<itemname> [icon=<iconref>] [staticIcon=<iconref>] [label="<labelname>"] [refresh=xxxx]
500502
period=xxxx [service="<service>"] [legend=true/false] [forceasitem=true/false] [yAxisDecimalPattern=xxxx]
501503
```
502504

@@ -721,7 +723,7 @@ sitemap demo label="My home automation" {
721723
Switch item=Lights icon="light"
722724
Text item=LR_Temperature label="Livingroom [%.1f °C]"
723725
Group item=Heating
724-
Text item=LR_Multimedia_Summary label="Multimedia [%s]" icon="video" {
726+
Text item=LR_Multimedia_Summary label="Multimedia [%s]" staticIcon="video" {
725727
Selection item=LR_TV_Channel mappings=[0="off", 1="DasErste", 2="BBC One", 3="Cartoon Network"]
726728
Slider item=LR_TV_Volume
727729
}

0 commit comments

Comments
 (0)