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 366929
Collapse All | Expand All

(-)js/org/eclipse/rwt/protocol/ObjectManager.js (+3 lines)
Lines 22-27 Link Here
22
      "type" : type
22
      "type" : type
23
    };
23
    };
24
    object._rwtId = id;
24
    object._rwtId = id;
25
    if( typeof object.applyObjectId === "function" ) {
26
      object.applyObjectId( id );
27
    }
25
    if( this._callbacks[ id ] ) {
28
    if( this._callbacks[ id ] ) {
26
      for( var i = 0; i < this._callbacks[ id ].length; i++ ) {
29
      for( var i = 0; i < this._callbacks[ id ].length; i++ ) {
27
        this._callbacks[ id ][ i ]( object );
30
        this._callbacks[ id ][ i ]( object );
(-)js/qx/ui/core/Widget.js (+8 lines)
Lines 91-96 Link Here
91
91
92
    _autoFlushTimeout : null,
92
    _autoFlushTimeout : null,
93
    _flushGlobalQueuesPhase : 0,
93
    _flushGlobalQueuesPhase : 0,
94
    _renderHtmlIds : false,
95
94
    _FLUSH_PHASE_IDLE : 0,
96
    _FLUSH_PHASE_IDLE : 0,
95
    _FLUSH_PHASE_WIDGET : 1,
97
    _FLUSH_PHASE_WIDGET : 1,
96
    _FLUSH_PHASE_STATE : 2,
98
    _FLUSH_PHASE_STATE : 2,
Lines 4057-4062 Link Here
4057
        result = this._adapters[ key ];
4059
        result = this._adapters[ key ];
4058
      }
4060
      }
4059
      return result;
4061
      return result;
4062
    },
4063
4064
    applyObjectId : function( id ) {
4065
    	if( qx.ui.core.Widget._renderHtmlIds ) {
4066
        this.setHtmlAttribute( "id", id );
4067
    	}
4060
    }
4068
    }
4061
    
4069
    
4062
  },
4070
  },
(-)js/org/eclipse/rwt/test/tests/ObjectManagerTest.js (+63 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 EclipseSource and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    EclipseSource - initial API and implementation
10
 ******************************************************************************/
11
12
qx.Class.define( "org.eclipse.rwt.test.tests.ObjectManagerTest", {
13
14
  extend : qx.core.Object,
15
  
16
  members : {
17
18
    testAdd : function() {
19
      var manager = org.eclipse.rwt.protocol.ObjectManager;
20
      var obj = {};
21
22
      manager.add( "myId", obj, "myType" );
23
24
      assertIdentical( obj, manager.getObject( "myId" ) );
25
      assertEquals( "myType", manager.getType( "myId" ) );
26
      this._clearObjectManager();
27
    },
28
29
    testRemove : function() {
30
      var manager = org.eclipse.rwt.protocol.ObjectManager;
31
      var obj = {};
32
      manager.add( "myId", obj, "myType" );
33
34
      manager.remove( "myId" );
35
36
      assertIdentical( undefined, manager.getObject( "myId" ) );
37
      assertIdentical( undefined, manager.getType( "myId" ) );
38
      this._clearObjectManager();
39
    },
40
41
    testApplyObjectIdIsCalled : function() {
42
      var manager = org.eclipse.rwt.protocol.ObjectManager;
43
      var log = "";
44
      var obj = {
45
      	applyObjectId : function( id ) {
46
      		log += id;
47
      	}
48
      };
49
50
      manager.add( "myId", obj, "myType" );
51
52
      assertEquals( "myId", log );
53
      this._clearObjectManager();
54
    },
55
56
    _clearObjectManager: function() {
57
      var manager = org.eclipse.rwt.protocol.ObjectManager;
58
    	manager._map = {};
59
    	manager._callbacks = {};
60
    }
61
  }
62
  
63
} );
(-)js/org/eclipse/rwt/test/tests/ProtocolTest.js (-11 lines)
Lines 29-45 Link Here
29
      }
29
      }
30
    },
30
    },
31
31
32
    testObjectManager : function() {
33
      var manager = org.eclipse.rwt.protocol.ObjectManager;
34
      var obj = {};
35
      manager.add( "myId", obj, "myType" );
36
      assertIdentical( obj, manager.getObject( "myId" ) );
37
      assertEquals( "myType", manager.getType( "myId" ) );
38
      manager.remove( "myId" );
39
      assertTrue( manager.getObject( "myId" ) == null );
40
      assertTrue( manager.getType( "myId" ) == null );
41
    },
42
43
    testProcessSet : function() {
32
    testProcessSet : function() {
44
      var registry = org.eclipse.rwt.protocol.AdapterRegistry;
33
      var registry = org.eclipse.rwt.protocol.AdapterRegistry;
45
      var processor = org.eclipse.rwt.protocol.Processor;
34
      var processor = org.eclipse.rwt.protocol.Processor;
(-)js/org/eclipse/rwt/test/tests/WidgetTest.js (+19 lines)
Lines 534-539 Link Here
534
      assertFalse( button.getFocused() );
534
      assertFalse( button.getFocused() );
535
    },
535
    },
536
536
537
    testApplyObjectId_default : function() {
538
      var button = new org.eclipse.rwt.widgets.Button( "push" );
539
      button.addToDocument();
540
541
      button.applyObjectId( "w23" );
542
543
      assertIdentical( "", button.getHtmlAttribute( "id" ) );
544
    },
545
546
    testApplyObjectId_whenActivated : function() {
547
      var button = new org.eclipse.rwt.widgets.Button( "push" );
548
      button.addToDocument();
549
550
      qx.ui.core.Widget._renderHtmlIds = true;
551
      button.applyObjectId( "w23" );
552
553
      assertEquals( "w23", button.getHtmlAttribute( "id" ) );
554
    },
555
537
    /////////
556
    /////////
538
    // Helper
557
    // Helper
539
    
558
    

Return to bug 366929