Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 376367
Collapse All | Expand All

(-)js/org/eclipse/rwt/Display.js (+4 lines)
Lines 78-83 Link Here
78
    org.eclipse.swt.theme.ThemeStore.getInstance().setCurrentTheme( themeId );
78
    org.eclipse.swt.theme.ThemeStore.getInstance().setCurrentTheme( themeId );
79
  },
79
  },
80
80
81
  setTimeoutInterval : function( content ) {
82
    org.eclipse.swt.Request.getInstance().setTimeoutInterval( content );
83
  },
84
81
  setEnableUiTests : function( value ) {
85
  setEnableUiTests : function( value ) {
82
    qx.ui.core.Widget._renderHtmlIds = value;
86
    qx.ui.core.Widget._renderHtmlIds = value;
83
  },
87
  },
(-)js/org/eclipse/rwt/DisplayAdapter.js (+1 lines)
Lines 21-26 Link Here
21
    "exitConfirmation",
21
    "exitConfirmation",
22
    "focusControl",
22
    "focusControl",
23
    "currentTheme",
23
    "currentTheme",
24
    "timeoutInterval",
24
    "enableUiTests",
25
    "enableUiTests",
25
    "activeKeys",
26
    "activeKeys",
26
    "cancelKeys"
27
    "cancelKeys"
(-)js/org/eclipse/rwt/ErrorHandler.js (-23 / +31 lines)
Lines 8-14 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *    EclipseSource - initial API and implementation
9
 *    EclipseSource - initial API and implementation
10
 ******************************************************************************/
10
 ******************************************************************************/
11
11
 
