]> source.dussan.org Git - vaadin-framework.git/commitdiff
#3265 Fix immediate redirection when system notifications are disabled
authorHenri Sara <henri.sara@itmill.com>
Thu, 3 Sep 2009 09:41:28 +0000 (09:41 +0000)
committerHenri Sara <henri.sara@itmill.com>
Thu, 3 Sep 2009 09:41:28 +0000 (09:41 +0000)
svn changeset:8646/svn branch:6.1

src/com/vaadin/terminal/gwt/client/ApplicationConnection.java

index 31ee4dad8118c16f87c7aab23d6d4ac6c4cfbc99..36248bd147a20d597a40aa088e360dd3f292fcb9 100755 (executable)
@@ -1,4 +1,4 @@
-/* 
+/*
 @ITMillApache2LicenseForJavaFiles@
  */
 
@@ -129,7 +129,7 @@ public class ApplicationConnection {
         ComponentLocator componentLocator = new ComponentLocator(this);
 
         String appRootPanelName = cnf.getRootPanelId();
-        // remove the end (window name) of autogenarated rootpanel id
+        // remove the end (window name) of autogenerated rootpanel id
         appRootPanelName = appRootPanelName.replaceFirst("-\\d+$", "");
 
         initializeTestingToolsHooks(componentLocator, appRootPanelName);
@@ -166,7 +166,7 @@ public class ApplicationConnection {
                  return vi;
              }
          }
-         
+
          client.getElementByPath = function(id) {
             return componentLocator.@com.vaadin.terminal.gwt.client.ComponentLocator::getElementByPath(Ljava/lang/String;)(id);
          }
@@ -177,7 +177,7 @@ public class ApplicationConnection {
          if(!$wnd.vaadin.clients) {
             $wnd.vaadin.clients = {};
          }
-         
+
         $wnd.vaadin.clients[TTAppId] = client;
     }-*/;
 
