ModeΒΆ
-
/libs/granite/ui/components/foundation/layouts/mode Mode layout is a layout that understands
foundation-modevocabulary. It is listening tofoundation-mode-changeevent and will show the item having the same mode name as the event, while hiding the other items. The item mode name is indicated by itsmodeproperty, with fallback toitem#getName(). The group of the event will also be matched against the group set in the layout.It has the following content structure at the layout resource:
- granite:LayoutsMode
- modestringel
The mode that is active initially.
Each item is matched against this mode, where it is set to active. The item
modeproperty (fallback toitem#getName()) is used to match with this mode. If this property is not specified, the first item is active.
- groupstring
The group that this layout will be part of.
The items of the layout are specified using ItemDataSource.
Example:
+ mymode - sling:resourceType = "granite/ui/components/foundation/container" + layout - sling:resourceType = "granite/ui/components/foundation/layouts/mode" - group = "myapp-mytopic-mygroup" + items + default + selection
In above example, there are two modes configured:
defaultandselection. Since there is nomodespecified atlayoutnode, the first item (the default mode) is active. Whenfoundation-mode-changeis triggered with [mode = selection, group = myapp-mytopic-mygroup], the selection item will be shown and default item will be hidden.