12
/*global console: false */
12
/*global console: false */
13
13
14
qx.Class.define( "org.eclipse.rwt.ErrorHandler", {
14
qx.Class.define( "org.eclipse.rwt.ErrorHandler", {
Lines 53-82 Link Here
53
    },
53
    },
54
54
55
    showErrorBox : function( content ) {
55
    showErrorBox : function( content ) {
56
      var location = String( window.location );
56
      //Assume it is a url;
57
      var index = location.indexOf( "#" );
57
      if ( content.indexOf( "<html" ) > -1 ) {
58
      if( index != -1 ) {
58
		var location = String( window.location );
59
        location = location.substring( 0, index );
59
		var index = location.indexOf( "#" );
60
      }
60
		if ( index != -1 ) {
61
      var hrefAttr = "href=\"" + location + "\"";
61
		  location = location.substring( 0, index );
62
      var html = content.replace( /\{HREF_URL\}/, hrefAttr );
62
		}
63
      html = org.eclipse.rwt.protocol.EncodingUtil.replaceNewLines( html, "<br/>" );
63
		var hrefAttr = "href=\"" + location + "\"";
64
      this._freezeApplication();
64
		var html = content.replace( /\{HREF_URL\}/, hrefAttr );
65
      this._createOverlay();
65
		html = org.eclipse.rwt.protocol.EncodingUtil.replaceNewLines( html, "<br/>" );
66
      var element = this._createErrorBoxArea( 400, 100 );
66
		this._freezeApplication();
67
      element.innerHTML = html;
67
		this._createOverlay();
68
      var hyperlink = element.getElementsByTagName( "a" )[ 0 ];
68
		var element = this._createErrorBoxArea( 400, 100 );
69
      hyperlink.style.outline = "none";
69
		element.innerHTML = html;
70
      hyperlink.focus();
70
		var hyperlink = element.getElementsByTagName( "a" )[ 0 ];
71
		hyperlink.style.outline = "none";
72
		hyperlink.focus();
73
      }
74
      else {
75
    	//[ariddle] - HACK for IE: clear exit confirmation
76
    	org.eclipse.rwt.Display.getCurrent().setExitConfirmation(null);
77
    	window.location.href = content;
78
      }
71
    },
79
    },
72
80
73
    _gatherErrorInfo : function( error, script, currentRequest ) {
81
    _gatherErrorInfo : function( error, script, currentRequest ) {
74
      var info = [];
82
      var info = [];
75
      try {
83
      try {
76
        info.push( "Error: " + error + "\n" );
84
	      info.push( "Error: " + error + "\n" );
77
        if( script ) {
85
	      if( script ) {
78
          info.push( "Script: " + script );
86
		      info.push( "Script: " + script );
79
        }
87
	      }
80
        if( error instanceof Error ) {
88
        if( error instanceof Error ) {
81
          for( var key in error ) { // NOTE : does not work in webkit (no iteration)
89
          for( var key in error ) { // NOTE : does not work in webkit (no iteration)
82
            info.push( key + ": " + error[ key ] );
90
            info.push( key + ": " + error[ key ] );
Lines 84-93 Link Here
84
          if( error.stack ) { // ensures stack is printed in webkit, might be printed twice in gecko  
92
          if( error.stack ) { // ensures stack is printed in webkit, might be printed twice in gecko  
85
            info.push( "Stack: " + error.stack );
93
            info.push( "Stack: " + error.stack );
86
          }
94
          }
87
       }
95
        }
88
        info.push( "Debug: " + qx.core.Variant.get( "qx.debug" ) );
96
        info.push( "Debug: " + qx.core.Variant.get( "qx.debug" ) );
89
        if( currentRequest ) {
97
        if( currentRequest ) {
90
          info.push( "Request: " + currentRequest.getData() );
98
	        info.push( "Request: " + currentRequest.getData() );
91
        }
99
        }
92
        var inFlush = qx.ui.core.Widget._inFlushGlobalQueues;
100
        var inFlush = qx.ui.core.Widget._inFlushGlobalQueues;
93
        if( inFlush ) {
101
        if( inFlush ) {
Lines 181-184 Link Here
181
189
182
  }
190
  }
183
191
184
} );
192
} );
(-)js/org/eclipse/swt/Request.js (-18 / +49 lines)
Lines 39-44 Link Here
39
    requestQueue.setMaxConcurrentRequests( 1 );
39
    requestQueue.setMaxConcurrentRequests( 1 );
40
    // References the currently running request or null if no request is active
40
    // References the currently running request or null if no request is active
41
    this._currentRequest = null;
41
    this._currentRequest = null;
42
    //[ariddle] - added for inactive/timeout support
43
    this._timeoutInterval = 0;
44
    this._startTime = 0;
45
    this._inactiveTimer = null;
42
  },
46
  },
43
47
44
  destruct : function() {
48
  destruct : function() {
Lines 76-81 Link Here
76
      return this._requestCounter;
80
      return this._requestCounter;
77
    },
81
    },
78
82
83
    setTimeoutInterval : function( content ) {
84
      this._timeoutInterval = content * 1000;
85
    },
86
79
    /**
87
    /**
80
     * Adds a request parameter to this request with the given name and value
88
     * Adds a request parameter to this request with the given name and value
81
     */
89
     */
Lines 118-124 Link Here
118
      if( !this._inDelayedSend ) {
126
      if( !this._inDelayedSend ) {
119
        this._inDelayedSend = true;
127
        this._inDelayedSend = true;
120
        var func = function() {
128
        var func = function() {
121
          this._sendImmediate( true );
129
        	this._sendImmediate( true );
122
        };
130
        };
123
        qx.client.Timer.once( func, this, 60 );
131
        qx.client.Timer.once( func, this, 60 );
124
      }
132
      }
Lines 181-188 Link Here
181
      result.addEventListener( "sending", this._handleSending, this );
189
      result.addEventListener( "sending", this._handleSending, this );
182
      result.addEventListener( "completed", this._handleCompleted, this );
190
      result.addEventListener( "completed", this._handleCompleted, this );
183
      result.addEventListener( "failed", this._handleFailed, this );
191
      result.addEventListener( "failed", this._handleFailed, this );
192
      this._handleInactiveTimer();
184
      return result;
193
      return result;
185
    },
194
    },
195
    
196
    //[ariddle] - added for inactive/timeout support
197
    _handleInactiveTimer : function () {
198
      if ( this._inactiveTimer == null ) {
199
    	if ( this._timeoutInterval > 0 ) {
200
    	  this._inactiveTimer = new qx.client.Timer( this._timeoutInterval );
201
    	  this._inactiveTimer.addEventListener( "interval", 
202
    	    function () {
203
    		  org.eclipse.rwt.ErrorHandler.showTimeout( this._timeoutPage );
204
		    }, 
205
		    this 
206
		  );
207
		  this._inactiveTimer.start();
208
        }
209
      }
210
      else {
211
    	this._inactiveTimer.stop();
212
    	if ( this._timeoutInterval > 0 ) {
213
    	  this._inactiveTimer.startWith( this._timeoutInterval );
214
    	}
215
      }
216
    },
