use of io.jmix.ui.app.core.dev.LayoutAnalyzerScreen in project jmix by jmix-framework.
the class LayoutAnalyzerContextMenuProvider method initContextMenu.
public void initContextMenu(Screen screen, io.jmix.ui.component.Component contextMenuTarget) {
if (screenProperties.isLayoutAnalyzerEnabled()) {
ContextMenu contextMenu = new ContextMenu(contextMenuTarget.unwrap(AbstractComponent.class), true);
MenuBar.MenuItem menuItem = contextMenu.addItem(messages.getMessage("actions.analyzeLayout"), c -> {
LayoutAnalyzer analyzer = new LayoutAnalyzer();
List<LayoutTip> tipsList = analyzer.analyze(screen);
if (tipsList.isEmpty()) {
Notifications notifications = UiControllerUtils.getScreenContext(screen).getNotifications();
notifications.create(Notifications.NotificationType.HUMANIZED).withCaption("No layout problems found").show();
} else {
Screens screens = UiControllerUtils.getScreenContext(screen).getScreens();
LayoutAnalyzerScreen layoutAnalyzerScreen = screens.create(LayoutAnalyzerScreen.class, OpenMode.DIALOG);
layoutAnalyzerScreen.setLayoutTips(tipsList);
layoutAnalyzerScreen.show();
}
});
menuItem.setStyleName("jmix-cm-item");
}
}
use of io.jmix.ui.app.core.dev.LayoutAnalyzerScreen in project jmix by jmix-framework.
the class MainTabSheetActionHandler method analyzeLayout.
protected void analyzeLayout(Object target) {
Screen screen = findScreen((Layout) target);
if (screen == null) {
return;
}
LayoutAnalyzer analyzer = new LayoutAnalyzer();
List<LayoutTip> layoutTips = analyzer.analyze(screen);
ScreenContext screenContext = UiControllerUtils.getScreenContext(screen);
if (layoutTips.isEmpty()) {
Notifications notifications = screenContext.getNotifications();
notifications.create(NotificationType.HUMANIZED).withCaption("No layout problems found").show();
} else {
Screens screens = screenContext.getScreens();
LayoutAnalyzerScreen analyzerScreen = screens.create(LayoutAnalyzerScreen.class, OpenMode.DIALOG);
analyzerScreen.setLayoutTips(layoutTips);
analyzerScreen.show();
}
}
Aggregations