Comments (7)
Here is a new approach, specific to UI, without the need of any new setting, using CSS flex-wrap: wrap
:
Looks not so bad. I will try to better control the width of the zone for buttons.
from openhab-core.
similar to what we have now with the buttongrid sitemap element
What should be the difference between switch and buttongrid then?
When using a switch element with buttons rendering, the place is very limited to render all buttons in particular on a phone and it could result in label largely or even fully truncated at the left of the widget.
IMO this issue should be resolved in a different way. When having a parameter buttonsPerLine
it can be optimized for phone or desktop, but not for both at the same time. One has two write two Sitemaps then.
I suggest that Basic UI limits the number of switches that are shown in one line depending on the screen width. Then it's "zero config" for the user and optimized on every device. The Android app does that as well.
I personally think using icons might be a better way than long labels, but that depends on the Item of course.
from openhab-core.
similar to what we have now with the buttongrid sitemap element
What should be the difference between switch and buttongrid then?
Switch is stateful, buttongrid is not ; switch defines no precise position of buttons in the grid while buttongrid does it.
When using a switch element with buttons rendering, the place is very limited to render all buttons in particular on a phone and it could result in label largely or even fully truncated at the left of the widget.
IMO this issue should be resolved in a different way. When having a parameter
buttonsPerLine
it can be optimized for phone or desktop, but not for both at the same time. One has two write two Sitemaps then. I suggest that Basic UI limits the number of switches that are shown in one line depending on the screen width. Then it's "zero config" for the user and optimized on every device. The Android app does that as well.
I can't compute easily the final size of all these buttons. For example, the width of each button depends on the label in the button, even if a max size if defined.
My intention is clear: I would like to display all buttons, even if we have 16 command/state options for example. It requires to introduce a display of buttons on multiple lines because it is not possible to render such a number of buttons on a unique line. If we introduce no new setting, I could then decide for example that 4 buttons is the trigger to switch to a multiple lines rendering with 4 buttons per line. I have to check how is the current rendering in the wrong conditions with 3 buttons (large texts). In case all buttons have an icon, the threshold could be increased, maybe 6 or 8 (to be checked). In my example of 16 command/state options, this will lead to 4 lines of 4 buttons.
My proposal with the new setting was to keep the current behaviour by default and also provide to the user a way to define how many buttons he would like on each line (if he knows that labels are long, he could prefer to have one or two buttons per line).
from openhab-core.
Here is what I mean (not finished / fully adjusted but this is to show the principle):
But I will check if another approach is possible; that is multiple lines but without a fixed number of buttons per line, each new button would be added with its own size and we go to a new line only when there is no place for the next button.
from openhab-core.
If you also have to show the current value at left of the buttons, you have even less place for everything !
Maybe when we have the current value to display, we could immediately put buttons on the next line, this will keep place for the current value on the first line.
from openhab-core.
I close this request, I have implemented something in Basic UI: openhab/openhab-webui#2341
from openhab-core.
Closing it
from openhab-core.
Related Issues (20)
- [persistence] forecast strategy not working for states added by REST API HOT 2
- Expire to apply also to items with no events HOT 7
- Different strings passed to JS state transform depending on UI where Number:Time Item is being rendered HOT 19
- ColorUtils.hsbToXy() has errors when B part is small HOT 2
- [Rfc] Addon finder for 'Always Suggest' HOT 17
- [Rfc] Rewrite ColorUtil based on java.awt.color HOT 1
- On first-time start values from i18n.config ignored HOT 9
- json addon (smarthome/j echo binding) not being reinstalled after openhab update HOT 6
- Replace deprecated `hamcrest-library` with `hamcrest` in test BOM HOT 4
- ColorUtil bugs and improvements HOT 1
- NPE in Upgrade Tool HOT 1
- REST endpoint to get Jetty‘s TLS certificate HOT 1
- ECMAScript: Quantity can't be multiplied with negative value HOT 2
- Binding ID in JarFileAddonService vs. KarafAddonService HOT 4
- New version 3.0.0 of JUPnP library is breaking at least Sonos binding when several interfaces are up HOT 61
- sendNotification not working inside DSL script in a rule HOT 1
- Units of Measurement (UoM) missing: g/m² and Wh/m² (for solar panels monitoring) HOT 1
- Cannot retrieve config description with REST API HOT 3
- Inconsistent karaf output for `addons services`
- REST endpoint GET `/rest/items/<itemname>` broken HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openhab-core.