186
217
187
    _sendStandalone : function( request ) {
218
    _sendStandalone : function( request ) {
188
      // TODO [rh] WORKAROUND
219
      // TODO [rh] WORKAROUND
Lines 239-245 Link Here
239
            org.eclipse.rwt.ErrorHandler.showErrorBox( messageObject.meta.message );
270
            org.eclipse.rwt.ErrorHandler.showErrorBox( messageObject.meta.message );
240
          } else {
271
          } else {
241
            org.eclipse.rwt.ErrorHandler.showErrorPage( text );
272
            org.eclipse.rwt.ErrorHandler.showErrorPage( text );
242
          }
273
        }
243
        } else {
274
        } else {
244
          var statusCode = String( evt.getStatusCode() );
275
          var statusCode = String( evt.getStatusCode() );
245
          text = "<p>Request failed.</p><pre>HTTP Status Code: " + statusCode + "</pre>";
276
          text = "<p>Request failed.</p><pre>HTTP Status Code: " + statusCode + "</pre>";
Lines 253-274 Link Here
253
    _handleCompleted : function( evt ) {
284
    _handleCompleted : function( evt ) {
254
      var exchange = evt.getTarget();
285
      var exchange = evt.getTarget();
255
      var text = exchange.getImplementation().getRequest().responseText;
286
      var text = exchange.getImplementation().getRequest().responseText;
256
      var errorOccured = false;
287
        var errorOccured = false;
257
      try {
288
        try {
258
        var messageObject = JSON.parse( text );
289
        var messageObject = JSON.parse( text );
259
        org.eclipse.swt.EventUtil.setSuspended( true );
290
            org.eclipse.swt.EventUtil.setSuspended( true );
260
        org.eclipse.rwt.protocol.Processor.processMessage( messageObject );
291
            org.eclipse.rwt.protocol.Processor.processMessage( messageObject );
261
        org.eclipse.swt.EventUtil.setSuspended( false );
292
            org.eclipse.swt.EventUtil.setSuspended( false );
262
        org.eclipse.rwt.UICallBack.getInstance().sendUICallBackRequest();
293
          org.eclipse.rwt.UICallBack.getInstance().sendUICallBackRequest();
263
      } catch( ex ) {
294
        } catch( ex ) {
264
        org.eclipse.rwt.ErrorHandler.processJavaScriptErrorInResponse( text,
295
          org.eclipse.rwt.ErrorHandler.processJavaScriptErrorInResponse( text,
265
                                                                       ex,
296
                                                                         ex,
266
                                                                       this._currentRequest );
297
                                                                         this._currentRequest );
267
        errorOccured = true;
298
          errorOccured = true;
268
      }
299
        }
269
      if( !errorOccured ) {
300
        if( !errorOccured ) {
270
        this._dispatchReceivedEvent();
301
          this._dispatchReceivedEvent();
271
      }
302
        }
272
      this._runningRequestCount--;
303
      this._runningRequestCount--;
273
      this._hideWaitHint();
304
      this._hideWaitHint();
274
      // [if] Dispose only finished transport - see bug 301261, 317616
305
      // [if] Dispose only finished transport - see bug 301261, 317616
Lines 316-322 Link Here
316
        requestQueue._timer.start();
347
        requestQueue._timer.start();
317
      }
348
      }
318
    },
349
    },
319
350
    
