use of com.haulmont.cuba.gui.config.WindowInfo in project cuba by cuba-platform.
the class ShowInfoAction method showInfo.
public void showInfo(Entity entity, MetaClass metaClass, Component.BelongToFrame component) {
WindowManager wm = (WindowManager) ComponentsHelper.getScreenContext(component).getScreens();
WindowInfo windowInfo = AppBeans.get(WindowConfig.class).getWindowInfo("sysInfoWindow");
wm.openWindow(windowInfo, OpenType.DIALOG, ParamsMap.of("metaClass", metaClass, "item", entity));
}
use of com.haulmont.cuba.gui.config.WindowInfo in project cuba by cuba-platform.
the class FragmentHelper method createFakeWindowInfo.
@SuppressWarnings("unchecked")
public WindowInfo createFakeWindowInfo(String src, String fragmentId) {
Element screenElement = DocumentHelper.createElement("screen");
screenElement.addAttribute("template", src);
screenElement.addAttribute("id", fragmentId);
Element windowElement = screenXmlLoader.load(src, fragmentId, Collections.emptyMap());
Class<? extends ScreenFragment> fragmentClass;
String className = windowElement.attributeValue("class");
if (StringUtils.isNotEmpty(className)) {
fragmentClass = (Class<? extends ScreenFragment>) scripting.loadClassNN(className);
} else {
fragmentClass = AbstractFrame.class;
}
return new WindowInfo(fragmentId, new WindowAttributesProvider() {
@Override
public WindowInfo.Type getType(WindowInfo wi) {
return WindowInfo.Type.FRAGMENT;
}
@Override
public String getTemplate(WindowInfo wi) {
return src;
}
@Nonnull
@Override
public Class<? extends FrameOwner> getControllerClass(WindowInfo wi) {
return fragmentClass;
}
@Override
public WindowInfo resolve(WindowInfo windowInfo) {
return windowInfo;
}
}, screenElement);
}
use of com.haulmont.cuba.gui.config.WindowInfo in project cuba by cuba-platform.
the class ScreensHelper method getDefaultBrowseScreen.
@Nullable
public WindowInfo getDefaultBrowseScreen(MetaClass metaClass) {
WindowInfo browseWindow = windowConfig.findWindowInfo(windowConfig.getBrowseScreenId(metaClass));
if (browseWindow != null && userSessionSource.getUserSession().isScreenPermitted(browseWindow.getId())) {
return browseWindow;
}
WindowInfo lookupWindow = windowConfig.findWindowInfo(windowConfig.getLookupScreenId(metaClass));
if (lookupWindow != null && userSessionSource.getUserSession().isScreenPermitted(lookupWindow.getId())) {
return lookupWindow;
}
return null;
}
use of com.haulmont.cuba.gui.config.WindowInfo in project cuba by cuba-platform.
the class FoldersBean method openFolder.
@Override
public void openFolder(AbstractSearchFolder folder) {
if (StringUtils.isBlank(folder.getFilterComponentId())) {
log.warn("Unable to open folder: componentId is blank");
return;
}
String[] strings = ValuePathHelper.parse(folder.getFilterComponentId());
String screenId = strings[0];
WindowInfo windowInfo = windowConfig.getWindowInfo(screenId);
Map<String, Object> params = new HashMap<>();
WindowParams.DISABLE_AUTO_REFRESH.set(params, true);
WindowParams.DISABLE_RESUME_SUSPENDED.set(params, true);
if (!StringUtils.isBlank(folder.getTabName())) {
WindowParams.DESCRIPTION.set(params, messages.getMainMessage(folder.getTabName()));
} else {
WindowParams.DESCRIPTION.set(params, messages.getMainMessage(folder.getName()));
}
WindowParams.FOLDER_ID.set(params, folder.getId());
WindowManager wm = App.getInstance().getWindowManager();
Window window = wm.openWindow(windowInfo, OpenType.NEW_TAB, params);
Filter filterComponent = null;
if (strings.length > 1) {
String filterComponentId = StringUtils.join(Arrays.copyOfRange(strings, 1, strings.length), '.');
filterComponent = (Filter) window.getComponentNN(filterComponentId);
FilterEntity filterEntity = metadata.create(FilterEntity.class);
filterEntity.setFolder(folder);
filterEntity.setComponentId(folder.getFilterComponentId());
filterEntity.setName(folder.getLocName());
filterEntity.setXml(folder.getFilterXml());
filterEntity.setApplyDefault(BooleanUtils.isNotFalse(folder.getApplyDefault()));
if (folder instanceof SearchFolder) {
filterEntity.setIsSet(((SearchFolder) folder).getIsSet());
}
filterComponent.setFilterEntity(filterEntity);
filterComponent.switchFilterMode(FilterDelegate.FilterMode.GENERIC_MODE);
}
if (filterComponent != null && folder instanceof SearchFolder) {
SearchFolder searchFolder = (SearchFolder) folder;
if (searchFolder.getPresentation() != null) {
((HasPresentations) filterComponent.getApplyTo()).applyPresentation(searchFolder.getPresentation().getId());
}
}
if (window.getFrameOwner() instanceof LegacyFrame) {
DsContext dsContext = ((LegacyFrame) window.getFrameOwner()).getDsContext();
if (dsContext != null) {
((DsContextImplementation) dsContext).resumeSuspended();
}
}
}
use of com.haulmont.cuba.gui.config.WindowInfo in project cuba by cuba-platform.
the class MainScreen method openSettingsScreen.
protected void openSettingsScreen() {
WindowInfo settingsInfo = getBeanLocator().get(WindowConfig.class).getWindowInfo("settings");
MapScreenOptions screenOptions = new MapScreenOptions(loadSettingsScreenParams(settingsInfo));
UiControllerUtils.getScreenContext(this).getScreens().create(settingsInfo.getId(), OpenMode.NEW_TAB, screenOptions).show();
}
Aggregations