diff options
author | Marc Englund <marc.englund@itmill.com> | 2009-01-30 06:57:09 +0000 |
---|---|---|
committer | Marc Englund <marc.englund@itmill.com> | 2009-01-30 06:57:09 +0000 |
commit | 86fde400990b7205ab0164a9ed84be0f5680e866 (patch) | |
tree | 1c0f4538a7637125112e65628013f3007ad6d850 | |
parent | a65c7b1d2e592f1473e1889662c0dd70d67d33be (diff) | |
download | vaadin-framework-86fde400990b7205ab0164a9ed84be0f5680e866.tar.gz vaadin-framework-86fde400990b7205ab0164a9ed84be0f5680e866.zip |
Added missing setters for communication error message, fixes #2521. Also fixed a case where an empty notification was shown before forwarding to com-err-url.
svn changeset:6679/svn branch:trunk
-rw-r--r-- | src/com/itmill/toolkit/Application.java | 46 | ||||
-rwxr-xr-x | src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java | 14 |
2 files changed, 56 insertions, 4 deletions
diff --git a/src/com/itmill/toolkit/Application.java b/src/com/itmill/toolkit/Application.java index 866a9ced51..ad51911ed7 100644 --- a/src/com/itmill/toolkit/Application.java +++ b/src/com/itmill/toolkit/Application.java @@ -1423,6 +1423,52 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener } /** + * Sets the URL to go to when there is a communication error. + * + * @param communicationErrorURL + * the URL to go to, or null to reload current + */ + public void setCommunicationErrorURL(String communicationErrorURL) { + this.communicationErrorURL = communicationErrorURL; + } + + /** + * Enables or disables the notification. If disabled, the set URL (or + * current) is loaded directly. + * + * @param communicationErrorNotificationEnabled + * true = enabled, false = disabled + */ + public void setCommunicationErrorNotificationEnabled( + boolean communicationErrorNotificationEnabled) { + this.communicationErrorNotificationEnabled = communicationErrorNotificationEnabled; + } + + /** + * Sets the caption of the notification. Set to null for no caption. If + * both caption and message is null, the notification is disabled; + * + * @param communicationErrorCaption + * the caption + */ + public void setCommunicationErrorCaption( + String communicationErrorCaption) { + this.communicationErrorCaption = communicationErrorCaption; + } + + /** + * Sets the message of the notification. Set to null for no message. If + * both caption and message is null, the notification is disabled; + * + * @param communicationErrorMessage + * the message + */ + public void setCommunicationErrorMessage( + String communicationErrorMessage) { + this.communicationErrorMessage = communicationErrorMessage; + } + + /** * Sets the URL to go to when an internal error occurs. * * @param internalErrorURL diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java b/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java index 47e1f06d52..2959aa74cd 100755 --- a/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java @@ -424,10 +424,16 @@ public class ApplicationConnection { html += "<p>" + configuration.getCommunicationErrorMessage() + "</p>"; } - INotification n = new INotification(1000 * 60 * 45); - n.addEventListener(new NotificationRedirect(configuration - .getCommunicationErrorUrl())); - n.show(html, INotification.CENTERED_TOP, INotification.STYLE_SYSTEM); + if (html.length() > 0) { + INotification n = new INotification(1000 * 60 * 45); + n.addEventListener(new NotificationRedirect(configuration + .getCommunicationErrorUrl())); + n + .show(html, INotification.CENTERED_TOP, + INotification.STYLE_SYSTEM); + } else { + redirect(configuration.getCommunicationErrorUrl()); + } } private native void syncSendForce(JavaScriptObject xmlHttpRequest, |