320
    _isConnectionError : qx.core.Variant.select( "qx.client", {
351
    _isConnectionError : qx.core.Variant.select( "qx.client", {
321
      "mshtml" : function( statusCode ) {
352
      "mshtml" : function( statusCode ) {
322
        // for a description of the IE status codes, see
353
        // for a description of the IE status codes, see
(-)widgetkits/org/eclipse/swt/internal/widgets/displaykit/DisplayLCA.java (+28 lines)
Lines 12-20 Link Here
12
package org.eclipse.swt.internal.widgets.displaykit;
12
package org.eclipse.swt.internal.widgets.displaykit;
13
13
14
import java.io.IOException;
14
import java.io.IOException;
15
import java.text.MessageFormat;
16
15
import javax.servlet.http.HttpServletRequest;
17
import javax.servlet.http.HttpServletRequest;
16
18
19
import org.eclipse.rwt.RWT;
17
import org.eclipse.rwt.branding.AbstractBranding;
20
import org.eclipse.rwt.branding.AbstractBranding;
21
import org.eclipse.rwt.internal.RWTMessages;
18
import org.eclipse.rwt.internal.application.RWTFactory;
22
import org.eclipse.rwt.internal.application.RWTFactory;
19
import org.eclipse.rwt.internal.branding.BrandingUtil;
23
import org.eclipse.rwt.internal.branding.BrandingUtil;
20
import org.eclipse.rwt.internal.lifecycle.DisplayUtil;
24
import org.eclipse.rwt.internal.lifecycle.DisplayUtil;
Lines 59-64 Link Here
59
  static final String PROP_CURRENT_THEME = "currentTheme";
63
  static final String PROP_CURRENT_THEME = "currentTheme";
60
  static final String PROP_EXIT_CONFIRMATION = "exitConfirmation";
64
  static final String PROP_EXIT_CONFIRMATION = "exitConfirmation";
61
  static final String PROP_TIMEOUT_PAGE = "timeoutPage";
65
  static final String PROP_TIMEOUT_PAGE = "timeoutPage";
66
  static final String PROP_TIMEOUT_INTERVAL = "timeoutInterval";
62
  private static final String METHOD_BEEP = "beep";
67
  private static final String METHOD_BEEP = "beep";
63
68
64
  private static final class RenderVisitor extends AllWidgetTreeVisitor {
69
  private static final class RenderVisitor extends AllWidgetTreeVisitor {
Lines 132-137 Link Here
132
    IWidgetAdapter adapter = DisplayUtil.getAdapter( display );
137
    IWidgetAdapter adapter = DisplayUtil.getAdapter( display );
133
    adapter.preserve( PROP_FOCUS_CONTROL, display.getFocusControl() );
138
    adapter.preserve( PROP_FOCUS_CONTROL, display.getFocusControl() );
134
    adapter.preserve( PROP_CURRENT_THEME, ThemeUtil.getCurrentThemeId() );
139
    adapter.preserve( PROP_CURRENT_THEME, ThemeUtil.getCurrentThemeId() );
140
    adapter.preserve( PROP_TIMEOUT_PAGE, getTimeoutPage( display ) );
141
    int maxInactiveInterval = RWT.getRequest().getSession().getMaxInactiveInterval();
142
    adapter.preserve( PROP_TIMEOUT_INTERVAL, Integer.valueOf( maxInactiveInterval ) );
135
    adapter.preserve( PROP_EXIT_CONFIRMATION, getExitConfirmation() );
143
    adapter.preserve( PROP_EXIT_CONFIRMATION, getExitConfirmation() );
136
    ActiveKeysUtil.preserveActiveKeys( display );
144
    ActiveKeysUtil.preserveActiveKeys( display );
137
    ActiveKeysUtil.preserveCancelKeys( display );
145
    ActiveKeysUtil.preserveCancelKeys( display );
Lines 210-215 Link Here
210
    }
218
    }
211
  }
219
  }
212
220
221
  private static String getTimeoutPage(Display display) {
222
    String timeoutPage = (String) display.getData( "org.eclipse.rap.rwt."+PROP_TIMEOUT_PAGE );
223
    if ( timeoutPage == null ) {
224
      String timeoutTitle = RWTMessages.getMessage( "RWT_SessionTimeoutPageTitle" );
225
      String timeoutHeadline = RWTMessages.getMessage( "RWT_SessionTimeoutPageHeadline" );
226
      String pattern = RWTMessages.getMessage( "RWT_SessionTimeoutPageMessage" );
227
      Object[] arguments = new Object[]{ "<a {HREF_URL}>", "</a>" };
228
      String timeoutMessage = MessageFormat.format( pattern, arguments );
229
      // TODO Escape umlauts etc
230
      timeoutPage = "<html><head><title>"
231
          + timeoutTitle
232
          + "</title></head><body><p>"
233
          + timeoutHeadline
234
          + "</p><p>"
235
          + timeoutMessage
236
          + "</p></body></html>";
237
    }
238
    return timeoutPage;
239
  }
240
213
  private static void renderExitConfirmation( Display display ) {
241
  private static void renderExitConfirmation( Display display ) {
214
    String exitConfirmation = getExitConfirmation();
242
    String exitConfirmation = getExitConfirmation();
215
    IWidgetAdapter adapter = DisplayUtil.getAdapter( display );
243
    IWidgetAdapter adapter = DisplayUtil.getAdapter( display );

Return to bug 376367