use of com.haulmont.cuba.gui.config.WindowConfig in project cuba by cuba-platform.
the class AddAction method getWindowId.
/**
* @return lookup screen id
*/
public String getWindowId() {
if (windowId != null) {
return windowId;
} else {
WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
MetaClass metaClass = target.getDatasource().getMetaClass();
return windowConfig.getAvailableLookupScreenId(metaClass);
}
}
use of com.haulmont.cuba.gui.config.WindowConfig in project cuba by cuba-platform.
the class CreateAction method getWindowId.
/**
* @return editor screen identifier
*/
public String getWindowId() {
if (windowId != null) {
return windowId;
} else {
MetaClass metaClass = target.getDatasource().getMetaClass();
WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
return windowConfig.getEditorScreenId(metaClass);
}
}
use of com.haulmont.cuba.gui.config.WindowConfig in project cuba by cuba-platform.
the class EditAction method getWindowId.
/**
* @return editor screen identifier
*/
public String getWindowId() {
if (windowId != null) {
return windowId;
} else {
MetaClass metaClass = target.getDatasource().getMetaClass();
WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
return windowConfig.getEditorScreenId(metaClass);
}
}
use of com.haulmont.cuba.gui.config.WindowConfig in project cuba by cuba-platform.
the class App method afterLoggedIn.
/**
* Perform actions after success login
*/
protected void afterLoggedIn() {
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
User user = sessionSource.getUserSession().getUser();
// Change password on logon
if (Boolean.TRUE.equals(user.getChangePasswordAtNextLogon())) {
mainFrame.deactivate("");
final DesktopWindowManager wm = mainFrame.getWindowManager();
for (Window window : wm.getOpenWindows()) {
window.setEnabled(false);
}
WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
WindowInfo changePasswordDialog = windowConfig.getWindowInfo("sec$User.changePassword");
Window changePasswordWindow = wm.openWindow(changePasswordDialog, OpenType.DIALOG.closeable(false), ParamsMap.of("cancelEnabled", false));
changePasswordWindow.addCloseListener(actionId -> {
for (Window window : wm.getOpenWindows()) {
window.setEnabled(true);
}
});
}
}
use of com.haulmont.cuba.gui.config.WindowConfig in project cuba by cuba-platform.
the class DefaultExceptionHandler method createErrorInfo.
protected ErrorInfo createErrorInfo(Throwable exception) {
UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.NAME);
Security security = AppBeans.get(Security.NAME);
if (userSessionSource.getUserSession() == null || !security.isSpecificPermitted("cuba.gui.showExceptionDetails")) {
return new ErrorInfo(getMessage("errorPane.title"), getMessage("exceptionDialog.contactAdmin"), null, null, null, null, null);
}
Throwable rootCause = ExceptionUtils.getRootCause(exception);
if (rootCause == null)
rootCause = exception;
StringBuilder msg = new StringBuilder();
if (rootCause instanceof RemoteException) {
RemoteException re = (RemoteException) rootCause;
if (!re.getCauses().isEmpty()) {
RemoteException.Cause cause = re.getCauses().get(re.getCauses().size() - 1);
if (cause.getThrowable() != null)
rootCause = cause.getThrowable();
else {
// root cause is not supported by client
String className = cause.getClassName();
if (className != null && className.indexOf('.') > 0) {
className = className.substring(className.lastIndexOf('.') + 1);
}
msg.append(className).append(": ").append(cause.getMessage());
}
}
}
if (msg.length() == 0) {
msg.append(rootCause.getClass().getSimpleName());
if (!StringUtils.isBlank(rootCause.getMessage()))
msg.append(": ").append(rootCause.getMessage());
if (rootCause instanceof DevelopmentException) {
Map<String, Object> params = new LinkedHashMap<>();
if (rootCause instanceof GuiDevelopmentException) {
GuiDevelopmentException guiDevException = (GuiDevelopmentException) rootCause;
if (guiDevException.getFrameId() != null) {
params.put("Frame ID", guiDevException.getFrameId());
try {
WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
params.put("XML descriptor", windowConfig.getWindowInfo(guiDevException.getFrameId()).getTemplate());
} catch (Exception e) {
params.put("XML descriptor", "not found for " + guiDevException.getFrameId());
}
}
}
params.putAll(((DevelopmentException) rootCause).getParams());
if (!params.isEmpty()) {
msg.append("\n\n");
for (Map.Entry<String, Object> entry : params.entrySet()) {
msg.append(entry.getKey()).append(": ").append(entry.getValue()).append("\n");
}
}
}
}
return new ErrorInfo(getMessage("errorPane.title"), msg.toString(), null, null, rootCause, null, null);
}
Aggregations