Index: engine/src/main/java/org/hippoecm/frontend/dialog/ExceptionDialog.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- engine/src/main/java/org/hippoecm/frontend/dialog/ExceptionDialog.java (revision 34518) +++ engine/src/main/java/org/hippoecm/frontend/dialog/ExceptionDialog.java (revision ) @@ -16,29 +16,61 @@ package org.hippoecm.frontend.dialog; import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.model.AbstractReadOnlyModel; import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; +import org.apache.wicket.util.string.Strings; public class ExceptionDialog extends AbstractDialog { @SuppressWarnings("unused") private final static String SVN_ID = "$Id: ExceptionDialog.java 18052 2012-01-24 09:36:36Z abogaart $"; private static final long serialVersionUID = 1L; - private Exception exception; + private String title; + private String message; - public ExceptionDialog(Exception exception) { - this.exception = exception; - setCancelVisible(false); - add(new Label("message", exception.getLocalizedMessage())); + public ExceptionDialog() { + this.title = getString("dialog-title", null, "Exception"); + + add(new Label("message", new AbstractReadOnlyModel() { + + @Override + public String getObject() { + return message; - } + } - public ExceptionDialog(String message) { + }) { + @Override + public boolean isVisible() { + return !Strings.isEmpty(message); + } + }); setCancelVisible(false); - add(new Label("message", message)); } + public ExceptionDialog(Exception exception) { + this(); + + IModel messageModel = getTranslatedException(exception); + message = messageModel.getObject(); + } + + public ExceptionDialog(final String msg) { + this(); + this.message = msg; + } + public IModel getTitle() { - return new Model("exception"); + return new AbstractReadOnlyModel() { + + @Override + public String getObject() { + return title; + } + }; + } + + public void setTitle(final String title) { + this.title = title; } } Index: engine/src/main/java/org/hippoecm/frontend/dialog/ExceptionDialog_nl.properties IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>MacRoman =================================================================== --- engine/src/main/java/org/hippoecm/frontend/dialog/ExceptionDialog_nl.properties (revision ) +++ engine/src/main/java/org/hippoecm/frontend/dialog/ExceptionDialog_nl.properties (revision ) @@ -0,0 +1,1 @@ +dialog.title: Foutmelding \ No newline at end of file Index: engine/src/main/java/org/hippoecm/frontend/dialog/ExceptionDialog.properties IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>MacRoman =================================================================== --- engine/src/main/java/org/hippoecm/frontend/dialog/ExceptionDialog.properties (revision ) +++ engine/src/main/java/org/hippoecm/frontend/dialog/ExceptionDialog.properties (revision ) @@ -0,0 +1,1 @@ +dialog.title: Exception \ No newline at end of file Index: engine/src/main/java/org/hippoecm/frontend/dialog/AbstractDialog.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- engine/src/main/java/org/hippoecm/frontend/dialog/AbstractDialog.java (revision 34518) +++ engine/src/main/java/org/hippoecm/frontend/dialog/AbstractDialog.java (revision ) @@ -179,22 +179,11 @@ protected Component newMessageDisplayComponent(String id, FeedbackMessage message) { Serializable serializable = message.getMessage(); if (serializable instanceof Exception) { - Exception ex = (Exception) serializable; - Map details = new HashMap(); - details.put("type", ex.getClass().getName()); - details.put("message", ex.getMessage()); - StackTraceElement[] elements = ex.getStackTrace(); - if (elements.length > 0) { - StackTraceElement top = elements[0]; - details.put("clazz", top.getClassName()); - } - ExceptionLabel label = new ExceptionLabel(id, new StringResourceModel( - "exception,type=${type},message=${message}" - + (details.containsKey("clazz") ? ",class=${clazz}" : ""), AbstractDialog.this, - new Model((Serializable) details), ex.getLocalizedMessage()), ex, + Exception ex = (Exception) message.getMessage(); + IModel exceptionModel = getTranslatedException(ex); + return new ExceptionLabel(id, exceptionModel, ex, - ExceptionFeedbackPanel.this.getEscapeModelStrings()); + ExceptionFeedbackPanel.this.getEscapeModelStrings()); - return label; - } else { + } else { Label label = new Label(id); label.setDefaultModel(new Model(serializable == null ? "" : serializable.toString())); label.setEscapeModelStrings(ExceptionFeedbackPanel.this.getEscapeModelStrings()); @@ -206,6 +195,22 @@ protected FeedbackMessagesModel newFeedbackMessagesModel() { return AbstractDialog.this.getFeedbackMessagesModel(); } + } + + protected IModel getTranslatedException(final Exception ex) { + String key = "exception,type=${type},message=${message}"; + Map details = new HashMap(); + details.put("type", ex.getClass().getName()); + details.put("message", ex.getMessage()); + StackTraceElement[] elements = ex.getStackTrace(); + if (elements.length > 0) { + StackTraceElement top = elements[0]; + details.put("clazz", top.getClassName()); + key += ",class=${clazz}"; + } + return new StringResourceModel(key, AbstractDialog.this, + new Model((Serializable) details), ex.getLocalizedMessage()); + } class ButtonWrapper implements IClusterable { Index: ../addons/hippo-addon-publication-workflow-2.20.xx/frontend/src/main/java/org/hippoecm/repository/reviewedactions/BasicReviewedActionsWorkflowImpl.properties IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>MacRoman =================================================================== --- ../addons/hippo-addon-publication-workflow-2.20.xx/frontend/src/main/java/org/hippoecm/repository/reviewedactions/BasicReviewedActionsWorkflowImpl.properties (revision 34675) +++ ../addons/hippo-addon-publication-workflow-2.20.xx/frontend/src/main/java/org/hippoecm/repository/reviewedactions/BasicReviewedActionsWorkflowImpl.properties (revision ) @@ -11,3 +11,4 @@ exception,type\=org.hippoecm.repository.api.WorkflowException,message\=publication\ request\ already\ pending=Publication request already pending. exception,type\=org.hippoecm.repository.api.WorkflowException,message\=request\ deletion\ failure=Request deletion failure. exception,type\=org.hippoecm.repository.api.WorkflowException,message\=unsupported=Unsupported action. +exception,type\=org.hippoecm.repository.api.WorkflowException,message\=unable\ to\ edit\ document\ with\ pending\ operation=The document cannot be restored because a different user has requested it to be (de)published. This request has to be either accepted or declined before a restore action can be executed. \ No newline at end of file Index: ../addons/hippo-addon-publication-workflow-2.20.xx/frontend/src/main/java/org/hippoecm/repository/reviewedactions/BasicReviewedActionsWorkflowImpl_nl.properties IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>MacRoman =================================================================== --- ../addons/hippo-addon-publication-workflow-2.20.xx/frontend/src/main/java/org/hippoecm/repository/reviewedactions/BasicReviewedActionsWorkflowImpl_nl.properties (revision 34675) +++ ../addons/hippo-addon-publication-workflow-2.20.xx/frontend/src/main/java/org/hippoecm/repository/reviewedactions/BasicReviewedActionsWorkflowImpl_nl.properties (revision ) @@ -11,3 +11,4 @@ exception,type\=org.hippoecm.repository.api.WorkflowException,message\=publication\ request\ already\ pending=Publicatie verzoek is reeds ingedient. exception,type\=org.hippoecm.repository.api.WorkflowException,message\=request\ deletion\ failure=Verzoek tot verwijderen heeft gefaald. exception,type\=org.hippoecm.repository.api.WorkflowException,message\=unsupported=Niet ondersteunde actie. +exception,type\=org.hippoecm.repository.api.WorkflowException,message\=unable\ to\ edit\ document\ with\ pending\ operation=Het document kan niet worden hersteld omdat een andere gebruiker een verzoek tot (de)publicatie heeft aangevraagd. Dit verzoek moet worden aanvaard of geweigerd voordat het document kan worden hersteld. \ No newline at end of file