use of io.jmix.ui.screen.ScreenFragment in project jmix-docs by Haulmont.
the class VisitScheduleAssistant method dashboardEventListener.
@EventListener
public void dashboardEventListener(DashboardUpdatedEvent event) {
// <4>
// <5>
ScreenFragment widget = dashboard.getWidget("visits-calendar");
if (widget instanceof VisitsCalendarWidget) {
// <6>
VisitsCalendarWidget visitsCalendarWidget = (VisitsCalendarWidget) widget;
visitsCalendarWidget.reloadSchedule();
}
}
use of io.jmix.ui.screen.ScreenFragment in project jmix by jmix-framework.
the class AbstractLookup method initLookupLayout.
@Override
public void initLookupLayout() {
Action selectAction = getAction(LOOKUP_SELECT_ACTION_ID);
if (selectAction != null && selectAction.getOwner() == null) {
Fragments fragments = UiControllerUtils.getScreenContext(this).getFragments();
ScreenFragment lookupWindowActions = fragments.create(this, "lookupWindowActions");
lookupWindowActions.getFragment().setId("lookupWindowActions");
lookupWindowActions.getFragment().setVisible(false);
getFrame().add(lookupWindowActions.getFragment());
}
Element element = ((Component.HasXmlDescriptor) getFrame()).getXmlDescriptor();
if (element != null) {
String lookupComponent = element.attributeValue("lookupComponent");
if (StringUtils.isNotEmpty(lookupComponent)) {
Component component = getFrame().getComponent(lookupComponent);
setLookupComponent(component);
}
}
Component lookupComponent = getLookupComponent();
if (lookupComponent instanceof LookupComponent.LookupSelectionChangeNotifier) {
LookupComponent.LookupSelectionChangeNotifier selectionNotifier = (LookupComponent.LookupSelectionChangeNotifier) lookupComponent;
if (selectAction != null) {
// noinspection unchecked
selectionNotifier.addLookupValueChangeListener(valueChangeEvent -> selectAction.setEnabled(!selectionNotifier.getLookupSelectedItems().isEmpty()));
selectAction.setEnabled(!selectionNotifier.getLookupSelectedItems().isEmpty());
}
}
}
use of io.jmix.ui.screen.ScreenFragment in project jmix by jmix-framework.
the class DataLoadCoordinatorImpl method configureAutomatically.
private void configureAutomatically(DataLoader loader, FrameOwner frameOwner) {
List<String> queryParameters = DataLoadersHelper.getQueryParameters(loader);
List<String> allParameters = new ArrayList<>(queryParameters);
allParameters.addAll(getConditionParameters(loader));
// add triggers on container/component events
for (String parameter : allParameters) {
if (parameter.startsWith(containerPrefix)) {
InstanceContainer container = UiControllerUtils.getScreenData(frameOwner).getContainer(parameter.substring(containerPrefix.length()));
addOnContainerItemChangedLoadTrigger(loader, container, parameter);
} else if (parameter.startsWith(componentPrefix)) {
String componentId = parameter.substring(componentPrefix.length());
Component component = frameOwner instanceof Screen ? ((Screen) frameOwner).getWindow().getComponentNN(componentId) : ((ScreenFragment) frameOwner).getFragment().getComponentNN(componentId);
LikeClause likeClause = findLikeClause(loader, parameter);
addOnComponentValueChangedLoadTrigger(loader, component, parameter, likeClause);
}
}
// if the loader has no parameters in query, add trigger on BeforeShowEvent/AttachEvent
if (queryParameters.isEmpty()) {
Class eventClass = frameOwner instanceof Screen ? Screen.BeforeShowEvent.class : ScreenFragment.AttachEvent.class;
addOnFrameOwnerEventLoadTrigger(loader, eventClass);
}
}
use of io.jmix.ui.screen.ScreenFragment in project jmix by jmix-framework.
the class EntitySuggestionFieldImpl method showSuggestions.
protected void showSuggestions(List<V> suggestions, boolean userOriginated) {
FrameOwner frameOwner = getFrame().getFrameOwner();
Collection<Screen> dialogScreens = UiControllerUtils.getScreenContext(frameOwner).getScreens().getOpenedScreens().getDialogScreens();
Screen lastDialog = null;
for (Screen dialogScreen : dialogScreens) {
lastDialog = dialogScreen;
}
if (frameOwner instanceof ScreenFragment) {
frameOwner = ComponentsHelper.getScreen((ScreenFragment) frameOwner);
}
if (lastDialog == null || Objects.equals(frameOwner, lastDialog)) {
getComponent().showSuggestions(suggestions, userOriginated);
}
}
use of io.jmix.ui.screen.ScreenFragment in project jmix by jmix-framework.
the class AbstractSuggestionField method showSuggestions.
protected void showSuggestions(List<I> suggestions, boolean userOriginated) {
FrameOwner frameOwner = getFrame().getFrameOwner();
Collection<Screen> dialogScreens = UiControllerUtils.getScreenContext(frameOwner).getScreens().getOpenedScreens().getDialogScreens();
Screen lastDialog = null;
for (Screen dialogScreen : dialogScreens) {
lastDialog = dialogScreen;
}
if (frameOwner instanceof ScreenFragment) {
frameOwner = ComponentsHelper.getScreen((ScreenFragment) frameOwner);
}
if (lastDialog == null || Objects.equals(frameOwner, lastDialog)) {
component.showSuggestions(suggestions, userOriginated);
}
}
Aggregations