masquerade
masquerade copied to clipboard
Add component SideMenu
see forum topic https://www.cuba-platform.com/discuss/t/masquerade-appmenu-openitem/10518
Solution
New component SideMenu is introduced.
The collapsible SideMenu supports the following conditions:
Conditions#EXPANDED- checks that component is expanded;Conditions#COLLAPSED- checks that component is collapsed.
The SideMenu component has the following methods:
openItem(Class<T> screenClass, String... path)- opens side menu item matching the given screenClass and path;
$c(SideMenu).openItem(UserBrowser, 'administration', 'sec$User.browse')
openItem(Menu<T> menu)- opens side menu item matching the given Menu;
$c(SideMenu).openItem(new AppMenu.Menu<>(UserBrowser, 'administration', 'sec$User.browse'))
openItem(String... path)- opens side menu item matching the given path;
$c(SideMenu).openItem('administration', 'sec$User.browse')
expand()- expands side menu;collapse()- collapses side menu.
Usage example
public static final SideMenu.Menu<ReportBrowser> REPORT_BROWSE =
new SideMenu.Menu<ReportBrowser>(ReportBrowser, 'reports', 'report$Report.browse')
@Test
void testCollapseSideMenu() {
$c(SideMenu).openItem(REPORT_BROWSE)
.collapse()
.shouldBe(Conditions.COLLAPSED)
}
@Test
void testExpandSideMenu() {
$c(SideMenu).openItem(REPORT_BROWSE)
.expand()
.shouldBe(Conditions.EXPANDED)
}