本文整理汇总了Java中com.haulmont.cuba.gui.GuiDevelopmentException.getFrameId方法的典型用法代码示例。如果您正苦于以下问题:Java GuiDevelopmentException.getFrameId方法的具体用法?Java GuiDevelopmentException.getFrameId怎么用?Java GuiDevelopmentException.getFrameId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.haulmont.cuba.gui.GuiDevelopmentException
的用法示例。
在下文中一共展示了GuiDevelopmentException.getFrameId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getText
import com.haulmont.cuba.gui.GuiDevelopmentException; //导入方法依赖的package包/类
protected String getText(Throwable rootCause) {
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);
//noinspection ThrowableResultOfMethodCallIgnored
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 {
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 msg.toString();
}
示例2: createErrorInfo
import com.haulmont.cuba.gui.GuiDevelopmentException; //导入方法依赖的package包/类
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);
}