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

Sitezmap: new Buttongrid element #2176

Merged
merged 2 commits into from
Dec 16, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added ui/images/sitemap_demo_buttongrid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions ui/sitemaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ The following element types may be used in a Sitemap definition file.

| Element | Description |
| ---------------------------------------- | ----------------------------------------------------------------------------------------- |
| [Buttongrid](#element-type-buttongrid) | Renders a grid of stateless buttons used to send commands to a given Item. |
| [Chart](#element-type-chart) | Adds a time-series chart object for [persisted](persistence.html) data. |
| [Colorpicker](#element-type-colorpicker) | Allows the user to choose a color from a color wheel. |
| [Default](#element-type-default) | Renders an Item in the default UI representation specified by the type of the given Item. |
Expand Down Expand Up @@ -301,6 +302,43 @@ Switch item=LR_TV_Channel label="TV Channel" mappings=[0="DasErste", 1="BBC One"
![Presentation of the On/Off Switch element in BasicUI](images/sitemap_demo_switch1.png)
![Presentation of the multi-state Switch element in BasicUI](images/sitemap_demo_switch2.png)

### Element Type 'Buttongrid'

```java
Buttongrid item=<itemname> [label="<labelname>"] [icon=<iconref>] [staticIcon=<iconref>] [buttons="<Button definition>"]
```

A Buttongrid represents a grid of buttons and enables commands to be sent to an Item.
When a button is pressed, the associated command is sent to the linked Item.
Buttons never appear as selected, they do not display the current state of the linked Item.

This is a typical element for simulating a remote control, for example.

- `label` if set, a header row will be displayed containing this label and the icon.
- `buttons` defines the position of each button within the grid and the command associated with each button; provided as an array.

Buttons syntax:

```java
buttons=[row_1:column_1:command_1="description_1", row_2:column_2:command_2="description_2"=<iconname>, ...]
```

The buttons can be defined in any order, their position in the grid is defined by a row index and a column index.
The top left position is row index 1 and column index 1.
The grid must not exceed 12 columns so the maximum allowed column index is 12 columns.
It is not mandatory to define a button in all grid cells.
The user interfaces will automatically determine the grid size so that all buttons are presented.

The content of each button can be text but also an icon; the icon will be used by default if provided.

**Examples:**

```java
Buttongrid label="Remote Control" staticIcon=screen item=RemoteControl buttons=[1:1:POWER="Power"=switch-off , 1:2:MENU="Menu" , 1:3:EXIT="Exit" , 2:2:UP="Up"=f7:arrowtriangle_up , 4:2:DOWN="Down"=f7:arrowtriangle_down , 3:1:LEFT="Left"=f7:arrowtriangle_left , 3:3:RIGHT="Right"=f7:arrowtriangle_right , 3:2:OK="Ok" , 2:4:VOL_PLUS="Volume +" , 4:4:VOL_MINUS="Volume -" , 3:4:MUTE="Mute"=soundvolume_mute]
```

![Presentation of the Buttongrid element in BasicUI](images/sitemap_demo_buttongrid.png)

### Element Type 'Selection'

```java
Expand Down