use of com.haulmont.cuba.gui.screen.Screen in project cuba by cuba-platform.
the class WebSuggestionPickerField 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 com.haulmont.cuba.gui.screen.Screen in project cuba by cuba-platform.
the class WebUserActionsButton method openSettings.
protected void openSettings() {
Screen settingsScreen = AppUI.getCurrent().getScreens().create("settings", OpenMode.NEW_TAB);
settingsScreen.show();
}
use of com.haulmont.cuba.gui.screen.Screen in project cuba by cuba-platform.
the class WebUserActionsButton method defaultLogin.
protected void defaultLogin() {
AppUI ui = ((AppUI) component.getUI());
if (ui == null) {
throw new IllegalStateException("Logout button is not attached to UI");
}
String loginScreenId = beanLocator.get(Configuration.class).getConfig(WebConfig.class).getLoginScreenId();
Screen loginScreen = ui.getScreens().create(loginScreenId, OpenMode.ROOT);
loginScreen.show();
}
use of com.haulmont.cuba.gui.screen.Screen in project cuba by cuba-platform.
the class WebDataLoadCoordinator 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 com.haulmont.cuba.gui.screen.Screen in project cuba by cuba-platform.
the class WebScreens method openLookup.
@SuppressWarnings({ "deprecation", "IncorrectCreateGuiComponent", "unchecked" })
@Override
public Window.Lookup openLookup(WindowInfo windowInfo, Window.Lookup.Handler handler, OpenType openType) {
Map<String, Object> params = createParametersMap(windowInfo, Collections.emptyMap());
MapScreenOptions options = new MapScreenOptions(params);
Screen screen = createScreen(windowInfo, openType.getOpenMode(), options);
applyOpenTypeParameters(screen.getWindow(), openType);
((LookupScreen) screen).setSelectHandler(new SelectHandlerAdapter(handler));
show(screen);
return screen instanceof Window.Lookup ? (Window.Lookup) screen : new ScreenLookupWrapper(screen);
}
Aggregations