@@ -198,8 +198,8 @@ public class ApplicationConnection {
      * <li><code>vaadin.postRequestHooks</code> is a map of functions which gets
      * called after each XHR made by vaadin application. Note, that it is
      * attaching js functions responsibility to create the variable like this:
-     * 
-     * <code><pre> 
+     *
+     * <code><pre>
      * if(!vaadin.postRequestHooks) {vaadin.postRequestHooks = new Object();}
      * postRequestHooks.myHook = function(appId) {
      *          if(appId == "MyAppOfInterest") {
@@ -209,7 +209,7 @@ public class ApplicationConnection {
      * </pre></code> First parameter passed to these functions is the identifier
      * of Vaadin application that made the request.
      * </ul>
-     * 
+     *
      * TODO make this multi-app aware
      */
     private native void initializeClientHooks()
@@ -240,7 +240,7 @@ public class ApplicationConnection {
     /**
      * Runs possibly registered client side post request hooks. This is expected
      * to be run after each uidl request made by Vaadin application.
-     * 
+     *
      * @param appId
      */
     private static native void runPostRequestHooks(String appId)
@@ -263,7 +263,7 @@ public class ApplicationConnection {
     /**
      * Checks if client side is in debug mode. Practically this is invoked by
      * adding ?debug parameter to URI.
-     * 
+     *
      * @return true if client side is currently been debugged
      */
     public native static boolean isDebugMode()
@@ -439,7 +439,7 @@ public class ApplicationConnection {
     /**
      * Shows the communication error notification. The 'details' only go to the
      * console for now.
-     * 
+     *
      * @param details
      *            Optional details for debugging.
      */
@@ -476,7 +476,7 @@ public class ApplicationConnection {
     } catch (e) {
         // No errors are managed as this is synchronous forceful send that can just fail
     }
-                    
+
     }-*/;
 
     private void startRequest() {
@@ -521,7 +521,7 @@ public class ApplicationConnection {
 
     /**
      * This method is called after applying uidl change set to application.
-     * 
+     *
      * It will clean current and queued variable change sets. And send next
      * change set if it exists.
      */
@@ -541,7 +541,7 @@ public class ApplicationConnection {
     /**
      * Cleans given queue of variable changes of such changes that came from
      * components that do not exist anymore.
-     * 
+     *
      * @param variableBurst
      */
     private void cleanVariableBurst(ArrayList<String> variableBurst) {
@@ -748,10 +748,12 @@ public class ApplicationConnection {
             if (meta.containsKey("appError")) {
                 ValueMap error = meta.getValueMap("appError");
                 String html = "";
-                if (error.containsKey("caption")) {
+                if (error.containsKey("caption")
+                        && error.getString("caption") != null) {
                     html += "<h1>" + error.getAsString("caption") + "</h1>";
                 }
-                if (error.containsKey("message")) {
+                if (error.containsKey("message")
+                        && error.getString("message") != null) {
                     html += "<p>" + error.getAsString("message") + "</p>";
                 }
                 String url = null;
@@ -870,7 +872,7 @@ public class ApplicationConnection {
 
     /**
      * Returns Paintable element by its id
-     * 
+     *
      * @param id
      *            Paintable ID
      */
@@ -904,12 +906,12 @@ public class ApplicationConnection {
     /**
      * This method sends currently queued variable changes to server. It is
      * called when immediate variable update must happen.
-     * 
+     *
      * To ensure correct order for variable changes (due servers multithreading
      * or network), we always wait for active request to be handler before
      * sending a new one. If there is an active request, we will put varible
      * "burst" to queue that will be purged after current request is handled.
-     * 
+     *
      */
     @SuppressWarnings("unchecked")
     public void sendPendingVariableChanges() {
@@ -931,11 +933,11 @@ public class ApplicationConnection {
 
     /**
      * Build the variable burst and send it to server.
-     * 
+     *
      * When sync is forced, we also force sending of all pending variable-bursts
      * at the same time. This is ok as we can assume that DOM will never be
      * updated after this.
-     * 
+     *
      * @param pendingVariables
      *            Vector of variable changes to send
      * @param forceSync
@@ -1024,9 +1026,9 @@ public class ApplicationConnection {
 
     /**
      * Update generic component features.
-     * 
+     *
      * <h2>Selecting correct implementation</h2>
-     * 
+     *
      * <p>
      * The implementation of a component depends on many properties, including
      * styles, component features, etc. Sometimes the user changes those
@@ -1034,21 +1036,21 @@ public class ApplicationConnection {
      * the beginning of your updateFromUIDL -method automatically replaces your
      * component with more appropriate if the requested implementation changes.
      * </p>
-     * 
+     *
      * <h2>Caption, icon, error messages and description</h2>
-     * 
+     *
      * <p>
      * Component can delegate management of caption, icon, error messages and
      * description to parent layout. This is optional an should be decided by
      * component author
      * </p>
-     * 
+     *
      * <h2>Component visibility and disabling</h2>
-     * 
+     *
      * This method will manage component visibility automatically and if
      * component is an instanceof FocusWidget, also handle component disabling
      * when needed.
-     * 
+     *
      * @param component
      *            Widget to be updated, expected to implement an instance of
      *            Paintable
@@ -1057,7 +1059,7 @@ public class ApplicationConnection {
      * @param manageCaption
      *            True if you want to delegate caption, icon, description and
      *            error message management to parent.
-     * 
+     *
      * @return Returns true iff no further painting is needed by caller
      */
     public boolean updateComponent(Widget component, UIDL uidl,
@@ -1266,7 +1268,7 @@ public class ApplicationConnection {
     /**
      * Traverses recursively child widgets until ContainerResizedListener child
      * widget is found. They will delegate it further if needed.
-     * 
+     *
      * @param container
      */
     private boolean runningLayout = false;
@@ -1329,7 +1331,7 @@ public class ApplicationConnection {
 
     /**
      * Converts relative sizes into pixel sizes.
-     * 
+     *
      * @param child
      * @return true if the child has a relative size
      */
@@ -1476,7 +1478,7 @@ public class ApplicationConnection {
 
     /**
      * Converts relative sizes into pixel sizes.
-     * 
+     *
      * @param child
      * @return true if the child has a relative size
      */
@@ -1493,12 +1495,12 @@ public class ApplicationConnection {
 
     /**
      * Get either existing or new Paintable for given UIDL.
-     * 
+     *
      * If corresponding Paintable has been previously painted, return it.
      * Otherwise create and register a new Paintable from UIDL. Caller must
      * update the returned Paintable from UIDL after it has been connected to
      * parent.
-     * 
+     *
      * @param uidl
      *            UIDL to create Paintable from.
      * @return Either existing or new Paintable corresponding to UIDL.
@@ -1518,7 +1520,7 @@ public class ApplicationConnection {
 
     /**
      * Returns a Paintable element by its root element
-     * 
+     *
      * @param element
      *            Root element of the paintable
      */
@@ -1532,7 +1534,7 @@ public class ApplicationConnection {
 
     /**
      * Singleton method to get instance of app's context menu.
-     * 
+     *
      * @return VContextMenu object
      */
     public VContextMenu getContextMenu() {
@@ -1548,7 +1550,7 @@ public class ApplicationConnection {
      * Translates custom protocols in UIDL URI's to be recognizable by browser.
      * All uri's from UIDL should be routed via this method before giving them
      * to browser due URI's in UIDL may contain custom protocols like theme://.
-     * 
+     *
      * @param uidlUri
      *            Vaadin URI from uidl
      * @return translated URI ready for browser
@@ -1576,7 +1578,7 @@ public class ApplicationConnection {
     /**
      * Listens for Notification hide event, and redirects. Used for system
      * messages, such as session expired.
-     * 
+     *
      */
     private class NotificationRedirect implements VNotification.EventListener {
         String url;
@@ -1596,9 +1598,9 @@ public class ApplicationConnection {
     /**
      * Data showed in tooltips are stored centrilized as it may be needed in
      * varios place: caption, layouts, and in owner components themselves.
-     * 
+     *
      * Updating TooltipInfo is done in updateComponent method.
-     * 
+     *
      */
     public TooltipInfo getTooltipTitleInfo(Paintable titleOwner, Object key) {
         if (null == titleOwner) {
@@ -1618,9 +1620,9 @@ public class ApplicationConnection {
      * Component may want to delegate Tooltip handling to client. Layouts add
      * Tooltip (description, errors) to caption, but some components may want
      * them to appear one other elements too.
-     * 
+     *
      * Events wanted by this handler are same as in Tooltip.TOOLTIP_EVENTS
-     * 
+     *
      * @param event
      * @param owner
      */
@@ -1633,9 +1635,9 @@ public class ApplicationConnection {
      * Component may want to delegate Tooltip handling to client. Layouts add
      * Tooltip (description, errors) to caption, but some components may want
      * them to appear one other elements too.
-     * 
+     *
      * Events wanted by this handler are same as in Tooltip.TOOLTIP_EVENTS
-     * 
+     *
      * @param event
      * @param owner
      * @param key
@@ -1649,7 +1651,7 @@ public class ApplicationConnection {
 
     /**
      * Adds PNG-fix conditionally (only for IE6) to the specified IMG -element.
-     * 
+     *
      * @param el
      *            the IMG element to fix
      */
@@ -1699,7 +1701,7 @@ public class ApplicationConnection {
      * Reset the name of the current browser-window. This should reflect the
      * window-name used in the server, but might be different from the
      * window-object target-name on client.
-     * 
+     *
      * @param stringAttribute
      *            New name for the window.
      */
@@ -1729,14 +1731,14 @@ public class ApplicationConnection {
      * <p>
      * This method can also be used to deregister tooltips by using null as
      * tooltip
-     * 
+     *
      * @param paintable
      *            Paintable "owning" this tooltip
      * @param key
      *            key assosiated with given tooltip. Can be any object. For
      *            example a related dom element. Same key must be given for
      *            {@link #handleTooltipEvent(Event, Paintable, Object)} method.
-     * 
+     *
      * @param tooltip
      *            the TooltipInfo object containing details shown in tooltip,
      *            null if deregistering tooltip