use of io.jmix.dashboardsui.dashboard.event.WidgetSelectedEvent in project jmix by jmix-framework.
the class CanvasDropComponentsFactory method addLayoutClickListener.
protected void addLayoutClickListener(CanvasLayout layout) {
layout.addLayoutClickListener(e -> {
CanvasLayout selectedLayout = null;
Component clickedComponent = e.getClickedComponent();
if (clickedComponent == null) {
HasComponents source = e.getSource();
if (source instanceof ComponentContainer) {
Component parent = ((ComponentContainer) source).getParent();
if (parent instanceof CanvasLayout) {
selectedLayout = (CanvasLayout) parent;
}
}
} else {
selectedLayout = findCanvasLayout(clickedComponent);
}
if (selectedLayout != null) {
uiEventPublisher.publishEvent(new WidgetSelectedEvent(selectedLayout.getUuid(), WidgetSelectedEvent.Target.CANVAS));
}
});
}
use of io.jmix.dashboardsui.dashboard.event.WidgetSelectedEvent in project jmix by jmix-framework.
the class DropLayoutTools method reorderWidgetsAndPushEvents.
private void reorderWidgetsAndPushEvents(DashboardLayout layout, DashboardLayout targetLayout, WidgetDropLocation location) {
DashboardLayout parentLayout = targetLayout instanceof WidgetLayout ? findParentLayout(getDashboard().getVisualModel(), targetLayout) : targetLayout;
boolean added = addChild(parentLayout, layout);
if (!added && parentLayout instanceof GridLayout) {
showDropOnGridLayoutNotAllowedNotification();
return;
}
layout.setParent(parentLayout);
moveComponent(layout, targetLayout.getId(), location);
uiEventPublisher.publishEvent(new DashboardRefreshEvent(getDashboard().getVisualModel()));
uiEventPublisher.publishEvent(new WidgetSelectedEvent(layout.getId(), WidgetSelectedEvent.Target.CANVAS));
}
Aggregations