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 281909 | Differences between
and this patch

Collapse All | Expand All

(-)rap/org/eclipse/ui/forms/internal/widgets/hyperlinkkit/HyperlinkLCA.java (-9 lines)
Lines 50-64 Link Here
50
                          "org.eclipse.ui.forms.widgets.Hyperlink.onClick", //$NON-NLS-1$
50
                          "org.eclipse.ui.forms.widgets.Hyperlink.onClick", //$NON-NLS-1$
51
                          JSListenerType.ACTION );
51
                          JSListenerType.ACTION );
52
52
53
  public void createResetHandlerCalls( final String typePoolId )
54
    throws IOException
55
  {
56
  }
57
58
  public String getTypePoolId( final Widget widget ) {
59
    return null;
60
  }
61
62
  public void readData( final Widget widget ) {
53
  public void readData( final Widget widget ) {
63
    ControlLCAUtil.processSelection( widget, null, false );
54
    ControlLCAUtil.processSelection( widget, null, false );
64
    WidgetLCAUtil.processHelp( widget );
55
    WidgetLCAUtil.processHelp( widget );
(-)rap/org/eclipse/ui/forms/internal/widgets/togglehyperlinkkit/ToggleHyperlinkLCA.java (-9 lines)
Lines 89-103 Link Here
89
    writer.dispose();
89
    writer.dispose();
90
  }
90
  }
91
91
92
  public void createResetHandlerCalls( final String typePoolId )
93
    throws IOException
94
  {
95
  }
96
97
  public String getTypePoolId( final Widget widget ) {
98
    return null;
99
  }
100
101
  ////////////////
92
  ////////////////
102
  // Write changes
93
  // Write changes
103
94
(-)rap/org/eclipse/ui/forms/internal/widgets/formtextkit/FormTextLCA.java (-9 lines)
Lines 79-93 Link Here
79
    writer.dispose();
79
    writer.dispose();
80
  }
80
  }
81
81
82
  public void createResetHandlerCalls( final String typePoolId )
83
    throws IOException
84
  {
85
  }
86
87
  public String getTypePoolId( final Widget widget ) {
88
    return null;
89
  }
90
91
  ////////////////
82
  ////////////////
92
  // Write changes
83
  // Write changes
93
84
(-)src/org/eclipse/rwt/lifecycle/JSWriter_Test.java (-69 / +20 lines)
Lines 102-117 Link Here
102
    String expected
102
    String expected
103
      =   "var wm = org.eclipse.swt.WidgetManager.getInstance();"
103
      =   "var wm = org.eclipse.swt.WidgetManager.getInstance();"
104
        + "var w = wm.newWidget( \"w2\", \"w3\", true, "
104
        + "var w = wm.newWidget( \"w2\", \"w3\", true, "
105
        + getTypePoolIdHash( shell.button )
105
        + "\"qx.ui.form.Button\" );";
106
        + ", \"qx.ui.form.Button\" );";
107
    assertEquals( expected, Fixture.getAllMarkup() );
106
    assertEquals( expected, Fixture.getAllMarkup() );
108
    // ensure that the WidgetManager, once initialized, is not initialized
107
    // ensure that the WidgetManager, once initialized, is not initialized
109
    // twice
108
    // twice
110
    writer = JSWriter.getWriterFor( shell.button );
109
    writer = JSWriter.getWriterFor( shell.button );
111
    writer.newWidget( "qx.ui.form.Button" );
110
    writer.newWidget( "qx.ui.form.Button" );
112
    expected +=   "var w = wm.newWidget( \"w2\", \"w3\", true, "
111
    expected +=   "var w = wm.newWidget( \"w2\", \"w3\", true, "
113
                + getTypePoolIdHash( shell.button )
112
                +  "\"qx.ui.form.Button\" );";
114
                +  ", \"qx.ui.form.Button\" );";
115
    assertEquals( expected, Fixture.getAllMarkup() );
113
    assertEquals( expected, Fixture.getAllMarkup() );
116
    // ensure that obtaining the widget reference (var w =) is only rendered
114
    // ensure that obtaining the widget reference (var w =) is only rendered
117
    // once
115
    // once
Lines 121-131 Link Here
121
    display.dispose();
119
    display.dispose();
122
  }
120
  }
123
121
124
  private String getTypePoolId( final Widget widget ) {
125
    AbstractWidgetLCA lca = WidgetUtil.getLCA( widget );
126
    return lca.getTypePoolId( widget );
127
  }
128
129
  public void testNewWidget() throws Exception {
122
  public void testNewWidget() throws Exception {
130
    Display display = new Display();
123
    Display display = new Display();
131
    TestShell shell = new TestShell( display );
124
    TestShell shell = new TestShell( display );
Lines 134-141 Link Here
134
    String expected
127
    String expected
135
      =   "var wm = org.eclipse.swt.WidgetManager.getInstance();"
128
      =   "var wm = org.eclipse.swt.WidgetManager.getInstance();"
136
        + "var w = wm.newWidget( \"w2\", \"w3\", true, "
129
        + "var w = wm.newWidget( \"w2\", \"w3\", true, "
137
        + getTypePoolIdHash( shell.button )
130
        + "\"qx.ui.form.Button\" );";
138
        + ", \"qx.ui.form.Button\" );";
139
    assertEquals( expected, Fixture.getAllMarkup() );
131
    assertEquals( expected, Fixture.getAllMarkup() );
140
    // Ensures that the "widget reference is set"-flag is set
132
    // Ensures that the "widget reference is set"-flag is set
141
    Fixture.fakeResponseWriter();
133
    Fixture.fakeResponseWriter();
Lines 144-199 Link Here
144
    assertEquals( expected, Fixture.getAllMarkup() );
136
    assertEquals( expected, Fixture.getAllMarkup() );
145
    display.dispose();
137
    display.dispose();
146
  }
138
  }
147
  
148
  public void testNewWidgetWithTypePoolId() throws IOException {
149
    Display display = new Display();
150
    TestShell shell = new TestShell( display );
151
    Widget widget = new Widget( shell, SWT.NONE ) {
152
      public Object getAdapter( final Class adapter ) {
153
        Object result;
154
        if( adapter == ILifeCycleAdapter.class ) {
155
          result = new AbstractWidgetLCA() {
156
157
            public void preserveValues( Widget widget ) {
158
            }
159
160
            public void renderChanges( Widget widget ) throws IOException {
161
            }
162
163
            public void renderDispose( Widget widget ) throws IOException {
164
            }
165
166
            public void renderInitialization( Widget widget )
167
              throws IOException
168
            {
169
            }
170
171
            public void readData( Widget widget ) {
172
            }
173
            public String getTypePoolId( Widget widget ) {
174
              return "myWidgetPoolId";
175
            }
176
            
177
          }; 
178
        } else {
179
          result = super.getAdapter( adapter );
180
        }
181
        return result;
182
      }
183
    };
184
    JSWriter writer = JSWriter.getWriterFor( widget );
185
    writer.newWidget( "qx.ui.widget" );
186
    String expected
187
      =   "var wm = org.eclipse.swt.WidgetManager.getInstance();"
188
        + "var w = wm.newWidget( \"w2\", \"\", false, 767544711, "
189
        + "\"qx.ui.widget\" );";
190
    assertEquals( expected, Fixture.getAllMarkup() );
191
  }
192
193
  private String getTypePoolIdHash( final Widget widget ) {
194
    String id = getTypePoolId( widget );
195
    return id == null ? null : String.valueOf( id.hashCode() );
196
  }
197
139
198
  public void testNewWidgetWithParams() throws Exception {
140
  public void testNewWidgetWithParams() throws Exception {
199
    Display display = new Display();
141
    Display display = new Display();
Lines 207-214 Link Here
207
    String expected
149
    String expected
208
      =   "var wm = org.eclipse.swt.WidgetManager.getInstance();"
150
      =   "var wm = org.eclipse.swt.WidgetManager.getInstance();"
209
        + "var w = wm.newWidget( \"w2\", \"w3\", true, "
151
        + "var w = wm.newWidget( \"w2\", \"w3\", true, "
210
        + getTypePoolIdHash( shell.button )
152
        + "\"qx.ui.form.Button\", '\"abc\", [\"#ff0000\" ]' );";
211
        + ", \"qx.ui.form.Button\", '\"abc\", [\"#ff0000\" ]' );";
212
    assertEquals( expected, Fixture.getAllMarkup() );
153
    assertEquals( expected, Fixture.getAllMarkup() );
213
    // Ensures that the "widget reference is set"-flag is set
154
    // Ensures that the "widget reference is set"-flag is set
214
    Fixture.fakeResponseWriter();
155
    Fixture.fakeResponseWriter();
Lines 222-244 Link Here
222
    writer.newWidget( "TreeItem", null );
163
    writer.newWidget( "TreeItem", null );
223
    expected
164
    expected
224
      =   "var w = wm.newWidget( \"w4\", \"\", false, "
165
      =   "var w = wm.newWidget( \"w4\", \"\", false, "
225
        + getTypePoolIdHash( item )
166
        + "\"TreeItem\" );";
226
        + ", \"TreeItem\" );";
227
    assertEquals( expected, Fixture.getAllMarkup() );
167
    assertEquals( expected, Fixture.getAllMarkup() );
228
  }
168
  }
229
169
230
  public void testResetJSProperty() throws IOException {
170
  public void testResetJSProperty() throws IOException {
231
    JSWriter writer = JSWriter.getWriterForResetHandler();
171
    Display display = new Display();
172
    Shell shell = new Shell( display );
173
    JSWriter writer = JSWriter.getWriterFor( shell );
232
    Fixture.fakeResponseWriter();
174
    Fixture.fakeResponseWriter();
233
    writer.reset( "testProperty" );
175
    writer.reset( "testProperty" );
234
    assertEquals( "w.resetTestProperty();", Fixture.getAllMarkup() );
176
    String expected = "var wm = org.eclipse.swt.WidgetManager.getInstance();"
177
                      + "var w = wm.findWidgetById( \""
178
                      + WidgetUtil.getId( shell )
179
                      + "\" );w.resetTestProperty();";
180
    assertEquals( expected, Fixture.getAllMarkup() );
235
  }
181
  }
236
182
237
  public void testResetJSPropertyChain() throws IOException {
183
  public void testResetJSPropertyChain() throws IOException {
238
    JSWriter writer = JSWriter.getWriterForResetHandler();
184
    Display display = new Display();
185
    Shell shell = new Shell( display );
186
    JSWriter writer = JSWriter.getWriterFor( shell );
239
    Fixture.fakeResponseWriter();
187
    Fixture.fakeResponseWriter();
240
    writer.reset( new String[] { "labelObject", "testProperty" } );
188
    writer.reset( new String[] { "labelObject", "testProperty" } );
241
    String expected = "w.getLabelObject().resetTestProperty();";
189
    String expected = "var wm = org.eclipse.swt.WidgetManager.getInstance();"
190
                      + "var w = wm.findWidgetById( \""
191
                      + WidgetUtil.getId( shell )
192
                      + "\" );w.getLabelObject().resetTestProperty();";
242
    assertEquals( expected, Fixture.getAllMarkup() );
193
    assertEquals( expected, Fixture.getAllMarkup() );
243
  }
194
  }
244
195
(-)src/org/eclipse/rwt/lifecycle/WidgetLCAUtil_Test.java (-44 / +2 lines)
Lines 129-135 Link Here
129
    assertFalse( WidgetLCAUtil.equals( new Date[] { new Date( 3 ) }, null ) );
129
    assertFalse( WidgetLCAUtil.equals( new Date[] { new Date( 3 ) }, null ) );
130
  }
130
  }
131
131
132
  public void testEscapeText() throws Exception {
132
  public void testEscapeText() {
133
    // Empty Parameter
133
    // Empty Parameter
134
    try {
134
    try {
135
      WidgetLCAUtil.escapeText( null, true );
135
      WidgetLCAUtil.escapeText( null, true );
Lines 177-183 Link Here
177
    assertEquals( expected, WidgetLCAUtil.escapeText( "Test\\", false ) );
177
    assertEquals( expected, WidgetLCAUtil.escapeText( "Test\\", false ) );
178
  }
178
  }
179
179
180
  public void testTruncateZeros() throws Exception {
180
  public void testTruncateZeros() {
181
    assertEquals( ( char )0, "\000".charAt( 0 ) );
181
    assertEquals( ( char )0, "\000".charAt( 0 ) );
182
    assertEquals( "foo ", WidgetLCAUtil.escapeText( "foo \000 bar", false ) );
182
    assertEquals( "foo ", WidgetLCAUtil.escapeText( "foo \000 bar", false ) );
183
    assertEquals( "foo", WidgetLCAUtil.escapeText( "foo\000", false ) );
183
    assertEquals( "foo", WidgetLCAUtil.escapeText( "foo\000", false ) );
Lines 429-477 Link Here
429
    WidgetLCAUtil.writeBackground( control, red );
429
    WidgetLCAUtil.writeBackground( control, red );
430
    assertEquals( "", Fixture.getAllMarkup() );
430
    assertEquals( "", Fixture.getAllMarkup() );
431
  }
431
  }
432
  
433
  public void testResetCalls() throws IOException {
434
    Fixture.fakeResponseWriter();
435
    WidgetLCAUtil.resetBounds();
436
    String expected 
437
      = "w.resetClipWidth();w.resetClipHeight();w.setSpace( 0, 0, 0, 0 );";
438
    assertEquals( expected, Fixture.getAllMarkup() );
439
440
    Fixture.fakeResponseWriter();
441
    WidgetLCAUtil.resetMenu();
442
    expected 
443
      =   "w.resetContextMenu();w.removeEventListener( \"contextmenu\", "
444
        + "org.eclipse.swt.MenuUtil.contextMenu );";
445
    assertEquals( expected, Fixture.getAllMarkup() );
446
432
447
    Fixture.fakeResponseWriter();
448
    WidgetLCAUtil.resetToolTip();
449
    expected = "wm.setToolTip( w );";
450
    assertEquals( expected, Fixture.getAllMarkup() );
451
    
452
    Fixture.fakeResponseWriter();
453
    WidgetLCAUtil.resetFont();
454
    expected = "w.resetFont();";
455
    assertEquals( expected, Fixture.getAllMarkup() );
456
    
457
    Fixture.fakeResponseWriter();
458
    WidgetLCAUtil.resetForeground();
459
    expected 
460
      =   "w.resetTextColor();w.removeEventListener( \"appear\", "
461
        + "org.eclipse.swt.WidgetManager._onAppearSetForeground );";
462
    assertEquals( expected, Fixture.getAllMarkup() );
463
    
464
    Fixture.fakeResponseWriter();
465
    WidgetLCAUtil.resetBackground();
466
    expected = "w.resetBackgroundColor();";
467
    assertEquals( expected, Fixture.getAllMarkup() );
468
469
    Fixture.fakeResponseWriter();
470
    WidgetLCAUtil.resetEnabled();
471
    expected = "w.setEnabled( true );";
472
    assertEquals( expected, Fixture.getAllMarkup() );
473
  }
474
  
475
  public void testWriteMenu() throws IOException {
433
  public void testWriteMenu() throws IOException {
476
    Display display = new Display();
434
    Display display = new Display();
477
    Composite shell = new Shell( display , SWT.NONE );
435
    Composite shell = new Shell( display , SWT.NONE );
(-)src/org/eclipse/rwt/internal/lifecycle/PreserveWidgetsPhaseListener_Test.java (-8 / +1 lines)
Lines 116-122 Link Here
116
    Fixture.removeContext();
116
    Fixture.removeContext();
117
  }
117
  }
118
118
119
  public void testExecutionOrder() throws Exception {
119
  public void testExecutionOrder() {
120
    // Build test environment:
120
    // Build test environment:
121
    final StringBuffer log = new StringBuffer();
121
    final StringBuffer log = new StringBuffer();
122
    Fixture.fakeResponseWriter();
122
    Fixture.fakeResponseWriter();
Lines 167-179 Link Here
167
            public void renderDispose( final Widget widget ) throws IOException
167
            public void renderDispose( final Widget widget ) throws IOException
168
            {
168
            {
169
            }
169
            }
170
            public void createResetHandlerCalls( final String typePoolId ) 
171
              throws IOException
172
            {
173
            }
174
            public String getTypePoolId( final Widget widget ) {
175
              return null;
176
            }
177
          };
170
          };
178
        }
171
        }
179
        return result;
172
        return result;
(-)src/org/eclipse/swt/internal/custom/ctabfolderkit/CTabFolderLCA_Test.java (-7 lines)
Lines 65-77 Link Here
65
          }
65
          }
66
          public void renderDispose( final Widget widget ) throws IOException {
66
          public void renderDispose( final Widget widget ) throws IOException {
67
          }
67
          }
68
          public void createResetHandlerCalls( final String typePoolId )
69
            throws IOException
70
          {
71
          }
72
          public String getTypePoolId( final Widget widget ) {
73
            return null;
74
          }
75
          public void renderInitialization( final Widget widget )
68
          public void renderInitialization( final Widget widget )
76
            throws IOException
69
            throws IOException
77
          {
70
          {
(-)src/org/eclipse/swt/internal/widgets/displaykit/DisplayLCA_Test.java (-17 / +1 lines)
Lines 43-49 Link Here
43
  private final List renderInitLog = new ArrayList();
43
  private final List renderInitLog = new ArrayList();
44
  private final List renderChangesLog = new ArrayList();
44
  private final List renderChangesLog = new ArrayList();
45
  private final List renderDisposeLog = new ArrayList();
45
  private final List renderDisposeLog = new ArrayList();
46
  private final List renderDisposeHandlerRegistration = new ArrayList();
47
46
48
  private final class DisposeTestButton extends Button {
47
  private final class DisposeTestButton extends Button {
49
48
Lines 145-151 Link Here
145
    assertEquals( new Rectangle( 0, 0, 30, 70 ), display.getBounds() );
144
    assertEquals( new Rectangle( 0, 0, 30, 70 ), display.getBounds() );
146
  }
145
  }
147
  
146
  
148
  public void testRrenderChangedButDisposed() {
147
  public void testRenderChangedButDisposed() {
149
    Display display = new Display();
148
    Display display = new Display();
150
    Shell shell = new Shell( display, SWT.NONE );
149
    Shell shell = new Shell( display, SWT.NONE );
151
    final Button button = new DisposeTestButton( shell, SWT.PUSH );
150
    final Button button = new DisposeTestButton( shell, SWT.PUSH );
Lines 173-186 Link Here
173
    } );
172
    } );
174
    RWTFixture.fakeNewRequest();
173
    RWTFixture.fakeNewRequest();
175
    Fixture.fakeRequestParam( RequestParams.UIROOT, displayId );
174
    Fixture.fakeRequestParam( RequestParams.UIROOT, displayId );
176
    Fixture.fakeRequestParam( RequestParams.UIROOT, displayId );
177
    Fixture.fakeRequestParam( JSConst.EVENT_WIDGET_SELECTED, buttonId );
175
    Fixture.fakeRequestParam( JSConst.EVENT_WIDGET_SELECTED, buttonId );
178
    RWTFixture.executeLifeCycleFromServerThread( );
176
    RWTFixture.executeLifeCycleFromServerThread( );
179
    
177
    
180
    assertEquals( 0, renderInitLog.size() );
178
    assertEquals( 0, renderInitLog.size() );
181
    assertFalse( renderChangesLog.contains( button ) );
179
    assertFalse( renderChangesLog.contains( button ) );
182
    assertTrue( renderDisposeLog.contains( button ) );
180
    assertTrue( renderDisposeLog.contains( button ) );
183
    assertFalse( renderDisposeHandlerRegistration.isEmpty() );
184
181
185
    clearLogs();
182
    clearLogs();
186
    button2.addSelectionListener( new SelectionAdapter() {
183
    button2.addSelectionListener( new SelectionAdapter() {
Lines 198-204 Link Here
198
    assertEquals( 0, renderInitLog.size() );
195
    assertEquals( 0, renderInitLog.size() );
199
    assertFalse( renderChangesLog.contains( button2 ) );
196
    assertFalse( renderChangesLog.contains( button2 ) );
200
    assertTrue( renderDisposeLog.contains( button2 ) );
197
    assertTrue( renderDisposeLog.contains( button2 ) );
201
    assertFalse( renderDisposeHandlerRegistration.contains( button2 ) );
202
198
203
    clearLogs();
199
    clearLogs();
204
    button3.addSelectionListener( new SelectionAdapter() {
200
    button3.addSelectionListener( new SelectionAdapter() {
Lines 216-222 Link Here
216
    assertEquals( 0, renderInitLog.size() );
212
    assertEquals( 0, renderInitLog.size() );
217
    assertFalse( renderChangesLog.contains( button3 ) );
213
    assertFalse( renderChangesLog.contains( button3 ) );
218
    assertTrue( renderDisposeLog.contains( button3 ) );
214
    assertTrue( renderDisposeLog.contains( button3 ) );
219
    assertFalse( renderDisposeHandlerRegistration.isEmpty() );
220
  }
215
  }
221
216
222
  public void testIsInitializedState() throws IOException {
217
  public void testIsInitializedState() throws IOException {
Lines 341-356 Link Here
341
            }
336
            }
342
337
343
338
344
            public String getTypePoolId( final Widget widget ) {
345
              return getClass().getName() + "_" + widget.getStyle();
346
            }
347
348
            public void createResetHandlerCalls( final String typePoolId )
349
              throws IOException
350
            {
351
              renderDisposeHandlerRegistration.add( typePoolId );
352
            }
353
354
            public void renderDispose( final Widget widget ) throws IOException
339
            public void renderDispose( final Widget widget ) throws IOException
355
            {
340
            {
356
              renderDisposeLog.add( widget );
341
              renderDisposeLog.add( widget );
Lines 392-397 Link Here
392
    renderInitLog.clear();
377
    renderInitLog.clear();
393
    renderChangesLog.clear();
378
    renderChangesLog.clear();
394
    renderDisposeLog.clear();
379
    renderDisposeLog.clear();
395
    renderDisposeHandlerRegistration.clear();
396
  }
380
  }
397
}
381
}
(-)src/org/eclipse/swt/custom/CTabFolder.java (-4 / +5 lines)
Lines 1892-1901 Link Here
1892
1892
1893
  void onDispose() {
1893
  void onDispose() {
1894
    /*
1894
    /*
1895
     * Usually when an item is disposed, destroyItem will change the size of the items array,
1895
     * Usually when an item is disposed of, destroyItem will change the size of
1896
     * reset the bounds of all the tabs and manage the widget associated with the tab.
1896
     * the items array, reset the bounds of all the tabs and manage the widget
1897
     * Since the whole folder is being disposed, this is not necessary.  For speed
1897
     * associated with the tab. Since the whole folder is being disposed, this
1898
     * the inDispose flag is used to skip over this part of the item dispose.
1898
     * is not necessary. For speed the inDispose flag is used to skip over this
1899
     * part of the item dispose.
1899
     */
1900
     */
1900
    inDispose = true;
1901
    inDispose = true;
1901
    removeControlListener( resizeListener );
1902
    removeControlListener( resizeListener );
(-)src/org/eclipse/rwt/lifecycle/AbstractWidgetLCA.java (-6 / +6 lines)
Lines 91-107 Link Here
91
   * code has been processed the client-side widget should be in a state that is
91
   * code has been processed the client-side widget should be in a state that is
92
   * equivalent to a newly created widget.
92
   * equivalent to a newly created widget.
93
   * </p>
93
   * </p>
94
   *
95
   * <p>
94
   * <p>
96
   * Subclasses should override this method if pooling is supported by the
95
   * Subclasses should override this method if pooling is supported by the
97
   * widget type this LCA belongs to. To activate pooling override
96
   * widget type this LCA belongs to. To activate pooling override
98
   * {@link #getTypePoolId(Widget)}.
97
   * {@link #getTypePoolId(Widget)}.
99
   * </p>
98
   * </p>
100
   *
99
   * 
101
   * @see #getTypePoolId(Widget)
100
   * @see #getTypePoolId(Widget)
102
   *
103
   * @param typePoolId the type pool id of the widget to reset
101
   * @param typePoolId the type pool id of the widget to reset
104
   * @throws IOException
102
   * @throws IOException
103
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
104
   *             This method is not called anymore.
105
   */
105
   */
106
  public void createResetHandlerCalls( final String typePoolId )
106
  public void createResetHandlerCalls( final String typePoolId )
107
    throws IOException
107
    throws IOException
Lines 123-140 Link Here
123
   * suffix. If this method returns <code>null</code>, the widget will not be
123
   * suffix. If this method returns <code>null</code>, the widget will not be
124
   * stored in the widget pool and cannot be reused.
124
   * stored in the widget pool and cannot be reused.
125
   * </p>
125
   * </p>
126
   *
127
   * <p>
126
   * <p>
128
   * Subclasses may override to activate pooling. In case pooling is activated
127
   * Subclasses may override to activate pooling. In case pooling is activated
129
   * the method {@link #createResetHandlerCalls(String)} should also be
128
   * the method {@link #createResetHandlerCalls(String)} should also be
130
   * overridden.
129
   * overridden.
131
   * </p>
130
   * </p>
132
   *
131
   * 
133
   * @see #createResetHandlerCalls(String)
132
   * @see #createResetHandlerCalls(String)
134
   *
135
   * @param widget the widget to store in the pool
133
   * @param widget the widget to store in the pool
136
   * @return the type pool id or <code>null</code> if the widget should not be
134
   * @return the type pool id or <code>null</code> if the widget should not be
137
   *         pooled
135
   *         pooled
136
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
137
   *             This method is not called anymore.
138
   */
138
   */
139
  public String getTypePoolId( final Widget widget ) {
139
  public String getTypePoolId( final Widget widget ) {
140
    return null;
140
    return null;
(-)src/org/eclipse/swt/widgets/ToolBar.java (-7 / +5 lines)
Lines 84-96 Link Here
84
  public ToolBar( final Composite parent, final int style ) {
84
  public ToolBar( final Composite parent, final int style ) {
85
    super( parent, checkStyle( style ) );
85
    super( parent, checkStyle( style ) );
86
    /*
86
    /*
87
    * Ensure that either of HORIZONTAL or VERTICAL is set.
87
     * Ensure that either of HORIZONTAL or VERTICAL is set. NOTE: HORIZONTAL and
88
    * NOTE: HORIZONTAL and VERTICAL have the same values
88
     * VERTICAL have the same values as H_SCROLL and V_SCROLL so it is necessary
89
    * as H_SCROLL and V_SCROLL so it is necessary to first
89
     * to first clear these bits to avoid scroll bars and then reset the bits
90
    * clear these bits to avoid scroll bars and then reset
90
     * using the original style supplied by the programmer.
91
    * the bits using the original style supplied by the
91
     */
92
    * programmer.
93
    */
94
    if( ( style & SWT.VERTICAL ) != 0 ) {
92
    if( ( style & SWT.VERTICAL ) != 0 ) {
95
      this.style |= SWT.VERTICAL;
93
      this.style |= SWT.VERTICAL;
96
    } else {
94
    } else {
(-)src/org/eclipse/swt/internal/widgets/labelkit/LabelLCA.java (-28 / +2 lines)
Lines 11-21 Link Here
11
package org.eclipse.swt.internal.widgets.labelkit;
11
package org.eclipse.swt.internal.widgets.labelkit;
12
12
13
import java.io.IOException;
13
import java.io.IOException;
14
import java.text.MessageFormat;
15
14
16
import org.eclipse.rwt.lifecycle.AbstractWidgetLCA;
15
import org.eclipse.rwt.lifecycle.AbstractWidgetLCA;
17
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.widgets.*;
17
import org.eclipse.swt.widgets.Label;
18
import org.eclipse.swt.widgets.Widget;
19
19
20
20
21
public class LabelLCA extends AbstractWidgetLCA {
21
public class LabelLCA extends AbstractWidgetLCA {
Lines 45-76 Link Here
45
    getDelegate( widget ).renderDispose( ( Label )widget );
45
    getDelegate( widget ).renderDispose( ( Label )widget );
46
  }
46
  }
47
47
48
  public void createResetHandlerCalls( final String typePoolId ) throws IOException {
49
    getDelegate( typePoolId ).createResetHandlerCalls( typePoolId );
50
  }
51
52
  public String getTypePoolId( final Widget widget ) {
53
    // TODO [rh] disabled pooling, see bugs prefixed with [pooling]
54
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=204107
55
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=199142
56
//    return getDelegate( widget ).getTypePoolId( ( Label )widget );
57
    return null;
58
  }
59
60
  private static AbstractLabelLCADelegate getDelegate( final String tpId ) {
61
    AbstractLabelLCADelegate result;
62
    if( tpId.startsWith( SeparatorLabelLCA.TYPE_POOL_ID) ) {
63
      result = SEPARATOR_LCA;
64
    } else if( tpId.startsWith( StandardLabelLCA.TYPE_POOL_ID ) ) {
65
      result = LABEL_LCA;
66
    } else {
67
      String txt= "The typePoolId ''{0}'' is not supported.";
68
      String msg = MessageFormat.format( txt, new Object[] { tpId } );
69
      throw new IllegalArgumentException( msg );
70
    }
71
    return result;
72
  }
73
74
  private static AbstractLabelLCADelegate getDelegate( final Widget widget ) {
48
  private static AbstractLabelLCADelegate getDelegate( final Widget widget ) {
75
    AbstractLabelLCADelegate result;
49
    AbstractLabelLCADelegate result;
76
    if( ( widget.getStyle() & SWT.SEPARATOR ) != 0 ) {
50
    if( ( widget.getStyle() & SWT.SEPARATOR ) != 0 ) {
(-)src/org/eclipse/swt/internal/widgets/labelkit/AbstractLabelLCADelegate.java (-2 lines)
Lines 22-27 Link Here
22
  abstract void renderInitialization( Label label ) throws IOException;
22
  abstract void renderInitialization( Label label ) throws IOException;
23
  abstract void renderChanges( Label label ) throws IOException;
23
  abstract void renderChanges( Label label ) throws IOException;
24
  abstract void renderDispose( Label label ) throws IOException;
24
  abstract void renderDispose( Label label ) throws IOException;
25
  abstract void createResetHandlerCalls( String typePoolId ) throws IOException;
26
  abstract String getTypePoolId( Label label );
27
}
25
}
(-)src/org/eclipse/swt/internal/widgets/labelkit/SeparatorLabelLCA.java (-19 lines)
Lines 23-35 Link Here
23
23
24
  private static final String QX_TYPE = "org.eclipse.swt.widgets.Separator";
24
  private static final String QX_TYPE = "org.eclipse.swt.widgets.Separator";
25
  private static final String JS_FUNC_ADD_LINE_STYLE = "addLineStyle";
25
  private static final String JS_FUNC_ADD_LINE_STYLE = "addLineStyle";
26
  private static final String JS_FUNC_REMOVE_LINE_STYLE = "removeLineStyle";
27
  private static final String JS_FIELD_LINE_ORIENTATION = "lineOrientation";
26
  private static final String JS_FIELD_LINE_ORIENTATION = "lineOrientation";
28
  private static final Object[] PARAM_SHADOW_IN
27
  private static final Object[] PARAM_SHADOW_IN
29
    = new Object[] { JSConst.JS_STYLE_FLAG_SHADOW_IN };
28
    = new Object[] { JSConst.JS_STYLE_FLAG_SHADOW_IN };
30
  private static final Object[] PARAM_SHADOW_OUT
29
  private static final Object[] PARAM_SHADOW_OUT
31
    = new Object[] { JSConst.JS_STYLE_FLAG_SHADOW_OUT };
30
    = new Object[] { JSConst.JS_STYLE_FLAG_SHADOW_OUT };
32
  static final String TYPE_POOL_ID = SeparatorLabelLCA.class.getName();
33
31
34
  void preserveValues( final Label label ) {
32
  void preserveValues( final Label label ) {
35
    ControlLCAUtil.preserveValues( label );
33
    ControlLCAUtil.preserveValues( label );
Lines 59-74 Link Here
59
    writer.dispose();
57
    writer.dispose();
60
  }
58
  }
61
59
62
  void createResetHandlerCalls( final String typePoolId ) throws IOException {
63
    ControlLCAUtil.resetChanges();
64
    ControlLCAUtil.resetStyleFlags();
65
    resetStyle();
66
  }
67
68
  String getTypePoolId( final Label label ) {
69
    return TYPE_POOL_ID;
70
  }
71
72
  private static void writeStyle( final Label label ) throws IOException {
60
  private static void writeStyle( final Label label ) throws IOException {
73
    JSWriter writer = JSWriter.getWriterFor( label );
61
    JSWriter writer = JSWriter.getWriterFor( label );
74
    int style = label.getStyle();
62
    int style = label.getStyle();
Lines 80-90 Link Here
80
      writer.call( JS_FUNC_ADD_LINE_STYLE, PARAM_SHADOW_OUT );
68
      writer.call( JS_FUNC_ADD_LINE_STYLE, PARAM_SHADOW_OUT );
81
    }
69
    }
82
  }
70
  }
83
84
  private static void resetStyle() throws IOException {
85
    JSWriter writer = JSWriter.getWriterForResetHandler();
86
    writer.call( JS_FUNC_REMOVE_LINE_STYLE, PARAM_SHADOW_IN );
87
    writer.call( JS_FUNC_REMOVE_LINE_STYLE, PARAM_SHADOW_OUT );
88
    writer.reset( JS_FIELD_LINE_ORIENTATION );
89
  }
90
}
71
}
(-)src/org/eclipse/swt/internal/widgets/labelkit/StandardLabelLCA.java (-31 lines)
Lines 23-29 Link Here
23
public class StandardLabelLCA extends AbstractLabelLCADelegate {
23
public class StandardLabelLCA extends AbstractLabelLCADelegate {
24
24
25
  private static final String QX_TYPE = "qx.ui.basic.Atom";
25
  private static final String QX_TYPE = "qx.ui.basic.Atom";
26
  static final String TYPE_POOL_ID = StandardLabelLCA.class.getName();
27
26
28
  private static final String PROP_TEXT = "text";
27
  private static final String PROP_TEXT = "text";
29
  private static final String PROP_ALIGNMENT = "alignment";
28
  private static final String PROP_ALIGNMENT = "alignment";
Lines 77-94 Link Here
77
    writer.dispose();
76
    writer.dispose();
78
  }
77
  }
79
78
80
  void createResetHandlerCalls( final String typePoolId ) throws IOException {
81
    resetAlignment();
82
    resetText();
83
    resetImage();
84
    ControlLCAUtil.resetChanges();
85
    ControlLCAUtil.resetStyleFlags();
86
  }
87
88
  String getTypePoolId( final Label label ) {
89
    return TYPE_POOL_ID;
90
  }
91
92
  //////////////////////////////////////
79
  //////////////////////////////////////
93
  // Helping methods to write JavaScript
80
  // Helping methods to write JavaScript
94
81
Lines 103-114 Link Here
103
    }
90
    }
104
  }
91
  }
105
92
106
  private static void resetText() throws IOException {
107
    JSWriter writer = JSWriter.getWriterForResetHandler();
108
    Object[] args = new Object[]{ JSWriter.WIDGET_REF, null };
109
    writer.callStatic( JS_FUNC_LABEL_UTIL_SET_TEXT, args );
110
  }
111
112
  private static void writeImage( final Label label ) throws IOException {
93
  private static void writeImage( final Label label ) throws IOException {
113
    Image image = label.getImage();
94
    Image image = label.getImage();
114
    if( WidgetLCAUtil.hasChanged( label, Props.IMAGE, image, null ) )
95
    if( WidgetLCAUtil.hasChanged( label, Props.IMAGE, image, null ) )
Lines 126-137 Link Here
126
    }
107
    }
127
  }
108
  }
128
109
129
  private static void resetImage() throws IOException {
130
    JSWriter writer = JSWriter.getWriterForResetHandler();
131
    Object[] args = new Object[]{ JSWriter.WIDGET_REF, null };
132
    writer.callStatic( JS_FUNC_LABEL_UTIL_SET_IMAGE, args );
133
  }
134
135
  private static void writeAlignment( final Label label ) throws IOException {
110
  private static void writeAlignment( final Label label ) throws IOException {
136
    Integer alignment = new Integer( label.getAlignment() );
111
    Integer alignment = new Integer( label.getAlignment() );
137
    Integer defValue = DEFAULT_ALIGNMENT;
112
    Integer defValue = DEFAULT_ALIGNMENT;
Lines 145-156 Link Here
145
    }
120
    }
146
  }
121
  }
147
122
148
  private static void resetAlignment() throws IOException {
149
    JSWriter writer = JSWriter.getWriterForResetHandler();
150
    writer.reset( "horizontalChildrenAlign" );
151
    writer.reset( new String[] { "labelObject", "textAlign" } );
152
  }
153
154
  private static String getAlignment( final int alignment ) {
123
  private static String getAlignment( final int alignment ) {
155
    String result;
124
    String result;
156
    if( ( alignment & SWT.LEFT ) != 0 ) {
125
    if( ( alignment & SWT.LEFT ) != 0 ) {
(-)src/org/eclipse/rwt/lifecycle/WidgetLCAUtil.java (-106 / +94 lines)
Lines 41-48 Link Here
41
41
42
  private static final String JS_PROP_HEIGHT = "height";
42
  private static final String JS_PROP_HEIGHT = "height";
43
  private static final String JS_PROP_WIDTH = "width";
43
  private static final String JS_PROP_WIDTH = "width";
44
  private static final String JS_PROP_CLIP_WIDTH = "clipWidth";
45
  private static final String JS_PROP_CLIP_HEIGHT = "clipHeight";
46
  private static final String PARAM_X = "bounds.x";
44
  private static final String PARAM_X = "bounds.x";
47
  private static final String PARAM_Y = "bounds.y";
45
  private static final String PARAM_Y = "bounds.y";
48
  private static final String PARAM_WIDTH = "bounds.width";
46
  private static final String PARAM_WIDTH = "bounds.width";
Lines 446-466 Link Here
446
  }
444
  }
447
445
448
  /**
446
  /**
449
   * Writes JavaScript code to the response that resets the bounds of a widget.
450
   * This method is intended to be used by implementations of the method
451
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
452
   *
453
   * @throws IOException
454
   */
455
  public static void resetBounds() throws IOException {
456
    JSWriter writer = JSWriter.getWriterForResetHandler();
457
    writer.reset( JS_PROP_CLIP_WIDTH );
458
    writer.reset( JS_PROP_CLIP_HEIGHT );
459
    writer.set( JS_PROP_SPACE, new int[] { 0, 0, 0, 0 } );
460
  }
461
462
463
  /**
464
   * Determines whether the property <code>menu</code> of the given widget has
447
   * Determines whether the property <code>menu</code> of the given widget has
465
   * changed during the processing of the current request and if so, writes
448
   * changed during the processing of the current request and if so, writes
466
   * JavaScript code to the response that updates the client-side menu property
449
   * JavaScript code to the response that updates the client-side menu property
Lines 488-508 Link Here
488
  }
471
  }
489
472
490
  /**
473
  /**
491
   * Writes JavaScript code to the response that resets the property
492
   * <code>menu</code> of a widget. This method is intended to be used by
493
   * implementations of the method
494
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
495
   *
496
   * @throws IOException
497
   */
498
  public static void resetMenu() throws IOException {
499
    JSWriter writer = JSWriter.getWriterForResetHandler();
500
    writer.reset( JS_PROP_CONTEXT_MENU );
501
    writer.removeListener( JSConst.QX_EVENT_CONTEXTMENU,
502
                           JSConst.JS_CONTEXT_MENU );
503
  }
504
505
  /**
506
   * Determines whether the property <code>toolTip</code> of the given widget
474
   * Determines whether the property <code>toolTip</code> of the given widget
507
   * has changed during the processing of the current request and if so, writes
475
   * has changed during the processing of the current request and if so, writes
508
   * JavaScript code to the response that updates the client-side toolTip
476
   * JavaScript code to the response that updates the client-side toolTip
Lines 531-555 Link Here
531
  }
499
  }
532
500
533
  /**
501
  /**
534
   * Writes JavaScript code to the response that resets the property
535
   * <code>toolTip</code> of a widget. This method is intended to be used by
536
   * implementations of the method
537
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
538
   *
539
   * @throws IOException
540
   */
541
  public static void resetToolTip() throws IOException {
542
    JSWriter writer = JSWriter.getWriterForResetHandler();
543
    writer.call( JSWriter.WIDGET_MANAGER_REF,
544
                 JS_FUNC_SET_TOOL_TIP,
545
                 new Object[] { JSWriter.WIDGET_REF } );
546
  }
547
548
549
  /////////////////////////////////////////////////
550
  // write-methods used by other ...LCAUtil classes
551
552
  /**
553
   * Determines whether the property <code>image</code> of the given widget
502
   * Determines whether the property <code>image</code> of the given widget
554
   * has changed during the processing of the current request and if so, writes
503
   * has changed during the processing of the current request and if so, writes
555
   * JavaScript code to the response that updates the client-side image property
504
   * JavaScript code to the response that updates the client-side image property
Lines 659-677 Link Here
659
  }
608
  }
660
609
661
  /**
610
  /**
662
   * Writes JavaScript code to the response that resets the property
663
   * <code>font</code> of a widget. This method is intended to be used by
664
   * implementations of the method
665
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
666
   *
667
   * @throws IOException
668
   */
669
  public static void resetFont() throws IOException {
670
    JSWriter writer = JSWriter.getWriterForResetHandler();
671
    writer.reset( JSConst.QX_FIELD_FONT );
672
  }
673
674
  /**
675
   * Determines whether the property <code>foreground</code> of the given
611
   * Determines whether the property <code>foreground</code> of the given
676
   * widget has changed during the processing of the current request and if so,
612
   * widget has changed during the processing of the current request and if so,
677
   * writes JavaScript code to the response that updates the client-side
613
   * writes JavaScript code to the response that updates the client-side
Lines 699-719 Link Here
699
  }
635
  }
700
636
701
  /**
637
  /**
702
   * Writes JavaScript code to the response that resets the property
703
   * <code>foreground</code> of a widget. This method is intended to be used
704
   * by implementations of the method
705
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
706
   *
707
   * @throws IOException
708
   */
709
  public static void resetForeground() throws IOException {
710
    JSWriter writer = JSWriter.getWriterForResetHandler();
711
    writer.reset( "textColor" );
712
    String listener = "org.eclipse.swt.WidgetManager._onAppearSetForeground";
713
    writer.removeListener( "appear", listener );
714
  }
715
716
  /**
717
   * Determines whether the property <code>background</code> of the given
638
   * Determines whether the property <code>background</code> of the given
718
   * widget has changed during the processing of the current request and if so,
639
   * widget has changed during the processing of the current request and if so,
719
   * writes JavaScript code to the response that updates the client-side
640
   * writes JavaScript code to the response that updates the client-side
Lines 774-792 Link Here
774
  }
695
  }
775
696
776
  /**
697
  /**
777
   * Writes JavaScript code to the response that reset the property
778
   * <code>background</code> of a widget. This method is intended to be used
779
   * by implementations of the method
780
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
781
   *
782
   * @throws IOException
783
   */
784
  public static void resetBackground() throws IOException {
785
    JSWriter writer = JSWriter.getWriterForResetHandler();
786
    writer.reset( JSConst.QX_FIELD_BG_COLOR );
787
  }
788
789
  /**
790
   * Determines whether the background gradient properties of the
698
   * Determines whether the background gradient properties of the
791
   * given widget has changed during the processing of the current request and
699
   * given widget has changed during the processing of the current request and
792
   * if so, writes JavaScript code to the response that updates the client-side
700
   * if so, writes JavaScript code to the response that updates the client-side
Lines 908-927 Link Here
908
816
909
817
910
  /**
818
  /**
911
   * Writes JavaScript code to the response that resets the property
912
   * <code>enabled</code> of a widget. This method is intended to be used by
913
   * implementations of the method
914
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
915
   *
916
   * @throws IOException
917
   */
918
  public static void resetEnabled() throws IOException {
919
    JSWriter writer = JSWriter.getWriterForResetHandler();
920
    // TODO [fappel]: check whether to use reset
921
    writer.set( JSConst.QX_FIELD_ENABLED, true );
922
  }
923
924
  /**
925
   * Replaces all newline characters in the specified input string with the
819
   * Replaces all newline characters in the specified input string with the
926
   * given replacement string.
820
   * given replacement string.
927
   *
821
   *
Lines 1178-1181 Link Here
1178
    }
1072
    }
1179
    return result;
1073
    return result;
1180
  }
1074
  }
1075
1076
1077
  /////////////////////////////////////
1078
  // deprecated pooling-related methods
1079
1080
  /**
1081
   * Writes JavaScript code to the response that resets the bounds of a widget.
1082
   * This method is intended to be used by implementations of the method
1083
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1084
   *
1085
   * @throws IOException
1086
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1087
   *             This method does nothing.
1088
   */
1089
  public static void resetBounds() throws IOException {
1090
  }
1091
1092
  /**
1093
   * Writes JavaScript code to the response that resets the property
1094
   * <code>menu</code> of a widget. This method is intended to be used by
1095
   * implementations of the method
1096
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1097
   *
1098
   * @throws IOException
1099
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1100
   *             This method does nothing.
1101
   */
1102
  public static void resetMenu() throws IOException {
1103
  }
1104
1105
  /**
1106
   * Writes JavaScript code to the response that resets the property
1107
   * <code>toolTip</code> of a widget. This method is intended to be used by
1108
   * implementations of the method
1109
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1110
   * 
1111
   * @throws IOException
1112
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1113
   *             This method does nothing.
1114
   */
1115
  public static void resetToolTip() throws IOException {
1116
  }
1117
1118
  /**
1119
   * Writes JavaScript code to the response that resets the property
1120
   * <code>font</code> of a widget. This method is intended to be used by
1121
   * implementations of the method
1122
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1123
   *
1124
   * @throws IOException
1125
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1126
   *             This method does nothing.
1127
   */
1128
  public static void resetFont() throws IOException {
1129
  }
1130
1131
  /**
1132
   * Writes JavaScript code to the response that resets the property
1133
   * <code>foreground</code> of a widget. This method is intended to be used
1134
   * by implementations of the method
1135
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1136
   *
1137
   * @throws IOException
1138
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1139
   *             This method does nothing.
1140
   */
1141
  public static void resetForeground() throws IOException {
1142
  }
1143
1144
  /**
1145
   * Writes JavaScript code to the response that reset the property
1146
   * <code>background</code> of a widget. This method is intended to be used
1147
   * by implementations of the method
1148
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1149
   *
1150
   * @throws IOException
1151
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1152
   *             This method does nothing.
1153
   */
1154
  public static void resetBackground() throws IOException {
1155
  }
1156
1157
  /**
1158
   * Writes JavaScript code to the response that resets the property
1159
   * <code>enabled</code> of a widget. This method is intended to be used by
1160
   * implementations of the method
1161
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1162
   *
1163
   * @throws IOException
1164
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1165
   *             This method does nothing.
1166
   */
1167
  public static void resetEnabled() throws IOException {
1168
  }
1181
}
1169
}
(-)src/org/eclipse/rwt/lifecycle/JSWriter.java (-19 / +6 lines)
Lines 103-113 Link Here
103
  }
103
  }
104
104
105
  /**
105
  /**
106
   * Returns the {@link JSWriter} instance used to reset
106
   * Returns the {@link JSWriter} instance used to reset a widgets attributes in
107
   * a widgets attributes in order to take part in the
107
   * order to take part in the pooling mechanism.
108
   * pooling mechanism.
108
   * 
109
   *
110
   * @return the {@link JSWriter} instance
109
   * @return the {@link JSWriter} instance
110
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
111
   *             This method should not be used anymore.
111
   */
112
   */
112
  public static JSWriter getWriterForResetHandler() {
113
  public static JSWriter getWriterForResetHandler() {
113
    return new JSWriter( null );
114
    return new JSWriter( null );
Lines 148-154 Link Here
148
    throws IOException
149
    throws IOException
149
  {
150
  {
150
    ensureWidgetManager();
151
    ensureWidgetManager();
151
    String typePoolId = getTypePoolId( widget );
152
    StringBuffer buffer = new StringBuffer();
152
    StringBuffer buffer = new StringBuffer();
153
    buffer.append( "var w = wm.newWidget( \"" );
153
    buffer.append( "var w = wm.newWidget( \"" );
154
    buffer.append( WidgetUtil.getId( widget ) );
154
    buffer.append( WidgetUtil.getId( widget ) );
Lines 156-165 Link Here
156
    buffer.append( getJSParentId( widget ) );
156
    buffer.append( getJSParentId( widget ) );
157
    buffer.append( "\", " );
157
    buffer.append( "\", " );
158
    buffer.append( useSetParent() );
158
    buffer.append( useSetParent() );
159
    buffer.append( ", " );
160
    Integer poolIdHashCode
161
      = typePoolId == null ? null : new Integer( typePoolId.hashCode() );
162
    buffer.append( poolIdHashCode );
163
    buffer.append( ", \"" );
159
    buffer.append( ", \"" );
164
    buffer.append( className );
160
    buffer.append( className );
165
    buffer.append( "\"" );
161
    buffer.append( "\"" );
Lines 656-668 Link Here
656
652
657
  /**
653
  /**
658
   * Dispose is used to dispose of the widget of this {@link JSWriter} on the
654
   * Dispose is used to dispose of the widget of this {@link JSWriter} on the
659
   * client side. As todays browser have several memory issues this will only
655
   * client side.
660
   * dispose of the widget if there are no pooling informations available.
661
   *
656
   *
662
   * @throws IOException if an I/O error occurs
657
   * @throws IOException if an I/O error occurs
663
   *
664
   * @see AbstractWidgetLCA#getTypePoolId(Widget)
665
   * @see AbstractWidgetLCA#createResetHandlerCalls(String)
666
   */
658
   */
667
  public void dispose() throws IOException {
659
  public void dispose() throws IOException {
668
    ensureWidgetManager();
660
    ensureWidgetManager();
Lines 753-763 Link Here
753
           : Boolean.FALSE;
745
           : Boolean.FALSE;
754
  }
746
  }
755
747
756
  private String getTypePoolId( final Widget widget ) {
757
    AbstractWidgetLCA lca = WidgetUtil.getLCA( widget );
758
    return lca.getTypePoolId( widget );
759
  }
760
761
  private String getJSParentId( final Widget widget ) {
748
  private String getJSParentId( final Widget widget ) {
762
    String result = "";
749
    String result = "";
763
    if( !( widget instanceof Shell ) && widget instanceof Control ) {
750
    if( !( widget instanceof Shell ) && widget instanceof Control ) {
(-)src/org/eclipse/rwt/lifecycle/ControlLCAUtil.java (-216 / +184 lines)
Lines 42-53 Link Here
42
 */
42
 */
43
public class ControlLCAUtil {
43
public class ControlLCAUtil {
44
44
45
  private static final Object[] PARAM_STYLE_BORDER
46
    = new Object[] { JSConst.JS_STYLE_FLAG_BORDER };
47
48
  private static final Object[] PARAM_STYLE_FLAT
49
    = new Object[] { JSConst.JS_STYLE_FLAG_FLAT };
50
51
  private static final JSListenerInfo FOCUS_GAINED_LISTENER_INFO
45
  private static final JSListenerInfo FOCUS_GAINED_LISTENER_INFO
52
    = new JSListenerInfo( "focusin",
46
    = new JSListenerInfo( "focusin",
53
                          "org.eclipse.swt.EventUtil.focusGained",
47
                          "org.eclipse.swt.EventUtil.focusGained",
Lines 196-212 Link Here
196
  }
190
  }
197
191
198
  /**
192
  /**
199
   * Writes JavaScript code to the response that resets the bounds of a control.
200
   * This method is intended to be used by implementations of the method
201
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
202
   *
203
   * @throws IOException
204
   */
205
  public static void resetBounds() throws IOException {
206
    WidgetLCAUtil.resetBounds();
207
  }
208
209
  /**
210
   * Determines whether the z-index of the given control has changed during the
193
   * Determines whether the z-index of the given control has changed during the
211
   * processing of the current request and if so, writes JavaScript code to the
194
   * processing of the current request and if so, writes JavaScript code to the
212
   * response that updates the client-side z-index.
195
   * response that updates the client-side z-index.
Lines 225-242 Link Here
225
  }
208
  }
226
209
227
  /**
210
  /**
228
   * Writes JavaScript code to the response that resets the z-index property of
229
   * a control. This method is intended to be used by implementations of the
230
   * method {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
231
   *
232
   * @throws IOException
233
   */
234
  public static void resetZIndex() throws IOException {
235
    JSWriter writer = JSWriter.getWriterForResetHandler();
236
    writer.reset( JSConst.QX_FIELD_Z_INDEX );
237
  }
238
239
  /**
240
   * Determines whether the visibility of the given control has changed during
211
   * Determines whether the visibility of the given control has changed during
241
   * the processing of the current request and if so, writes JavaScript code to
212
   * the processing of the current request and if so, writes JavaScript code to
242
   * the response that updates the client-side visibility.
213
   * the response that updates the client-side visibility.
Lines 260-279 Link Here
260
  }
231
  }
261
232
262
  /**
233
  /**
263
   * Writes JavaScript code to the response that resets the property
264
   * <code>visible</code> of a control. This method is intended to be used by
265
   * implementations of the method
266
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
267
   *
268
   * @throws IOException
269
   */
270
  public static void resetVisible() throws IOException {
271
    JSWriter writer = JSWriter.getWriterForResetHandler();
272
    // TODO [fappel]: check whether to use reset
273
    writer.set( JSConst.QX_FIELD_VISIBLE, true );
274
  }
275
276
  /**
277
   * Determines whether the property <code>enabled</code> of the given control
234
   * Determines whether the property <code>enabled</code> of the given control
278
   * has changed during the processing of the current request and if so, writes
235
   * has changed during the processing of the current request and if so, writes
279
   * JavaScript code to the response that updates the client-side enabled
236
   * JavaScript code to the response that updates the client-side enabled
Lines 291-308 Link Here
291
  }
248
  }
292
249
293
  /**
250
  /**
294
   * Writes JavaScript code to the response that resets the property
295
   * <code>enabled</code> of a control. This method is intended to be used by
296
   * implementations of the method
297
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
298
   *
299
   * @throws IOException
300
   */
301
  public static void resetEnabled() throws IOException {
302
    WidgetLCAUtil.resetEnabled();
303
  }
304
305
  /**
306
   * Determines for all of the following properties of the specified control
251
   * Determines for all of the following properties of the specified control
307
   * whether the property has changed during the processing of the current
252
   * whether the property has changed during the processing of the current
308
   * request and if so, writes JavaScript code to the response that updates the
253
   * request and if so, writes JavaScript code to the response that updates the
Lines 359-403 Link Here
359
  }
304
  }
360
305
361
  /**
306
  /**
362
   * Writes JavaScript code to the response that resets the following properties
363
   * of a control.
364
   * <ul>
365
   * <li>bounds</li>
366
   * <li>z-index (except for Shells)</li>
367
   * <li>tab index</li>
368
   * <li>tool tip text</li>
369
   * <li>menu</li>
370
   * <li>visible</li>
371
   * <li>enabled</li>
372
   * <li>foreground</li>
373
   * <li>background</li>
374
   * <li>font</li>
375
   * <!--li>whether ControlListeners are registered</li>
376
   * <li>whether ActivateListeners are registered</li>
377
   * <li>whether FocusListeners are registered</li-->
378
   * </ul>
379
   * This method is intended to be used by implementations of the method
380
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
381
   *
382
   * @throws IOException
383
   */
384
  public static void resetChanges() throws IOException {
385
    resetFocusListener();
386
    // resetting Activation Listener is automatically done by JSWriter#dispose
387
    // TODO [rst] What about resetting Control- and FocusListener? document this
388
    resetMenu();
389
    resetToolTip();
390
    resetFont();
391
    resetBackground();
392
    resetForeground();
393
    resetEnabled();
394
    resetVisible();
395
    resetTabIndex();
396
    resetZIndex();
397
    resetBounds();
398
  }
399
400
  /**
401
   * Writes JavaScript code to the response that adds client-side resize
307
   * Writes JavaScript code to the response that adds client-side resize
402
   * listeners to a control. These listeners send notifications when the control
308
   * listeners to a control. These listeners send notifications when the control
403
   * is resized.
309
   * is resized.
Lines 417-438 Link Here
417
  }
323
  }
418
324
419
  /**
325
  /**
420
   * Writes JavaScript code to the response that removes the client-side resize
421
   * notification listeners from a control.
422
   *
423
   * @throws IOException
424
   */
425
  public static void resetResizeNotificator()
426
    throws IOException
427
  {
428
    JSWriter writer = JSWriter.getWriterForResetHandler();
429
    writer.removeListener( JSConst.QX_EVENT_CHANGE_WIDTH,
430
                           JSConst.JS_WIDGET_RESIZED );
431
    writer.removeListener( JSConst.QX_EVENT_CHANGE_HEIGHT,
432
                           JSConst.JS_WIDGET_RESIZED );
433
  }
434
435
  /**
436
   * Writes JavaScript code to the response that adds client-side move listeners
326
   * Writes JavaScript code to the response that adds client-side move listeners
437
   * to a control. These listeners send notifications when the control is moved.
327
   * to a control. These listeners send notifications when the control is moved.
438
   * @param control the control to add move notification listeners to
328
   * @param control the control to add move notification listeners to
Lines 451-472 Link Here
451
  }
341
  }
452
342
453
  /**
343
  /**
454
   * Writes JavaScript code to the response that removes the client-side move
455
   * notification listeners from a control.
456
   *
457
   * @throws IOException
458
   */
459
  public static void resetMoveNotificator()
460
    throws IOException
461
  {
462
    JSWriter writer = JSWriter.getWriterForResetHandler();
463
    writer.removeListener( JSConst.QX_EVENT_CHANGE_LOCATION_X,
464
                           JSConst.JS_WIDGET_MOVED );
465
    writer.removeListener( JSConst.QX_EVENT_CHANGE_LOCATION_Y,
466
                           JSConst.JS_WIDGET_MOVED );
467
  }
468
469
  /**
470
   * Determines whether the property <code>menu</code> of the given control
344
   * Determines whether the property <code>menu</code> of the given control
471
   * has changed during the processing of the current request and if so, writes
345
   * has changed during the processing of the current request and if so, writes
472
   * JavaScript code to the response that updates the client-side menu
346
   * JavaScript code to the response that updates the client-side menu
Lines 480-497 Link Here
480
  }
354
  }
481
355
482
  /**
356
  /**
483
   * Writes JavaScript code to the response that resets the property
484
   * <code>menu</code> of a control. This method is intended to be used by
485
   * implementations of the method
486
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
487
   *
488
   * @throws IOException
489
   */
490
  public static void resetMenu() throws IOException {
491
    WidgetLCAUtil.resetMenu();
492
  }
493
494
  /**
495
   * Determines whether the tool tip of the given control has changed during the
357
   * Determines whether the tool tip of the given control has changed during the
496
   * processing of the current request and if so, writes JavaScript code to the
358
   * processing of the current request and if so, writes JavaScript code to the
497
   * response that updates the client-side tool tip.
359
   * response that updates the client-side tool tip.
Lines 506-522 Link Here
506
  }
368
  }
507
369
508
  /**
370
  /**
509
   * Writes JavaScript code to the response that resets the tool tip of a
510
   * control. This method is intended to be used by implementations of the
511
   * method {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
512
   *
513
   * @throws IOException
514
   */
515
  public static void resetToolTip() throws IOException {
516
    WidgetLCAUtil.resetToolTip();
517
  }
518
519
  /**
520
   * Determines whether the property <code>foreground</code> of the given
371
   * Determines whether the property <code>foreground</code> of the given
521
   * control has changed during the processing of the current request and if so,
372
   * control has changed during the processing of the current request and if so,
522
   * writes JavaScript code to the response that updates the client-side
373
   * writes JavaScript code to the response that updates the client-side
Lines 535-552 Link Here
535
  }
386
  }
536
387
537
  /**
388
  /**
538
   * Writes JavaScript code to the response that resets the property
539
   * <code>foreground</code> of a control. This method is intended to be used
540
   * by implementations of the method
541
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
542
   *
543
   * @throws IOException
544
   */
545
  public static void resetForeground() throws IOException {
546
    WidgetLCAUtil.resetForeground();
547
  }
548
549
  /**
550
   * Determines whether the property <code>background</code> of the given
389
   * Determines whether the property <code>background</code> of the given
551
   * control has changed during the processing of the current request and if so,
390
   * control has changed during the processing of the current request and if so,
552
   * writes JavaScript code to the response that updates the client-side
391
   * writes JavaScript code to the response that updates the client-side
Lines 606-623 Link Here
606
  }
445
  }
607
446
608
  /**
447
  /**
609
   * Writes JavaScript code to the response that resets the property
610
   * <code>background</code> of a control. This method is intended to be used
611
   * by implementations of the method
612
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
613
   *
614
   * @throws IOException
615
   */
616
  public static void resetBackground() throws IOException {
617
    WidgetLCAUtil.resetBackground();
618
  }
619
620
  /**
621
   * Checks the given control for common SWT style flags (e.g.
448
   * Checks the given control for common SWT style flags (e.g.
622
   * <code>SWT.BORDER</code>) and if present, writes code to pass the according
449
   * <code>SWT.BORDER</code>) and if present, writes code to pass the according
623
   * states to the client.
450
   * states to the client.
Lines 632-650 Link Here
632
  }
459
  }
633
460
634
  /**
461
  /**
635
   * Writes JavaScript code to the response that resets the style flags.
636
   * <p>This method is intended to be used by implementations of the method
637
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.</p>
638
   *
639
   * @throws IOException
640
   */
641
  public static void resetStyleFlags() throws IOException {
642
    JSWriter writer = JSWriter.getWriterForResetHandler();
643
    writer.call( JSConst.QX_FUNC_REMOVE_STATE, PARAM_STYLE_BORDER );
644
    writer.call( JSConst.QX_FUNC_REMOVE_STATE, PARAM_STYLE_FLAT );
645
  }
646
647
  /**
648
   * Determines whether the property <code>font</code> of the given control
462
   * Determines whether the property <code>font</code> of the given control
649
   * has changed during the processing of the current request and if so, writes
463
   * has changed during the processing of the current request and if so, writes
650
   * JavaScript code to the response that updates the client-side font property.
464
   * JavaScript code to the response that updates the client-side font property.
Lines 659-676 Link Here
659
    WidgetLCAUtil.writeFont( control, newValue );
473
    WidgetLCAUtil.writeFont( control, newValue );
660
  }
474
  }
661
475
662
  /**
663
   * Writes JavaScript code to the response that resets the property
664
   * <code>font</code> of a control. This method is intended to be used by
665
   * implementations of the method
666
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
667
   *
668
   * @throws IOException
669
   */
670
  public static void resetFont() throws IOException {
671
    WidgetLCAUtil.resetFont();
672
  }
673
674
  static void writeCursor( final Control control ) throws IOException {
476
  static void writeCursor( final Control control ) throws IOException {
675
    Cursor newValue = control.getCursor();
477
    Cursor newValue = control.getCursor();
676
    if( WidgetLCAUtil.hasChanged( control, PROP_CURSOR, newValue, null ) ) {
478
    if( WidgetLCAUtil.hasChanged( control, PROP_CURSOR, newValue, null ) ) {
Lines 684-694 Link Here
684
    }
486
    }
685
  }
487
  }
686
488
687
  static void resetCursor() throws IOException {
688
    JSWriter writer = JSWriter.getWriterForResetHandler();
689
    writer.reset( JSConst.QX_FIELD_CURSOR );
690
  }
691
692
  public static void writeActivateListener( final Control control )
489
  public static void writeActivateListener( final Control control )
693
    throws IOException
490
    throws IOException
694
  {
491
  {
Lines 745-758 Link Here
745
    }
542
    }
746
  }
543
  }
747
544
748
  private static void resetFocusListener() throws IOException {
749
    JSWriter writer = JSWriter.getWriterForResetHandler();
750
    writer.removeListener( FOCUS_GAINED_LISTENER_INFO.getEventType(),
751
                           FOCUS_GAINED_LISTENER_INFO.getJSListener() );
752
    writer.removeListener( FOCUS_LOST_LISTENER_INFO.getEventType(),
753
                           FOCUS_LOST_LISTENER_INFO.getJSListener() );
754
  }
755
756
  private static void writeMouseListener( final Control control )
545
  private static void writeMouseListener( final Control control )
757
    throws IOException
546
    throws IOException
758
  {
547
  {
Lines 898-908 Link Here
898
    }
687
    }
899
  }
688
  }
900
689
901
  private static void resetTabIndex() throws IOException {
902
    JSWriter writer = JSWriter.getWriterForResetHandler();
903
    writer.reset( JSConst.QX_FIELD_TAB_INDEX );
904
  }
905
906
  /**
690
  /**
907
   * Recursively computes the tab indices for all child controls of a given
691
   * Recursively computes the tab indices for all child controls of a given
908
   * composite and stores the resulting values in the control adapters.
692
   * composite and stores the resulting values in the control adapters.
Lines 1359-1362 Link Here
1359
    }
1143
    }
1360
    return result;
1144
    return result;
1361
  }
1145
  }
1146
1147
1148
  /////////////////////////////////////
1149
  // deprecated pooling-related methods
1150
1151
  /**
1152
   * Writes JavaScript code to the response that resets the bounds of a control.
1153
   * This method is intended to be used by implementations of the method
1154
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1155
   *
1156
   * @throws IOException
1157
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1158
   *             This method does nothing.
1159
   */
1160
  public static void resetBounds() throws IOException {
1161
  }
1162
1163
  /**
1164
   * Writes JavaScript code to the response that resets the z-index property of
1165
   * a control. This method is intended to be used by implementations of the
1166
   * method {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1167
   *
1168
   * @throws IOException
1169
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1170
   *             This method does nothing.
1171
   */
1172
  public static void resetZIndex() throws IOException {
1173
  }
1174
1175
  /**
1176
   * Writes JavaScript code to the response that resets the property
1177
   * <code>visible</code> of a control. This method is intended to be used by
1178
   * implementations of the method
1179
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1180
   *
1181
   * @throws IOException
1182
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1183
   *             This method does nothing.
1184
   */
1185
  public static void resetVisible() throws IOException {
1186
  }
1187
1188
  /**
1189
   * Writes JavaScript code to the response that resets the property
1190
   * <code>enabled</code> of a control. This method is intended to be used by
1191
   * implementations of the method
1192
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1193
   *
1194
   * @throws IOException
1195
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1196
   *             This method does nothing.
1197
   */
1198
  public static void resetEnabled() throws IOException {
1199
  }
1200
1201
  /**
1202
   * Writes JavaScript code to the response that resets the following properties
1203
   * of a control.
1204
   * <ul>
1205
   * <li>bounds</li>
1206
   * <li>z-index (except for Shells)</li>
1207
   * <li>tab index</li>
1208
   * <li>tool tip text</li>
1209
   * <li>menu</li>
1210
   * <li>visible</li>
1211
   * <li>enabled</li>
1212
   * <li>foreground</li>
1213
   * <li>background</li>
1214
   * <li>font</li>
1215
   * <!--li>whether ControlListeners are registered</li>
1216
   * <li>whether ActivateListeners are registered</li>
1217
   * <li>whether FocusListeners are registered</li-->
1218
   * </ul>
1219
   * This method is intended to be used by implementations of the method
1220
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1221
   *
1222
   * @throws IOException
1223
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1224
   *             This method does nothing.
1225
   */
1226
  public static void resetChanges() throws IOException {
1227
  }
1228
1229
  /**
1230
   * Writes JavaScript code to the response that removes the client-side resize
1231
   * notification listeners from a control.
1232
   *
1233
   * @throws IOException
1234
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1235
   *             This method does nothing.
1236
   */
1237
  public static void resetResizeNotificator()
1238
    throws IOException
1239
  {
1240
  }
1241
1242
  /**
1243
   * Writes JavaScript code to the response that removes the client-side move
1244
   * notification listeners from a control.
1245
   *
1246
   * @throws IOException
1247
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1248
   *             This method does nothing.
1249
   */
1250
  public static void resetMoveNotificator()
1251
    throws IOException
1252
  {
1253
  }
1254
1255
  /**
1256
   * Writes JavaScript code to the response that resets the property
1257
   * <code>menu</code> of a control. This method is intended to be used by
1258
   * implementations of the method
1259
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1260
   *
1261
   * @throws IOException
1262
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1263
   *             This method does nothing.
1264
   */
1265
  public static void resetMenu() throws IOException {
1266
  }
1267
1268
  /**
1269
   * Writes JavaScript code to the response that resets the tool tip of a
1270
   * control. This method is intended to be used by implementations of the
1271
   * method {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1272
   *
1273
   * @throws IOException
1274
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1275
   *             This method does nothing.
1276
   */
1277
  public static void resetToolTip() throws IOException {
1278
  }
1279
1280
  /**
1281
   * Writes JavaScript code to the response that resets the property
1282
   * <code>foreground</code> of a control. This method is intended to be used
1283
   * by implementations of the method
1284
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1285
   *
1286
   * @throws IOException
1287
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1288
   *             This method does nothing.
1289
   */
1290
  public static void resetForeground() throws IOException {
1291
  }
1292
1293
  /**
1294
   * Writes JavaScript code to the response that resets the property
1295
   * <code>background</code> of a control. This method is intended to be used
1296
   * by implementations of the method
1297
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1298
   *
1299
   * @throws IOException
1300
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1301
   *             This method does nothing.
1302
   */
1303
  public static void resetBackground() throws IOException {
1304
  }
1305
1306
  /**
1307
   * Writes JavaScript code to the response that resets the style flags.
1308
   * <p>This method is intended to be used by implementations of the method
1309
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.</p>
1310
   *
1311
   * @throws IOException
1312
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1313
   *             This method does nothing.
1314
   */
1315
  public static void resetStyleFlags() throws IOException {
1316
  }
1317
1318
  /**
1319
   * Writes JavaScript code to the response that resets the property
1320
   * <code>font</code> of a control. This method is intended to be used by
1321
   * implementations of the method
1322
   * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}.
1323
   *
1324
   * @throws IOException
1325
   * @deprecated As of 1.3, server-side widget pooling is no longer required.
1326
   *             This method does nothing.
1327
   */
1328
  public static void resetFont() throws IOException {
1329
  }
1362
}
1330
}
(-)src/org/eclipse/swt/internal/widgets/buttonkit/PushButtonDelegateLCA.java (-9 lines)
Lines 20-27 Link Here
20
20
21
final class PushButtonDelegateLCA extends ButtonDelegateLCA {
21
final class PushButtonDelegateLCA extends ButtonDelegateLCA {
22
22
23
  static final String TYPE_POOL_ID
24
    = PushButtonDelegateLCA.class.getName();
25
  private static final String QX_TYPE = "org.eclipse.rwt.widgets.Button";
23
  private static final String QX_TYPE = "org.eclipse.rwt.widgets.Button";
26
24
27
  private static final Object[] PARAM_PUSH = new Object[] { "push" };
25
  private static final Object[] PARAM_PUSH = new Object[] { "push" };
Lines 59-69 Link Here
59
    JSWriter writer = JSWriter.getWriterFor( button );
57
    JSWriter writer = JSWriter.getWriterFor( button );
60
    writer.dispose();
58
    writer.dispose();
61
  }
59
  }
62
63
  String getTypePoolId( final Button button ) {
64
    return null;
65
  }
66
67
  void createResetHandlerCalls( final String typePoolId ) throws IOException {
68
  }
69
}
60
}
(-)src/org/eclipse/swt/internal/widgets/buttonkit/ButtonDelegateLCA.java (-2 lines)
Lines 20-25 Link Here
20
  abstract void renderInitialization( Button button ) throws IOException;
20
  abstract void renderInitialization( Button button ) throws IOException;
21
  abstract void renderChanges( Button button ) throws IOException;
21
  abstract void renderChanges( Button button ) throws IOException;
22
  abstract void renderDispose( Button button ) throws IOException;
22
  abstract void renderDispose( Button button ) throws IOException;
23
  abstract void createResetHandlerCalls( String typePoolId ) throws IOException;
24
  abstract String getTypePoolId( Button widget );
25
}
23
}
(-)src/org/eclipse/swt/internal/widgets/buttonkit/ButtonLCA.java (-27 lines)
Lines 12-18 Link Here
12
package org.eclipse.swt.internal.widgets.buttonkit;
12
package org.eclipse.swt.internal.widgets.buttonkit;
13
13
14
import java.io.IOException;
14
import java.io.IOException;
15
import java.text.MessageFormat;
16
15
17
import org.eclipse.rwt.lifecycle.AbstractWidgetLCA;
16
import org.eclipse.rwt.lifecycle.AbstractWidgetLCA;
18
import org.eclipse.rwt.lifecycle.JSWriter;
17
import org.eclipse.rwt.lifecycle.JSWriter;
Lines 53-84 Link Here
53
    getLCADelegate( widget ).renderDispose( ( Button )widget );
52
    getLCADelegate( widget ).renderDispose( ( Button )widget );
54
  }
53
  }
55
54
56
  public void createResetHandlerCalls( final String typePoolId ) 
57
    throws IOException 
58
  {
59
    getLCADelegate( typePoolId ).createResetHandlerCalls( typePoolId );
60
  }
61
62
  public String getTypePoolId( final Widget widget ) {
63
    return getLCADelegate( widget ).getTypePoolId( ( Button )widget );
64
  }
65
66
  private static ButtonDelegateLCA getLCADelegate( final String tpId ) {
67
    ButtonDelegateLCA result;
68
    if( tpId.startsWith( CheckButtonDelegateLCA.TYPE_POOL_ID ) ) {
69
      result = CHECK;
70
    } else if( tpId.startsWith( PushButtonDelegateLCA.TYPE_POOL_ID ) ) {
71
      result = PUSH;
72
    } else if( tpId.startsWith( RadioButtonDelegateLCA.TYPE_POOL_ID ) ) {
73
      result = RADIO;
74
    } else {
75
      String txt= "The typePoolId ''{0}'' is not supported.";
76
      String msg = MessageFormat.format( txt, new Object[] { tpId } );
77
      throw new IllegalArgumentException( msg );
78
    }
79
    return result;
80
  }
81
82
  private static ButtonDelegateLCA getLCADelegate( final Widget widget ) {
55
  private static ButtonDelegateLCA getLCADelegate( final Widget widget ) {
83
    ButtonDelegateLCA result;
56
    ButtonDelegateLCA result;
84
    int style = ( ( Button )widget ).getStyle();
57
    int style = ( ( Button )widget ).getStyle();
(-)src/org/eclipse/swt/internal/widgets/buttonkit/CheckButtonDelegateLCA.java (-16 lines)
Lines 20-27 Link Here
20
20
21
final class CheckButtonDelegateLCA extends ButtonDelegateLCA {
21
final class CheckButtonDelegateLCA extends ButtonDelegateLCA {
22
22
23
  static final String TYPE_POOL_ID
24
    = CheckButtonDelegateLCA.class.getName();
25
  private static final String QX_TYPE = "org.eclipse.rwt.widgets.Button";
23
  private static final String QX_TYPE = "org.eclipse.rwt.widgets.Button";
26
  private static final Object[] PARAM_CHECK = new Object[] { "check" };
24
  private static final Object[] PARAM_CHECK = new Object[] { "check" };
27
25
Lines 63-82 Link Here
63
    writer.dispose();
61
    writer.dispose();
64
  }
62
  }
65
63
66
  String getTypePoolId( final Button button ) {
67
    // Disabled pooling, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=226099
68
//    return TYPE_POOL_ID;
69
    return null;
70
  }
71
72
  void createResetHandlerCalls( final String typePoolId ) throws IOException {
73
    ButtonLCAUtil.resetAlignment();
74
    ButtonLCAUtil.resetText();
75
    ButtonLCAUtil.resetSelection();
76
    ControlLCAUtil.resetChanges();
77
    ControlLCAUtil.resetStyleFlags();
78
  }
79
80
  private static void writeGrayed( final Button button ) throws IOException {
64
  private static void writeGrayed( final Button button ) throws IOException {
81
    Boolean newValue = Boolean.valueOf( button.getGrayed() );
65
    Boolean newValue = Boolean.valueOf( button.getGrayed() );
82
    String prop = PROP_GRAYED;
66
    String prop = PROP_GRAYED;
(-)src/org/eclipse/swt/internal/widgets/buttonkit/RadioButtonDelegateLCA.java (-21 lines)
Lines 22-29 Link Here
22
22
23
final class RadioButtonDelegateLCA extends ButtonDelegateLCA {
23
final class RadioButtonDelegateLCA extends ButtonDelegateLCA {
24
24
25
  static final String TYPE_POOL_ID
26
    = RadioButtonDelegateLCA.class.getName();
27
  private static final String QX_TYPE = "org.eclipse.rwt.widgets.Button";  
25
  private static final String QX_TYPE = "org.eclipse.rwt.widgets.Button";  
28
  private static final Object[] PARAM_RADIO = new Object[] { "radio" };
26
  private static final Object[] PARAM_RADIO = new Object[] { "radio" };
29
27
Lines 60-84 Link Here
60
    writer.dispose();
58
    writer.dispose();
61
  }
59
  }
62
     
60
     
63
  String getTypePoolId( final Button button ) {
64
//    return TYPE_POOL_ID;
65
    return null;
66
  }
67
68
  void createResetHandlerCalls( final String typePoolId ) throws IOException {
69
// TODO [fappel]: check why removal of listener doesn't work. Seems as if
70
//                manager is removed already (maybe dispose call?)...
71
//    JSWriter writer = JSWriter.getWriterForResetHandler();
72
//    writer.removeListener( JS_PROP_MANAGER,
73
//                           JS_LISTENER_INFO.getEventType(),
74
//                           JS_LISTENER_INFO.getJSListener() );
75
    ButtonLCAUtil.resetAlignment();
76
    ButtonLCAUtil.resetText();
77
    ButtonLCAUtil.resetSelection();
78
    ControlLCAUtil.resetChanges();
79
    ControlLCAUtil.resetStyleFlags();
80
  }
81
82
  private static void processSelectionEvent( final Button button ) {
61
  private static void processSelectionEvent( final Button button ) {
83
    if( SelectionEvent.hasListener( button ) ) {
62
    if( SelectionEvent.hasListener( button ) ) {
84
      int type = SelectionEvent.WIDGET_SELECTED;
63
      int type = SelectionEvent.WIDGET_SELECTED;
(-)src/org/eclipse/swt/internal/widgets/buttonkit/ButtonLCAUtil.java (-21 lines)
Lines 76-87 Link Here
76
    }
76
    }
77
  }
77
  }
78
78
79
  static void resetText() throws IOException {
80
    JSWriter writer = JSWriter.getWriterForResetHandler();
81
    // Note [fappel]: reset doesn't work, so use setting to empty string
82
    writer.set( "text", new Object[]{ null } );
83
  }
84
85
  static void writeImage( final Button button ) throws IOException {
79
  static void writeImage( final Button button ) throws IOException {
86
    Image image = button.getImage();
80
    Image image = button.getImage();
87
    if( WidgetLCAUtil.hasChanged( button, Props.IMAGE, image, null ) ) {
81
    if( WidgetLCAUtil.hasChanged( button, Props.IMAGE, image, null ) ) {
Lines 97-107 Link Here
97
    }
91
    }
98
  }
92
  }
99
93
100
  static void resetImage() throws IOException {
101
    JSWriter writer = JSWriter.getWriterForResetHandler();
102
    writer.set( "image", new Object[]{ null } );
103
  }
104
105
  static void writeAlignment( final Button button ) throws IOException {
94
  static void writeAlignment( final Button button ) throws IOException {
106
    if( ( button.getStyle() & SWT.ARROW ) == 0 ) {
95
    if( ( button.getStyle() & SWT.ARROW ) == 0 ) {
107
      Integer newValue = new Integer( button.getAlignment() );
96
      Integer newValue = new Integer( button.getAlignment() );
Lines 129-150 Link Here
129
    }
118
    }
130
  }
119
  }
131
120
132
  static void resetAlignment() throws IOException {
133
    JSWriter writer = JSWriter.getWriterForResetHandler();
134
    writer.reset( JS_PROP_HORIZONTAL_CHILDREN_ALIGN );
135
  }
136
137
  static void writeSelection( final Button button ) throws IOException {
121
  static void writeSelection( final Button button ) throws IOException {
138
    Boolean newValue = Boolean.valueOf( button.getSelection() );
122
    Boolean newValue = Boolean.valueOf( button.getSelection() );
139
    JSWriter writer = JSWriter.getWriterFor( button );
123
    JSWriter writer = JSWriter.getWriterFor( button );
140
    writer.set( PROP_SELECTION, JS_PROP_SELECTION, newValue, Boolean.FALSE );
124
    writer.set( PROP_SELECTION, JS_PROP_SELECTION, newValue, Boolean.FALSE );
141
  }
125
  }
142
126
143
  static void resetSelection() throws IOException {
144
    JSWriter writer = JSWriter.getWriterForResetHandler();
145
    writer.set( JS_PROP_SELECTION, Boolean.FALSE );
146
  }
147
148
  // TODO [rst] Can this be moved to ShellLCA ?
127
  // TODO [rst] Can this be moved to ShellLCA ?
149
  static void writeDefault( final Button button ) throws IOException {
128
  static void writeDefault( final Button button ) throws IOException {
150
    boolean isDefault = isDefaultButton( button );
129
    boolean isDefault = isDefaultButton( button );
(-)js/org/eclipse/swt/LabelUtil.js (-35 / +23 lines)
Lines 24-54 Link Here
24
    initialize : function( widget ) {
24
    initialize : function( widget ) {
25
25
26
      widget.setHorizontalChildrenAlign( qx.constant.Layout.ALIGN_LEFT );
26
      widget.setHorizontalChildrenAlign( qx.constant.Layout.ALIGN_LEFT );
27
      if( !widget.getUserData( "pooled" ) ) {
27
      widget.setVerticalChildrenAlign( qx.constant.Layout.ALIGN_TOP );
28
        widget.setVerticalChildrenAlign( qx.constant.Layout.ALIGN_TOP );
28
      widget.setAppearance( org.eclipse.swt.LabelUtil.APPEARANCE );
29
        widget.setAppearance( org.eclipse.swt.LabelUtil.APPEARANCE );
29
      widget.setOverflow( qx.constant.Style.OVERFLOW_HIDDEN );
30
        widget.setOverflow( qx.constant.Style.OVERFLOW_HIDDEN );
30
      // TODO [rh] workaround for weird getLabelObject behaviour
31
        // TODO [rh] workaround for weird getLabelObject behaviour
31
      widget.setLabel( "(empty)" );
32
        widget.setLabel( "(empty)" );
32
      // end workaround
33
        // end workaround
33
      var labelObject = widget.getLabelObject();
34
        var labelObject = widget.getLabelObject();
34
      labelObject.setMode( qx.constant.Style.LABEL_MODE_HTML );
35
        labelObject.setMode( qx.constant.Style.LABEL_MODE_HTML );
35
      labelObject.setTextOverflow( false );
36
        labelObject.setTextOverflow( false );
36
      labelObject.setAppearance( "label-graytext" );
37
        labelObject.setAppearance( "label-graytext" );
37
      // TODO [rh] workaround for weird getLabelObject behaviour
38
        // TODO [rh] workaround for weird getLabelObject behaviour
38
      widget.setLabel( "" );
39
        widget.setLabel( "" );
39
      // end workaround
40
        // end workaround
40
      widget.setHideFocus( true );
41
        widget.setHideFocus( true );
41
      // track DOM insertion state
42
        // track DOM insertion state
42
      widget.addEventListener( "beforeRemoveDom",
43
        widget.addEventListener( "beforeRemoveDom",
43
                               org.eclipse.swt.LabelUtil._onRemoveDom );
44
                                 org.eclipse.swt.LabelUtil._onRemoveDom );
44
      widget.addEventListener( "insertDom",
45
        widget.addEventListener( "insertDom",
45
                               org.eclipse.swt.LabelUtil._onInsertDom );
46
                                 org.eclipse.swt.LabelUtil._onInsertDom );
46
      widget.addEventListener( "mouseover",
47
        widget.addEventListener( "mouseover",
47
                               org.eclipse.swt.LabelUtil._onMouseOver );
48
                                 org.eclipse.swt.LabelUtil._onMouseOver );
48
      widget.addEventListener( "mouseout",
49
        widget.addEventListener( "mouseout",
49
                               org.eclipse.swt.LabelUtil._onMouseOut );
50
                                 org.eclipse.swt.LabelUtil._onMouseOut );
51
      }
52
    },
50
    },
53
    
51
    
54
    _onRemoveDom : function( evt ) {
52
    _onRemoveDom : function( evt ) {
Lines 75-86 Link Here
75
        widget.setUserData( "setText", text );
73
        widget.setUserData( "setText", text );
76
        widget.addEventListener( "appear",
74
        widget.addEventListener( "appear",
77
                                 org.eclipse.swt.LabelUtil._setTextDelayed );
75
                                 org.eclipse.swt.LabelUtil._setTextDelayed );
78
      }
79
      // workaround for pooling problems
80
      else if( !widget._isInDOM && widget.getUserData( "pooled" ) ) {
81
        widget.setUserData( "setText", text );
82
        widget.addEventListener( "insertDom",
83
                                 org.eclipse.swt.LabelUtil._setTextDelayed );
84
      } else {
76
      } else {
85
        org.eclipse.swt.LabelUtil._doSetText( widget, text );
77
        org.eclipse.swt.LabelUtil._doSetText( widget, text );
86
      }
78
      }
Lines 91-100 Link Here
91
        widget.setUserData( "setImage", imagePath );
83
        widget.setUserData( "setImage", imagePath );
92
        widget.addEventListener( "appear",
84
        widget.addEventListener( "appear",
93
                                 org.eclipse.swt.LabelUtil._setImageDelayed );
85
                                 org.eclipse.swt.LabelUtil._setImageDelayed );
94
      } else if( !widget._isInDOM && widget.getUserData( "pooled" ) ) {
95
        widget.setUserData( "setImage", imagePath );
96
        widget.addEventListener( "insertDom",
97
                                 org.eclipse.swt.LabelUtil._setImageDelayed );
98
      } else {
86
      } else {
99
        org.eclipse.swt.LabelUtil._doSetImage( widget, imagePath );
87
        org.eclipse.swt.LabelUtil._doSetImage( widget, imagePath );
100
      }
88
      }
(-)js/org/eclipse/swt/WidgetManager.js (-82 / +9 lines)
Lines 24-31 Link Here
24
    // Key: id (string), value: widget instanace (qx.ui.core.Widget)
24
    // Key: id (string), value: widget instanace (qx.ui.core.Widget)
25
    this._map = {};
25
    this._map = {};
26
    
26
    
27
    // initialize widget pool
28
    this._widgetPool = new Object();
29
    // this field is needed as Opera has some problems with
27
    // this field is needed as Opera has some problems with
30
    // accessing local variables in eval expressions.
28
    // accessing local variables in eval expressions.
31
    this._current = null;
29
    this._current = null;
Lines 52-60 Link Here
52
     * removed from this WidgetManager (see remove).
50
     * removed from this WidgetManager (see remove).
53
     * No action is taken if there is no widget registered for the given id or 
51
     * No action is taken if there is no widget registered for the given id or 
54
     * the widget was already disposed of.
52
     * the widget was already disposed of.
55
     * In case of a widget type that supports pooling the widget is disconnected
56
     * from its parent, its 'disposeHandler' that reinitializes the widget is
57
     * called and it's added to the pool to be ready for reuse.
58
     */
53
     */
59
    dispose : function( id ) {
54
    dispose : function( id ) {
60
      var widget = this.findWidgetById( id );
55
      var widget = this.findWidgetById( id );
Lines 67-150 Link Here
67
          if( parent && parent.getChildren() ) {
62
          if( parent && parent.getChildren() ) {
68
            widget.setParent( null );
63
            widget.setParent( null );
69
          }
64
          }
70
          // handle widgets that can be pooled
65
          // [if] Replace dispose() with destroy()
71
          var typePoolId = widget.getUserData( "typePoolId" );
66
          widget.destroy();
72
          if( typePoolId != null ) {
73
            var typePool = this._widgetPool[ typePoolId ];
74
            typePool.resetHandler( widget );
75
            widget.setUserData( "pooled", true );
76
            // EXPERIMENTAL: If the widget has a reset method, call it
77
            if( widget.rap_reset ) {
78
              widget.rap_reset();
79
            }
80
            typePool.elements.push( widget );
81
          // dispose of widgets that cannot be pooled
82
          } else {
83
            // [if] Replace dispose() with destroy()
84
          	widget.destroy();
85
          }
86
        }
67
        }
87
      }
68
      }
88
    },
69
    },
89
90
    registerResetHandler : function( typePoolId, resetHandler ) {
91
      this._createWidgetPool( typePoolId, resetHandler );
92
    },
93
    
70
    
94
    newWidget : function( widgetId,
71
    newWidget : function( widgetId, parentId, isControl, type, paramList ) {
95
                          parentId,
96
                          isControl,
97
                          typePoolId,
98
                          type,
99
                          paramList )
100
    {
101
      // Note [fappel]: Do not remove the 'wm' declaration. This is needed
72
      // Note [fappel]: Do not remove the 'wm' declaration. This is needed
102
      //                for IE if the 'newExpression' has a reference to
73
      //                for IE if the 'newExpression' has a reference to
103
      //                the variable defined in the script from the server.
74
      //                the variable defined in the script from the server.
104
      // TODO [fappel]: Think about improvement of the hardcoded expression... 
75
      // TODO [fappel]: Think about improvement of the hardcoded expression... 
105
      var wm = this;
76
      var wm = this;
106
      
77
      
107
      var result = null;
78
      var newExpression;
108
      // if the widget type supports pooling get a widget from the pool -
79
      if( paramList != null ) {
109
      // if available...
80
        newExpression = "new " + type + "(" + paramList + ");";
110
      if( typePoolId != null && this._widgetPool[ typePoolId ] ) {
81
      } else {
111
        var typePool = this._widgetPool[ typePoolId ];
82
        newExpression = "new " + type + "();";
112
        result = typePool.elements.pop();
113
        if( result ) {
114
          if( paramList != null ) {
115
            // If paramList isn't empty we have to reinitialize the widget.
116
            // Luckily only our own js widgets use this...
117
            var expression =   "org.eclipse.swt.WidgetManager.getInstance()."
118
                             + "_current.reInit("
119
                             + paramList
120
                             + ");";
121
            // Assignment of the field _current is needed as Opera has some 
122
            // problems with accessing local variables in eval expressions.
123
            this._current = result;
124
            window.eval( expression );
125
            this._current = null;
126
          }
127
          // EXPERIMENTAL: If the widget has an init method, call it
128
          if( result.rap_init ) {
129
            result.rap_init();
130
          }
131
        }
132
//        this.debug( "_____ recycled: " + result );
133
      }
134
      
135
      // ... otherwise create a new one
136
      if( result == null ) {
137
        var newExpression;
138
        if( paramList != null ) {
139
          newExpression = "new " + type + "(" + paramList + ");";
140
        } else {
141
          newExpression = "new " + type + "();";
142
        }
143
        result = window.eval( newExpression );
144
        result.setUserData( "typePoolId", typePoolId );
145
        result.setUserData( "pooled", false );
146
//        this.debug( "_____ created: " + result );
147
      }
83
      }
84
      var result = window.eval( newExpression );
148
      
85
      
149
      // map the widget to the server side widgetId
86
      // map the widget to the server side widgetId
150
      if( result.classname == "org.eclipse.swt.widgets.Shell" ) {
87
      if( result.classname == "org.eclipse.swt.widgets.Shell" ) {
Lines 249-264 Link Here
249
      }
186
      }
250
    },
187
    },
251
188
252
    /**
253
     * Creates a new caching pool for widgets with the given pooling id.
254
     */
255
    _createWidgetPool : function( typePoolId, resetHandler ) {
256
      var typePool = new Object();
257
      typePool.elements = new Array();
258
      typePool.resetHandler = resetHandler;
259
      this._widgetPool[ typePoolId ] = typePool;        
260
    },
261
262
    ////////////////
189
    ////////////////
263
    // Font handling
190
    // Font handling
264
191
(-)js/org/eclipse/swt/TextUtil.js (-1 / +1 lines)
Lines 76-82 Link Here
76
     * Sets the selected text range of the given text widget.
76
     * Sets the selected text range of the given text widget.
77
     */
77
     */
78
    setSelection : function( text, start, length ) {
78
    setSelection : function( text, start, length ) {
79
      if( text.isCreated() && !text.getUserData( "pooled" ) ) {
79
      if( text.isCreated() ) {
80
        org.eclipse.swt.TextUtil._doSetSelection( text, start, length );
80
        org.eclipse.swt.TextUtil._doSetSelection( text, start, length );
81
      } else {
81
      } else {
82
        text.setUserData( "onAppear.selectionStart", start );
82
        text.setUserData( "onAppear.selectionStart", start );
(-)src/org/eclipse/swt/internal/widgets/treecolumnkit/TreeColumnLCA.java (-8 lines)
Lines 119-132 Link Here
119
    writer.dispose();
119
    writer.dispose();
120
  }
120
  }
121
121
122
  public void createResetHandlerCalls( final String typePoolId ) throws IOException {
123
  }
124
125
  public String getTypePoolId( final Widget widget ) {
126
    return null;
127
  }
128
129
130
  //////////////////////////////////////////
122
  //////////////////////////////////////////
131
  // Helping method to write JavaScript code
123
  // Helping method to write JavaScript code
132
124
(-)src/org/eclipse/swt/internal/widgets/tableitemkit/TableItemLCA.java (-10 lines)
Lines 126-141 Link Here
126
    }
126
    }
127
  }
127
  }
128
128
129
  public void createResetHandlerCalls( final String typePoolId )
130
    throws IOException
131
  {
132
  }
133
134
  public String getTypePoolId( final Widget widget ) {
135
    return null;
136
  }
137
138
139
  //////////////////
129
  //////////////////
140
  // ReadData helper
130
  // ReadData helper
141
131
(-)src/org/eclipse/swt/internal/widgets/treekit/TreeLCA.java (-9 lines)
Lines 99-113 Link Here
99
    writer.dispose();
99
    writer.dispose();
100
  }
100
  }
101
101
102
  public void createResetHandlerCalls( final String typePoolId )
103
    throws IOException
104
  {
105
  }
106
107
  public String getTypePoolId( final Widget widget ) {
108
    return null;
109
  }
110
111
  public void doRedrawFake( final Control control ) {
102
  public void doRedrawFake( final Control control ) {
112
    int evtId = ControlEvent.CONTROL_RESIZED;
103
    int evtId = ControlEvent.CONTROL_RESIZED;
113
    ControlEvent evt = new ControlEvent( control, evtId );
104
    ControlEvent evt = new ControlEvent( control, evtId );
(-)src/org/eclipse/swt/internal/widgets/coolitemkit/CoolItemLCA.java (-8 lines)
Lines 91-104 Link Here
91
    writer.dispose();
91
    writer.dispose();
92
  }
92
  }
93
93
94
  public void createResetHandlerCalls( final String typePoolId ) throws IOException {
95
  }
96
97
  public String getTypePoolId( final Widget widget ) {
98
    return null;
99
  }
100
101
102
  //////////////////
94
  //////////////////
103
  // Helping methods
95
  // Helping methods
104
96
(-)src/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java (-27 lines)
Lines 116-137 Link Here
116
    }
116
    }
117
  }
117
  }
118
118
119
  static void resetText() throws IOException {
120
    JSWriter writer = JSWriter.getWriterForResetHandler();
121
    writer.reset( JS_PROP_VALUE );
122
  }
123
124
  static void writeReadOnly( final Text text ) throws IOException {
119
  static void writeReadOnly( final Text text ) throws IOException {
125
    JSWriter writer = JSWriter.getWriterFor( text );
120
    JSWriter writer = JSWriter.getWriterFor( text );
126
    Boolean newValue = Boolean.valueOf( !text.getEditable() );
121
    Boolean newValue = Boolean.valueOf( !text.getEditable() );
127
    writer.set( PROP_READONLY, JS_PROP_READ_ONLY, newValue, Boolean.FALSE );
122
    writer.set( PROP_READONLY, JS_PROP_READ_ONLY, newValue, Boolean.FALSE );
128
  }
123
  }
129
124
130
  static void resetReadOnly() throws IOException {
131
    JSWriter writer = JSWriter.getWriterForResetHandler();
132
    writer.reset( JS_PROP_READ_ONLY );
133
  }
134
135
  static void writeTextLimit( final Text text ) throws IOException {
125
  static void writeTextLimit( final Text text ) throws IOException {
136
    JSWriter writer = JSWriter.getWriterFor( text );
126
    JSWriter writer = JSWriter.getWriterFor( text );
137
    Integer newValue = new Integer( text.getTextLimit() );
127
    Integer newValue = new Integer( text.getTextLimit() );
Lines 147-157 Link Here
147
    }
137
    }
148
  }
138
  }
149
139
150
  static void resetTextLimit() throws IOException {
151
    JSWriter writer = JSWriter.getWriterForResetHandler();
152
    writer.reset( JS_PROP_MAX_LENGTH );
153
  }
154
155
  static void writeWrap( final Text text ) throws IOException {
140
  static void writeWrap( final Text text ) throws IOException {
156
    JSWriter writer = JSWriter.getWriterFor( text );
141
    JSWriter writer = JSWriter.getWriterFor( text );
157
    Boolean value = Boolean.valueOf( ( text.getStyle() & SWT.WRAP ) != 0 );
142
    Boolean value = Boolean.valueOf( ( text.getStyle() & SWT.WRAP ) != 0 );
Lines 177-186 Link Here
177
    }
162
    }
178
  }
163
  }
179
164
180
  static void resetSelection() {
181
    // POOLING Implement if pooling is reactivated
182
  }
183
184
  static void writeAlignment( final Text text ) throws IOException {
165
  static void writeAlignment( final Text text ) throws IOException {
185
    int style = text.getStyle();
166
    int style = text.getStyle();
186
    if( ( style & SWT.RIGHT ) != 0 ) {
167
    if( ( style & SWT.RIGHT ) != 0 ) {
Lines 207-216 Link Here
207
    }
188
    }
208
  }
189
  }
209
190
210
  static void resetSelectionListener() {
211
    // POOLING Implement if pooling is reactivated
212
  }
213
214
  static void preserveVerifyAndModifyListener( final Text text ) {
191
  static void preserveVerifyAndModifyListener( final Text text ) {
215
    IWidgetAdapter adapter = WidgetUtil.getAdapter( text );
192
    IWidgetAdapter adapter = WidgetUtil.getAdapter( text );
216
    adapter.preserve( PROP_VERIFY_MODIFY_LISTENER,
193
    adapter.preserve( PROP_VERIFY_MODIFY_LISTENER,
Lines 231-240 Link Here
231
    }
208
    }
232
  }
209
  }
233
210
234
  static void resetVerifyAndModifyListener() {
235
    // POOLING Implement if pooling is reactivated
236
  }
237
238
  private static boolean hasSelectionListener( final Text text ) {
211
  private static boolean hasSelectionListener( final Text text ) {
239
    // Emulate SWT (on Windows) where a default button takes precedence over
212
    // Emulate SWT (on Windows) where a default button takes precedence over
240
    // a SelectionListener on a text field when both are on the same shell.
213
    // a SelectionListener on a text field when both are on the same shell.
(-)src/org/eclipse/swt/internal/widgets/textkit/TextLCA.java (-28 lines)
Lines 11-17 Link Here
11
package org.eclipse.swt.internal.widgets.textkit;
11
package org.eclipse.swt.internal.widgets.textkit;
12
12
13
import java.io.IOException;
13
import java.io.IOException;
14
import java.text.MessageFormat;
15
14
16
import org.eclipse.rwt.lifecycle.AbstractWidgetLCA;
15
import org.eclipse.rwt.lifecycle.AbstractWidgetLCA;
17
import org.eclipse.rwt.lifecycle.JSWriter;
16
import org.eclipse.rwt.lifecycle.JSWriter;
Lines 49-81 Link Here
49
    writer.dispose();
48
    writer.dispose();
50
  }
49
  }
51
50
52
  public void createResetHandlerCalls( final String typePoolId ) throws IOException {
53
    getLCADelegate( typePoolId ).createResetHandlerCalls( typePoolId );
54
  }
55
56
  public String getTypePoolId( final Widget widget ) {
57
//    return getLCADelegate( widget ).getTypePoolId( ( Text )widget );
58
    // Disabled pooling, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=218466
59
    // [Pooling] Text widgets occasionally don't accept keyboard entries
60
    return null;
61
  }
62
63
  private static AbstractTextDelegateLCA getLCADelegate( final String tpId ) {
64
    AbstractTextDelegateLCA result;
65
    if( PasswordTextLCA.TYPE_POOL_ID.equals( tpId ) ) {
66
      result = PASSWORD;
67
    } else if( SingleTextLCA.TYPE_POOL_ID.equals( tpId ) ) {
68
      result = SINGLE;
69
    } else if( MultiTextLCA.TYPE_POOL_ID.equals( tpId ) ) {
70
      result = MULTI;
71
    } else {
72
      String txt= "The typePoolId ''{0}'' is not supported.";
73
      String msg = MessageFormat.format( txt, new Object[] { tpId } );
74
      throw new IllegalArgumentException( msg );
75
    }
76
    return result;
77
  }
78
79
  private static AbstractTextDelegateLCA getLCADelegate( final Widget widget ) {
51
  private static AbstractTextDelegateLCA getLCADelegate( final Widget widget ) {
80
    AbstractTextDelegateLCA result;
52
    AbstractTextDelegateLCA result;
81
    int style = ( ( Text )widget ).getStyle();
53
    int style = ( ( Text )widget ).getStyle();
(-)src/org/eclipse/swt/internal/widgets/textkit/AbstractTextDelegateLCA.java (-2 lines)
Lines 20-25 Link Here
20
  abstract void renderInitialization( Text text ) throws IOException;
20
  abstract void renderInitialization( Text text ) throws IOException;
21
  abstract void renderChanges( Text text ) throws IOException;
21
  abstract void renderChanges( Text text ) throws IOException;
22
  abstract void renderDispose( Text text ) throws IOException;
22
  abstract void renderDispose( Text text ) throws IOException;
23
  abstract void createResetHandlerCalls( String typePoolId ) throws IOException;
24
  abstract String getTypePoolId( Text text );
25
}
23
}
(-)src/org/eclipse/swt/internal/widgets/textkit/SingleTextLCA.java (-16 lines)
Lines 18-25 Link Here
18
18
19
final class SingleTextLCA extends AbstractTextDelegateLCA {
19
final class SingleTextLCA extends AbstractTextDelegateLCA {
20
20
21
  static final String TYPE_POOL_ID = SingleTextLCA.class.getName();
22
23
  void preserveValues( final Text text ) {
21
  void preserveValues( final Text text ) {
24
    ControlLCAUtil.preserveValues( text );
22
    ControlLCAUtil.preserveValues( text );
25
    TextLCAUtil.preserveValues( text );
23
    TextLCAUtil.preserveValues( text );
Lines 65-82 Link Here
65
    writer.dispose();
63
    writer.dispose();
66
  }
64
  }
67
65
68
  String getTypePoolId( final Text text ) {
69
    return TYPE_POOL_ID;
70
  }
71
72
  void createResetHandlerCalls( final String typePoolId ) throws IOException {
73
    TextLCAUtil.resetSelection();
74
    TextLCAUtil.resetVerifyAndModifyListener();
75
    TextLCAUtil.resetSelectionListener();
76
    TextLCAUtil.resetTextLimit();
77
    TextLCAUtil.resetReadOnly();
78
    TextLCAUtil.resetText();
79
    ControlLCAUtil.resetChanges();
80
    ControlLCAUtil.resetStyleFlags();
81
  }
82
}
66
}
(-)src/org/eclipse/swt/internal/widgets/textkit/MultiTextLCA.java (-14 lines)
Lines 19-26 Link Here
19
19
20
final class MultiTextLCA extends AbstractTextDelegateLCA {
20
final class MultiTextLCA extends AbstractTextDelegateLCA {
21
21
22
  static final String TYPE_POOL_ID = MultiTextLCA.class.getName();
23
24
  void preserveValues( final Text text ) {
22
  void preserveValues( final Text text ) {
25
    ControlLCAUtil.preserveValues( text );
23
    ControlLCAUtil.preserveValues( text );
26
    TextLCAUtil.preserveValues( text );
24
    TextLCAUtil.preserveValues( text );
Lines 65-80 Link Here
65
    writer.dispose();
63
    writer.dispose();
66
  }
64
  }
67
65
68
  String getTypePoolId( final Text text ) {
69
    return TYPE_POOL_ID;
70
  }
71
72
  void createResetHandlerCalls( final String typePoolId ) throws IOException {
73
    TextLCAUtil.resetVerifyAndModifyListener();
74
    TextLCAUtil.resetTextLimit();
75
    TextLCAUtil.resetReadOnly();
76
    TextLCAUtil.resetText();
77
    ControlLCAUtil.resetChanges();
78
    ControlLCAUtil.resetStyleFlags();
79
  }
80
}
66
}
(-)src/org/eclipse/swt/internal/widgets/textkit/PasswordTextLCA.java (-16 lines)
Lines 17-24 Link Here
17
17
18
final class PasswordTextLCA extends AbstractTextDelegateLCA {
18
final class PasswordTextLCA extends AbstractTextDelegateLCA {
19
19
20
  static final String TYPE_POOL_ID = PasswordTextLCA.class.getName();
21
22
  void preserveValues( final Text text ) {
20
  void preserveValues( final Text text ) {
23
    ControlLCAUtil.preserveValues( text );
21
    ControlLCAUtil.preserveValues( text );
24
    TextLCAUtil.preserveValues( text );
22
    TextLCAUtil.preserveValues( text );
Lines 62-79 Link Here
62
    writer.dispose();
60
    writer.dispose();
63
  }
61
  }
64
62
65
  String getTypePoolId( final Text text ) {
66
    return TYPE_POOL_ID;
67
  }
68
69
  void createResetHandlerCalls( final String typePoolId ) throws IOException {
70
    TextLCAUtil.resetVerifyAndModifyListener();
71
    TextLCAUtil.resetSelectionListener();
72
    TextLCAUtil.resetSelection();
73
    TextLCAUtil.resetTextLimit();
74
    TextLCAUtil.resetReadOnly();
75
    TextLCAUtil.resetText();
76
    ControlLCAUtil.resetChanges();
77
    ControlLCAUtil.resetStyleFlags();
78
  }
79
}
63
}
(-)src/org/eclipse/swt/internal/custom/ctabfolderkit/CTabFolderLCA.java (-17 lines)
Lines 208-220 Link Here
208
    writer.dispose();
208
    writer.dispose();
209
  }
209
  }
210
210
211
  public void createResetHandlerCalls( final String typePoolId ) throws IOException {
212
  }
213
214
  public String getTypePoolId( final Widget widget ) {
215
    return null;
216
  }
217
218
  public Rectangle adjustCoordinates( final Widget widget,
211
  public Rectangle adjustCoordinates( final Widget widget,
219
                                      final Rectangle bounds )
212
                                      final Rectangle bounds )
220
  {
213
  {
Lines 231-246 Link Here
231
    return result;
224
    return result;
232
  }
225
  }
233
226
234
//  public Rectangle adjustCoordinates( final Rectangle bounds ) {
235
//    int border = 1;
236
//    int hTabBar = 23;
237
//    return new Rectangle( bounds.x - border - 10,
238
//                          bounds.y - hTabBar - border -10,
239
//                          bounds.width,
240
//                          bounds.height );
241
//  }
242
243
244
  //////////////////////////////////////
227
  //////////////////////////////////////
245
  // Helping methods to write properties
228
  // Helping methods to write properties
246
229
(-)src/org/eclipse/swt/internal/widgets/shellkit/ShellLCA.java (-23 lines)
Lines 32-38 Link Here
32
public final class ShellLCA extends AbstractWidgetLCA {
32
public final class ShellLCA extends AbstractWidgetLCA {
33
33
34
  private static final String QX_TYPE = "org.eclipse.swt.widgets.Shell";
34
  private static final String QX_TYPE = "org.eclipse.swt.widgets.Shell";
35
//  private static final String TYPE_POOL_ID = ShellLCA.class.getName();
36
35
37
  private static final String PROP_TEXT = "text";
36
  private static final String PROP_TEXT = "text";
38
  private static final String PROP_IMAGE = "image";
37
  private static final String PROP_IMAGE = "image";
Lines 134-161 Link Here
134
    writer.dispose();
133
    writer.dispose();
135
  }
134
  }
136
135
137
  public void createResetHandlerCalls( final String typePoolId )
138
    throws IOException
139
  {
140
    JSWriter writer = JSWriter.getWriterForResetHandler();
141
    writer.call( "removeState", new Object[]{ "rwt_TITLE" } );
142
    // TODO [rst] If this is ever being reactivated, all Shell style-flag states
143
    //            must be removed
144
    writer.set( "parentShell", ( Object )null );
145
    ControlLCAUtil.resetStyleFlags();
146
    ControlLCAUtil.resetResizeNotificator();
147
    ControlLCAUtil.resetMoveNotificator();
148
    // TODO [rh] reset close listener when shell pooling is activated
149
    ControlLCAUtil.resetBounds();
150
    ControlLCAUtil.resetZIndex();
151
    ControlLCAUtil.resetToolTip();
152
  }
153
154
  public String getTypePoolId( final Widget widget ) {
155
//    return TYPE_POOL_ID;
156
    return null;
157
  }
158
159
  //////////////////
136
  //////////////////
160
  // Helping methods
137
  // Helping methods
161
138
(-)src/org/eclipse/swt/internal/widgets/listkit/ListLCA.java (-11 lines)
Lines 90-106 Link Here
90
    writer.dispose();
90
    writer.dispose();
91
  }
91
  }
92
92
93
  public void createResetHandlerCalls( final String typePoolId )
94
    throws IOException
95
  {
96
    ControlLCAUtil.resetStyleFlags();
97
  }
98
99
  public String getTypePoolId( final Widget widget ) {
100
    return null;
101
  }
102
103
104
  ////////////////////////////////////
93
  ////////////////////////////////////
105
  // Helping methods to preserve state
94
  // Helping methods to preserve state
106
95
(-)src/org/eclipse/swt/internal/widgets/compositekit/CompositeLCA.java (-16 lines)
Lines 21-27 Link Here
21
public class CompositeLCA extends AbstractWidgetLCA {
21
public class CompositeLCA extends AbstractWidgetLCA {
22
22
23
  private static final String QX_TYPE = "qx.ui.layout.CanvasLayout";
23
  private static final String QX_TYPE = "qx.ui.layout.CanvasLayout";
24
//  private static final String TYPE_POOL_ID = CompositeLCA.class.getName();
25
24
26
  public void preserveValues( final Widget widget ) {
25
  public void preserveValues( final Widget widget ) {
27
    ControlLCAUtil.preserveValues( ( Control )widget );
26
    ControlLCAUtil.preserveValues( ( Control )widget );
Lines 52-70 Link Here
52
    JSWriter writer = JSWriter.getWriterFor( widget );
51
    JSWriter writer = JSWriter.getWriterFor( widget );
53
    writer.dispose();
52
    writer.dispose();
54
  }
53
  }
55
56
  public void createResetHandlerCalls( final String typePoolId )
57
    throws IOException
58
  {
59
    ControlLCAUtil.resetChanges();
60
    ControlLCAUtil.resetStyleFlags();
61
  }
62
63
  public String getTypePoolId( final Widget widget ) {
64
    // TODO [rh] disabled pooling, see
65
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=203499
66
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=204107
67
//    return TYPE_POOL_ID;
68
    return null;
69
  }
70
}
54
}
(-)src/org/eclipse/swt/internal/widgets/tabfolderkit/TabFolderLCA.java (-9 lines)
Lines 57-71 Link Here
57
    writer.dispose();
57
    writer.dispose();
58
  }
58
  }
59
59
60
  public void createResetHandlerCalls( final String typePoolId )
61
    throws IOException
62
  {
63
  }
64
65
  public String getTypePoolId( final Widget widget ) {
66
    return null;
67
  }
68
69
  public Rectangle adjustCoordinates( final Widget widget,
60
  public Rectangle adjustCoordinates( final Widget widget,
70
                                      final Rectangle newBounds )
61
                                      final Rectangle newBounds )
71
  {
62
  {
(-)src/org/eclipse/swt/internal/widgets/scalekit/ScaleLCA.java (-9 lines)
Lines 101-115 Link Here
101
    writer.dispose();
101
    writer.dispose();
102
  }
102
  }
103
103
104
  public void createResetHandlerCalls( final String typePoolId )
105
    throws IOException
106
  {
107
  }
108
109
  public String getTypePoolId( final Widget widget ) {
110
    return null;
111
  }
112
113
  //////////////////
104
  //////////////////
114
  // Helping methods
105
  // Helping methods
115
106
(-)src/org/eclipse/swt/internal/widgets/sliderkit/SliderLCA.java (-9 lines)
Lines 105-119 Link Here
105
    writer.dispose();
105
    writer.dispose();
106
  }
106
  }
107
107
108
  public void createResetHandlerCalls( final String typePoolId )
109
    throws IOException
110
  {    
111
  }
112
113
  public String getTypePoolId( final Widget widget ) {
114
    return null;
115
  }
116
117
  //////////////////
108
  //////////////////
118
  // Helping methods
109
  // Helping methods
119
  private void writeMaximum( final Slider slider ) throws IOException {
110
  private void writeMaximum( final Slider slider ) throws IOException {
(-)src/org/eclipse/swt/internal/widgets/displaykit/DisplayLCA.java (-36 / +4 lines)
Lines 14-20 Link Here
14
14
15
import java.io.IOException;
15
import java.io.IOException;
16
import java.text.MessageFormat;
16
import java.text.MessageFormat;
17
import java.util.*;
17
import java.util.HashMap;
18
import java.util.Map;
18
import java.util.logging.Level;
19
import java.util.logging.Level;
19
20
20
import javax.servlet.http.HttpServletRequest;
21
import javax.servlet.http.HttpServletRequest;
Lines 30-36 Link Here
30
import org.eclipse.rwt.internal.util.HTML;
31
import org.eclipse.rwt.internal.util.HTML;
31
import org.eclipse.rwt.lifecycle.*;
32
import org.eclipse.rwt.lifecycle.*;
32
import org.eclipse.rwt.resources.IResource;
33
import org.eclipse.rwt.resources.IResource;
33
import org.eclipse.rwt.service.ISessionStore;
34
import org.eclipse.swt.events.TypedEvent;
34
import org.eclipse.swt.events.TypedEvent;
35
import org.eclipse.swt.graphics.Device;
35
import org.eclipse.swt.graphics.Device;
36
import org.eclipse.swt.graphics.Rectangle;
36
import org.eclipse.swt.graphics.Rectangle;
Lines 51-60 Link Here
51
  private final static String PATTERN_REQUEST_COUNTER
51
  private final static String PATTERN_REQUEST_COUNTER
52
    =   "var req = org.eclipse.swt.Request.getInstance();"
52
    =   "var req = org.eclipse.swt.Request.getInstance();"
53
      + "req.setRequestCounter( \"{0,number,#}\" );";
53
      + "req.setRequestCounter( \"{0,number,#}\" );";
54
  private static final String DISPOSE_HANDLER_REGISTRY
55
    = "org.eclipse.rap.disposeHandlerRegistry";
56
  private static final JSVar DISPOSE_HANDLER_START
57
    = new JSVar( "function( " + JSWriter.WIDGET_REF + " ) {" );
58
54
59
  private static final String CLIENT_LOG_LEVEL
55
  private static final String CLIENT_LOG_LEVEL
60
    = "org.eclipse.rwt.clientLogLevel";
56
    = "org.eclipse.rwt.clientLogLevel";
Lines 368-373 Link Here
368
364
369
  private static void disposeWidgets() throws IOException {
365
  private static void disposeWidgets() throws IOException {
370
    Widget[] disposedWidgets = DisposedWidgets.getAll();
366
    Widget[] disposedWidgets = DisposedWidgets.getAll();
367
    // TODO [rst] since widget pooling is removed, the loop should be reverted
368
    //            again
371
    // [fappel]: client side disposal order is crucial for the widget
369
    // [fappel]: client side disposal order is crucial for the widget
372
    //           caching mechanism - we need to dispose of children first. This
370
    //           caching mechanism - we need to dispose of children first. This
373
    //           is reverse to the server side mechanism (which is analog to
371
    //           is reverse to the server side mechanism (which is analog to
Lines 375-414 Link Here
375
    for( int i = disposedWidgets.length - 1; i >= 0; i-- ) {
373
    for( int i = disposedWidgets.length - 1; i >= 0; i-- ) {
376
      Widget toDispose = disposedWidgets[ i ];
374
      Widget toDispose = disposedWidgets[ i ];
377
      AbstractWidgetLCA lca = WidgetUtil.getLCA( toDispose );
375
      AbstractWidgetLCA lca = WidgetUtil.getLCA( toDispose );
378
379
      Set disposeHandler = getAlreadyRegisteredHandlers();
380
      String key = lca.getTypePoolId( toDispose );
381
      if( key != null && !disposeHandler.contains( key ) ) {
382
        JSWriter writer = JSWriter.getWriterFor( toDispose );
383
        Object[] params = new Object[] {
384
          new Integer( key.hashCode() ),
385
          DISPOSE_HANDLER_START
386
        };
387
        writer.startCall( JSWriter.WIDGET_MANAGER_REF,
388
                          "registerResetHandler",
389
                          params );
390
        try {
391
          lca.createResetHandlerCalls( key );
392
        } finally {
393
          writer.endCall( new Object[] { new JSVar( "}" ) } );
394
          disposeHandler.add( key );
395
        }
396
      }
397
398
      lca.renderDispose( toDispose );
376
      lca.renderDispose( toDispose );
399
    }
377
    }
400
  }
378
  }
401
379
402
  private static Set getAlreadyRegisteredHandlers() {
403
    ISessionStore session = ContextProvider.getSession();
404
    Set result = ( Set )session.getAttribute( DISPOSE_HANDLER_REGISTRY );
405
    if( result == null ) {
406
      result = new HashSet();
407
      session.setAttribute( DISPOSE_HANDLER_REGISTRY, result );
408
    }
409
    return result;
410
  }
411
412
  private static void writeScriptTag( final HtmlResponseWriter out,
380
  private static void writeScriptTag( final HtmlResponseWriter out,
413
                                      final String library )
381
                                      final String library )
414
    throws IOException
382
    throws IOException
(-)src/org/eclipse/swt/internal/widgets/treeitemkit/TreeItemLCA.java (-10 / +1 lines)
Lines 155-170 Link Here
155
    writer.dispose();
155
    writer.dispose();
156
  }
156
  }
157
157
158
  public void createResetHandlerCalls( final String typePoolId )
158
  ////////////////////////////////////
159
    throws IOException
160
  {
161
  }
162
163
  public String getTypePoolId( final Widget widget ) {
164
    return null;
165
  }
166
167
  // /////////////////////////////////
168
  // Helping methods to write changes
159
  // Helping methods to write changes
169
  private void writeShowItem( final TreeItem item ) throws IOException {
160
  private void writeShowItem( final TreeItem item ) throws IOException {
170
    Tree tree = item.getParent();
161
    Tree tree = item.getParent();
(-)src/org/eclipse/swt/internal/custom/clabelkit/CLabelLCA.java (-9 lines)
Lines 75-89 Link Here
75
    writer.dispose();
75
    writer.dispose();
76
  }
76
  }
77
77
78
  public void createResetHandlerCalls( final String typePoolId )
79
    throws IOException
80
  {
81
  }
82
83
  public String getTypePoolId( final Widget widget ) {
84
    return null;
85
  }
86
87
  private static void writeText( final CLabel label ) throws IOException {
78
  private static void writeText( final CLabel label ) throws IOException {
88
    String text = label.getText();
79
    String text = label.getText();
89
    if( WidgetLCAUtil.hasChanged( label, PROP_TEXT, text, "" ) ) {
80
    if( WidgetLCAUtil.hasChanged( label, PROP_TEXT, text, "" ) ) {
(-)src/org/eclipse/swt/internal/widgets/menukit/MenuLCA.java (-9 lines)
Lines 50-64 Link Here
50
    writer.dispose();
50
    writer.dispose();
51
  }
51
  }
52
52
53
  public void createResetHandlerCalls( final String typePoolId ) 
54
    throws IOException 
55
  {
56
  }
57
  
58
  public String getTypePoolId( final Widget widget ) {
59
    return null;
60
  }
61
  
62
  private static MenuDelegateLCA getDelegateLCA( final Widget widget ) {
53
  private static MenuDelegateLCA getDelegateLCA( final Widget widget ) {
63
    MenuDelegateLCA result;
54
    MenuDelegateLCA result;
64
    Menu menu = ( Menu )widget;
55
    Menu menu = ( Menu )widget;
(-)src/org/eclipse/swt/internal/custom/scrolledcompositekit/ScrolledCompositeLCA.java (-37 lines)
Lines 25-33 Link Here
25
  private static final String QX_TYPE
25
  private static final String QX_TYPE
26
    = "org.eclipse.swt.custom.ScrolledComposite";
26
    = "org.eclipse.swt.custom.ScrolledComposite";
27
27
28
//  private static final String TYPE_POOL_ID
29
//    = ScrolledCompositeLCA.class.getName();
30
31
  private static final Integer ZERO = new Integer( 0 );
28
  private static final Integer ZERO = new Integer( 0 );
32
29
33
  // Request parameter names
30
  // Request parameter names
Lines 95-117 Link Here
95
    writer.dispose();
92
    writer.dispose();
96
  }
93
  }
97
94
98
  public void createResetHandlerCalls( final String typePoolId )
99
    throws IOException 
100
  {
101
    ControlLCAUtil.resetChanges();
102
    resetClipBounds();
103
    resetScrollBars();
104
    resetBarSelection();
105
    ControlLCAUtil.resetStyleFlags();
106
  }
107
108
  public String getTypePoolId( final Widget widget ) {
109
    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=226651
110
//  return TYPE_POOL_ID;
111
  return null;
112
  }
113
114
115
  ///////////////////////////////////
95
  ///////////////////////////////////
116
  // Helping methods to write changes
96
  // Helping methods to write changes
117
97
Lines 123-133 Link Here
123
    writer.set( PROP_OVERFLOW, "overflow", overflow, null );
103
    writer.set( PROP_OVERFLOW, "overflow", overflow, null );
124
  }
104
  }
125
105
126
  private static void resetScrollBars() throws IOException {
127
    JSWriter writer = JSWriter.getWriterForResetHandler();
128
    writer.reset( "overflow" );
129
  }
130
131
  private static void writeBarSelection( final ScrolledComposite composite )
106
  private static void writeBarSelection( final ScrolledComposite composite )
132
    throws IOException
107
    throws IOException
133
  {
108
  {
Lines 142-153 Link Here
142
    }
117
    }
143
  }
118
  }
144
119
145
  private static void resetBarSelection() throws IOException {
146
    JSWriter writer = JSWriter.getWriterForResetHandler();
147
    writer.set( "hBarSelection", 0 );
148
    writer.set( "vBarSelection", 0 );
149
  }
150
151
  private static void writeClipBounds( final ScrolledComposite composite )
120
  private static void writeClipBounds( final ScrolledComposite composite )
152
    throws IOException
121
    throws IOException
153
  {
122
  {
Lines 159-170 Link Here
159
    }
128
    }
160
  }
129
  }
161
130
162
  private static void resetClipBounds() throws IOException {
163
    JSWriter writer = JSWriter.getWriterForResetHandler();
164
    writer.reset( "clipWidth" );
165
    writer.reset( "clipHeight" );
166
  }
167
168
  private static String getOverflow( final ScrolledComposite composite ) {
131
  private static String getOverflow( final ScrolledComposite composite ) {
169
    String result;
132
    String result;
170
    ScrollBar horizontalBar = composite.getHorizontalBar();
133
    ScrollBar horizontalBar = composite.getHorizontalBar();
(-)src/org/eclipse/swt/internal/widgets/combokit/ComboLCA.java (-14 lines)
Lines 113-132 Link Here
113
    writer.dispose();
113
    writer.dispose();
114
  }
114
  }
115
115
116
  public void createResetHandlerCalls( final String typePoolId )
117
    throws IOException
118
  {
119
    JSWriter writer = JSWriter.getWriterForResetHandler();
120
    writer.call( "removeAll", null );
121
  }
122
123
  public String getTypePoolId( final Widget widget ) {
124
//    TODO [rst] Enable pooling when re-parenting problems with
125
//               qx.ui.form.ComboBox are solved
126
//    return TYPE_POOL_ID;
127
    return null;
128
  }
129
130
  ///////////////////////////////////////
116
  ///////////////////////////////////////
131
  // Helping methods to read client state
117
  // Helping methods to read client state
132
118
(-)src/org/eclipse/swt/internal/widgets/expandbarkit/ExpandBarLCA.java (-9 lines)
Lines 67-81 Link Here
67
    writer.dispose();
67
    writer.dispose();
68
  }
68
  }
69
69
70
  public void createResetHandlerCalls( final String typePoolId )
71
    throws IOException
72
  {
73
  }
74
75
  public String getTypePoolId( final Widget widget ) {
76
    return null;
77
  }
78
79
  public static IExpandBarAdapter getExpandBarAdapter( final ExpandBar bar ) {
70
  public static IExpandBarAdapter getExpandBarAdapter( final ExpandBar bar ) {
80
    return ( IExpandBarAdapter )bar.getAdapter( IExpandBarAdapter.class );
71
    return ( IExpandBarAdapter )bar.getAdapter( IExpandBarAdapter.class );
81
  }
72
  }
(-)src/org/eclipse/swt/internal/widgets/coolbarkit/CoolBarLCA.java (-7 lines)
Lines 55-65 Link Here
55
    JSWriter writer = JSWriter.getWriterFor( widget );
55
    JSWriter writer = JSWriter.getWriterFor( widget );
56
    writer.dispose();
56
    writer.dispose();
57
  }
57
  }
58
59
  public void createResetHandlerCalls( final String typePoolId ) throws IOException {
60
  }
61
62
  public String getTypePoolId( final Widget widget ) {
63
    return null;
64
  }
65
}
58
}
(-)src/org/eclipse/swt/internal/widgets/expanditemkit/ExpandItemLCA.java (-9 lines)
Lines 101-115 Link Here
101
    writer.dispose();
101
    writer.dispose();
102
  }
102
  }
103
103
104
  public void createResetHandlerCalls( final String typePoolId )
105
    throws IOException
106
  {
107
  }
108
109
  public String getTypePoolId( final Widget widget ) {
110
    return null;
111
  }
112
113
  ////////////////
104
  ////////////////
114
  // Event helper
105
  // Event helper
115
106
(-)src/org/eclipse/swt/internal/widgets/progressbarkit/ProgressBarLCA.java (-9 lines)
Lines 69-83 Link Here
69
    writer.dispose();
69
    writer.dispose();
70
  }
70
  }
71
  
71
  
72
  public void createResetHandlerCalls( final String typePoolId )
73
    throws IOException
74
  {
75
  }
76
77
  public String getTypePoolId( final Widget widget ) {
78
    return null;
79
  }
80
81
  private static void writeState( final ProgressBar progressBar )
72
  private static void writeState( final ProgressBar progressBar )
82
    throws IOException
73
    throws IOException
83
  {
74
  {
(-)src/org/eclipse/swt/internal/widgets/tablecolumnkit/TableColumnLCA.java (-10 lines)
Lines 120-135 Link Here
120
    writer.dispose();
120
    writer.dispose();
121
  }
121
  }
122
122
123
  public void createResetHandlerCalls( final String typePoolId )
124
    throws IOException
125
  {
126
  }
127
128
  public String getTypePoolId( final Widget widget ) {
129
    return null;
130
  }
131
132
133
  //////////////////////////////////////////
123
  //////////////////////////////////////////
134
  // Helping method to write JavaScript code
124
  // Helping method to write JavaScript code
135
125
(-)src/org/eclipse/swt/internal/custom/ctabitemkit/CTabItemLCA.java (-10 lines)
Lines 105-120 Link Here
105
    writer.dispose();
105
    writer.dispose();
106
  }
106
  }
107
107
108
  public void createResetHandlerCalls( final String typePoolId )
109
    throws IOException
110
  {
111
  }
112
113
  public String getTypePoolId( final Widget widget ) {
114
    return null;
115
  }
116
117
118
  ////////////////////////////////////////////
108
  ////////////////////////////////////////////
119
  // Helping methods to render JavaScript code
109
  // Helping methods to render JavaScript code
120
110
(-)src/org/eclipse/swt/internal/widgets/tabitemkit/TabItemLCA.java (-10 lines)
Lines 85-100 Link Here
85
    writer.dispose();
85
    writer.dispose();
86
  }
86
  }
87
87
88
  public void createResetHandlerCalls( final String typePoolId ) 
89
    throws IOException 
90
  {
91
  }
92
  
93
  public String getTypePoolId( final Widget widget ) {
94
    return null;
95
  }
96
  
97
98
  //////////////////
88
  //////////////////
99
  // helping methods
89
  // helping methods
100
  
90
  
(-)src/org/eclipse/swt/internal/widgets/toolbarkit/ToolBarLCA.java (-8 lines)
Lines 60-71 Link Here
60
    writer.dispose();
60
    writer.dispose();
61
  }
61
  }
62
  
62
  
63
  public void createResetHandlerCalls( final String typePoolId ) 
64
    throws IOException 
65
  {
66
  }
67
  
68
  public String getTypePoolId( final Widget widget ) {
69
    return null;
70
  }
71
}
63
}
(-)src/org/eclipse/swt/internal/widgets/tablekit/TableLCA.java (-9 lines)
Lines 150-164 Link Here
150
    writer.dispose();
150
    writer.dispose();
151
  }
151
  }
152
152
153
  public void createResetHandlerCalls( final String typePoolId )
154
    throws IOException
155
  {
156
  }
157
158
  public String getTypePoolId( final Widget widget ) {
159
    return null;
160
  }
161
162
  public void doRedrawFake( final Control control ) {
153
  public void doRedrawFake( final Control control ) {
163
    Table table = ( Table )control;
154
    Table table = ( Table )control;
164
    Object adapter = table.getAdapter( ITableAdapter.class );
155
    Object adapter = table.getAdapter( ITableAdapter.class );
(-)src/org/eclipse/swt/internal/widgets/toolitemkit/ToolItemLCA.java (-7 lines)
Lines 53-65 Link Here
53
    writer.dispose();
53
    writer.dispose();
54
  }
54
  }
55
55
56
  public void createResetHandlerCalls( final String typePoolId ) throws IOException {
57
  }
58
  
59
  public String getTypePoolId( final Widget widget ) {
60
    return null;
61
  }
62
  
63
  private static ToolItemDelegateLCA getLCADelegate( final Widget widget ) {
56
  private static ToolItemDelegateLCA getLCADelegate( final Widget widget ) {
64
    ToolItemDelegateLCA result;
57
    ToolItemDelegateLCA result;
65
    int style = ( ( ToolItem )widget ).getStyle();
58
    int style = ( ( ToolItem )widget ).getStyle();
(-)src/org/eclipse/swt/internal/widgets/menuitemkit/MenuItemLCA.java (-9 lines)
Lines 59-73 Link Here
59
    getDelegateLCA( menuItem ).renderDispose( menuItem );
59
    getDelegateLCA( menuItem ).renderDispose( menuItem );
60
  }
60
  }
61
  
61
  
62
  public void createResetHandlerCalls( final String typePoolId ) 
63
    throws IOException 
64
  {
65
  }
66
  
67
  public String getTypePoolId( final Widget widget ) {
68
    return null;
69
  }
70
  
71
  private static boolean isTopLevelMenuBarItem( final MenuItem menuItem ) {
62
  private static boolean isTopLevelMenuBarItem( final MenuItem menuItem ) {
72
    return ( menuItem.getParent().getStyle() & SWT.BAR ) != 0;
63
    return ( menuItem.getParent().getStyle() & SWT.BAR ) != 0;
73
  }
64
  }
(-)src/org/eclipse/swt/internal/widgets/controlkit/ControlLCA.java (-9 lines)
Lines 40-52 Link Here
40
  public void renderDispose( final Widget widget ) throws IOException {
40
  public void renderDispose( final Widget widget ) throws IOException {
41
    // do nothing
41
    // do nothing
42
  }
42
  }
43
  
44
  public void createResetHandlerCalls( final String typePoolId ) throws IOException {
45
    // do nothing
46
  }
47
  
48
  public String getTypePoolId( final Widget widget ) {
49
    // do nothing
50
    return null;
51
  }
52
}
43
}
(-)src/org/eclipse/swt/internal/widgets/sashkit/SashLCA.java (-14 lines)
Lines 25-32 Link Here
25
25
26
  private static final String QX_TYPE = "org.eclipse.swt.widgets.Sash";
26
  private static final String QX_TYPE = "org.eclipse.swt.widgets.Sash";
27
27
28
//  private static final String TYPE_POOL_ID = SashLCA.class.getName();
29
30
  public void preserveValues( final Widget widget ) {
28
  public void preserveValues( final Widget widget ) {
31
    ControlLCAUtil.preserveValues( ( Control )widget );
29
    ControlLCAUtil.preserveValues( ( Control )widget );
32
    IWidgetAdapter adapter = WidgetUtil.getAdapter( widget );
30
    IWidgetAdapter adapter = WidgetUtil.getAdapter( widget );
Lines 67-82 Link Here
67
    writer.dispose();
65
    writer.dispose();
68
  }
66
  }
69
67
70
  public void createResetHandlerCalls( final String typePoolId )
71
    throws IOException
72
  {
73
    ControlLCAUtil.resetChanges();
74
    ControlLCAUtil.resetStyleFlags();
75
  }
76
77
  public String getTypePoolId( final Widget widget ) {
78
//    return TYPE_POOL_ID;
79
    // TODO [bm] disabled due to cursor problems
80
    return null;
81
  }
82
}
68
}
(-)src/org/eclipse/swt/internal/widgets/groupkit/GroupLCA.java (-10 lines)
Lines 58-71 Link Here
58
    JSWriter writer = JSWriter.getWriterFor( widget );
58
    JSWriter writer = JSWriter.getWriterFor( widget );
59
    writer.dispose();
59
    writer.dispose();
60
  }
60
  }
61
62
  public void createResetHandlerCalls( final String typePoolId ) throws IOException {
63
    JSWriter writer = JSWriter.getWriterForResetHandler();
64
    writer.reset( "legend" );
65
    ControlLCAUtil.resetStyleFlags();
66
  }
67
68
  public String getTypePoolId( final Widget widget ) {
69
    return null;
70
  }
71
}
61
}
(-)src/org/eclipse/swt/internal/custom/ccombokit/CComboLCA.java (-11 lines)
Lines 120-136 Link Here
120
    writer.dispose();
120
    writer.dispose();
121
  }
121
  }
122
122
123
  public void createResetHandlerCalls( final String typePoolId )
124
    throws IOException
125
  {
126
    JSWriter writer = JSWriter.getWriterForResetHandler();
127
    writer.call( "removeAll", null );
128
  }
129
130
  public String getTypePoolId( final Widget widget ) {
131
    return null;
132
  }
133
134
  ///////////////////////////////////////
123
  ///////////////////////////////////////
135
  // Helping methods to read client state
124
  // Helping methods to read client state
136
125
(-)src/org/eclipse/swt/internal/widgets/datetimekit/DateTimeLCA.java (-13 lines)
Lines 46-64 Link Here
46
    getDelegate( widget ).renderDispose( ( DateTime )widget );
46
    getDelegate( widget ).renderDispose( ( DateTime )widget );
47
  }
47
  }
48
48
49
  public void createResetHandlerCalls( final String typePoolId )
50
    throws IOException
51
  {
52
  }
53
54
  public String getTypePoolId( final Widget widget ) {
55
    // TODO [rh] disabled pooling, see bugs prefixed with [pooling]
56
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=204107
57
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=199142
58
    // return getDelegate( widget ).getTypePoolId( ( DateTime )widget );
59
    return null;
60
  }
61
62
  private static AbstractDateTimeLCADelegate getDelegate( final Widget widget )
49
  private static AbstractDateTimeLCADelegate getDelegate( final Widget widget )
63
  {
50
  {
64
    AbstractDateTimeLCADelegate result;
51
    AbstractDateTimeLCADelegate result;
(-)src/org/eclipse/swt/internal/widgets/spinnerkit/SpinnerLCA.java (-30 lines)
Lines 23-29 Link Here
23
public final class SpinnerLCA extends AbstractWidgetLCA {
23
public final class SpinnerLCA extends AbstractWidgetLCA {
24
24
25
  private static final String QX_TYPE = "org.eclipse.swt.widgets.Spinner";
25
  private static final String QX_TYPE = "org.eclipse.swt.widgets.Spinner";
26
//  private static final String TYPE_POOL_ID = SpinnerLCA.class.getName();
27
26
28
  private static final Integer DEFAULT_TEXT_LIMIT
27
  private static final Integer DEFAULT_TEXT_LIMIT
29
    = new Integer( Spinner.LIMIT );
28
    = new Integer( Spinner.LIMIT );
Lines 95-114 Link Here
95
    writer.dispose();
94
    writer.dispose();
96
  }
95
  }
97
96
98
  public void createResetHandlerCalls( final String typePoolId )
99
    throws IOException
100
  {
101
    ControlLCAUtil.resetStyleFlags();
102
    resetReadOnly();
103
    resetValues();
104
  }
105
106
  public String getTypePoolId( final Widget widget ) {
107
    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=226651
108
//  return TYPE_POOL_ID;
109
    return null;
110
  }
111
112
  //////////////////////////////////////
97
  //////////////////////////////////////
113
  // Helping methods to write JavaScript
98
  // Helping methods to write JavaScript
114
99
Lines 146-161 Link Here
146
    }
131
    }
147
  }
132
  }
148
133
149
  private static void resetValues() throws IOException {
150
    JSWriter writer = JSWriter.getWriterForResetHandler();
151
//    TODO [rst] Missing resetters in QX_TYPE, discuss with qooxdoo
152
//    writer.reset( "min" );
153
//    writer.reset( "max" );
154
    writer.reset( "incrementAmount" );
155
    writer.reset( "pageIncrementAmount" );
156
    writer.reset( "value" );
157
  }
158
159
  private static void writeSetInt( final JSWriter writer,
134
  private static void writeSetInt( final JSWriter writer,
160
                                   final String javaProperty,
135
                                   final String javaProperty,
161
                                   final String jsProperty,
136
                                   final String jsProperty,
Lines 176-186 Link Here
176
    writer.set( JSConst.QX_FIELD_EDITABLE, !readOnly );
151
    writer.set( JSConst.QX_FIELD_EDITABLE, !readOnly );
177
  }
152
  }
178
153
179
  private static void resetReadOnly() throws IOException {
180
    JSWriter writer = JSWriter.getWriterForResetHandler();
181
    writer.reset( JSConst.QX_FIELD_EDITABLE );
182
  }
183
184
  private static void writeWrap( final Spinner spinner ) throws IOException {
154
  private static void writeWrap( final Spinner spinner ) throws IOException {
185
    if( ( spinner.getStyle() & SWT.WRAP ) != 0 ) {
155
    if( ( spinner.getStyle() & SWT.WRAP ) != 0 ) {
186
      JSWriter writer = JSWriter.getWriterFor( spinner );
156
      JSWriter writer = JSWriter.getWriterFor( spinner );
(-)js/org/eclipse/swt/widgets/List.js (-33 / +26 lines)
Lines 19-69 Link Here
19
  construct : function() {
19
  construct : function() {
20
    this.base( arguments );
20
    this.base( arguments );
21
    this.setMarkLeadingItem( true );
21
    this.setMarkLeadingItem( true );
22
    this.rap_init();
22
    // Should changeSelection events passed to the server-side?
23
    // state == no, action == yes
24
    this._changeSelectionNotification = "state";
25
    this._topIndex = 0;
26
    var selMgr = this.getManager();
27
    selMgr.addEventListener( "changeLeadItem", this._onChangeLeadItem, this );
28
    selMgr.addEventListener( "changeSelection", this._onSelectionChange, this );
29
    this.addEventListener( "focus", this._onFocusIn, this );
30
    this.addEventListener( "blur", this._onFocusOut, this );
31
    this.addEventListener( "click", this._onClick, this );
32
    this.addEventListener( "dblclick", this._onDblClick, this );
33
    this.addEventListener( "appear", this._onAppear, this );
34
    // Listen to send event of request to report topIndex
35
    var req = org.eclipse.swt.Request.getInstance();
36
    req.addEventListener( "send", this._onSendRequest, this );
23
  },
37
  },
24
  
38
  
25
  destruct : function() {
39
  destruct : function() {
26
    this.rap_reset();
40
    var req = org.eclipse.swt.Request.getInstance();
41
    req.removeEventListener( "send", this._onSendRequest, this );
42
    var selMgr = this.getManager();
43
    selMgr.removeEventListener( "changeLeadItem", this._onChangeLeadItem, this );
44
    selMgr.removeEventListener( "changeSelection", this._onSelectionChange, this );
45
    this.removeEventListener( "focus", this._onFocusIn, this );
46
    this.removeEventListener( "blur", this._onFocusOut, this );
47
    this.removeEventListener( "click", this._onClick, this );
48
    this.removeEventListener( "dblclick", this._onDblClick, this );
49
    this.removeEventListener( "appear", this._onAppear, this );
27
  },
50
  },
28
51
29
  members : {
52
  members : {
30
    
53
    
54
    // TODO [rst] Move parameter to constructor and delete this method
31
    init : function( multiSelection ) {
55
    init : function( multiSelection ) {
32
      var manager = this.getManager();
56
      var manager = this.getManager();
33
      manager.setMultiSelection( multiSelection );
57
      manager.setMultiSelection( multiSelection );
34
    },
58
    },
35
    
59
    
36
    rap_init : function( multiSelection ) {
37
      // Should changeSelection events passed to the server-side?
38
      // state == no, action == yes
39
      this._changeSelectionNotification = "state";
40
      this._topIndex = 0;
41
      var selMgr = this.getManager();
42
      selMgr.addEventListener( "changeLeadItem", this._onChangeLeadItem, this );
43
      selMgr.addEventListener( "changeSelection", this._onSelectionChange, this );
44
      this.addEventListener( "focus", this._onFocusIn, this );
45
      this.addEventListener( "blur", this._onFocusOut, this );
46
      this.addEventListener( "click", this._onClick, this );
47
      this.addEventListener( "dblclick", this._onDblClick, this );
48
      this.addEventListener( "appear", this._onAppear, this );
49
      // Listen to send event of request to report topIndex
50
      var req = org.eclipse.swt.Request.getInstance();
51
      req.addEventListener( "send", this._onSendRequest, this );
52
    },
53
    
54
    rap_reset : function() {
55
      var req = org.eclipse.swt.Request.getInstance();
56
      req.removeEventListener( "send", this._onSendRequest, this );
57
      var selMgr = this.getManager();
58
      selMgr.removeEventListener( "changeLeadItem", this._onChangeLeadItem, this );
59
      selMgr.removeEventListener( "changeSelection", this._onSelectionChange, this );
60
      this.removeEventListener( "focus", this._onFocusIn, this );
61
      this.removeEventListener( "blur", this._onFocusOut, this );
62
      this.removeEventListener( "click", this._onClick, this );
63
      this.removeEventListener( "dblclick", this._onDblClick, this );
64
      this.removeEventListener( "appear", this._onAppear, this );
65
    },
66
    
67
    /** Sets the given array of items. */
60
    /** Sets the given array of items. */
68
    setItems : function( items ) {
61
    setItems : function( items ) {
69
      // preserve selection and focused item
62
      // preserve selection and focused item
(-)src/org/eclipse/swt/internal/widgets/linkkit/LinkLCA.java (-12 lines)
Lines 79-96 Link Here
79
    writer.dispose();
79
    writer.dispose();
80
  }
80
  }
81
81
82
  public void createResetHandlerCalls( final String typePoolId )
83
    throws IOException
84
  {
85
    ControlLCAUtil.resetStyleFlags();
86
  }
87
88
  public String getTypePoolId( final Widget widget ) {
89
    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=226651
90
//    return TYPE_POOL_ID;
91
    return null;
92
  }
93
94
  private static void writeSelectionListener( final Link link )
82
  private static void writeSelectionListener( final Link link )
95
    throws IOException
83
    throws IOException
96
  {
84
  {
(-)src/org/eclipse/swt/internal/browser/browserkit/BrowserLCA.java (-17 lines)
Lines 28-35 Link Here
28
28
29
  private static final String PARAM_EXECUTE_RESULT = "executeResult";
29
  private static final String PARAM_EXECUTE_RESULT = "executeResult";
30
30
31
//  private static final String TYPE_POOL_ID = BrowserLCA.class.getName();
32
33
  private static final String PROP_URL = "url";
31
  private static final String PROP_URL = "url";
34
  private static final String PROP_TEXT = "text";
32
  private static final String PROP_TEXT = "text";
35
33
Lines 75-95 Link Here
75
    writer.dispose();
73
    writer.dispose();
76
  }
74
  }
77
75
78
  public void createResetHandlerCalls( final String typePoolId )
79
    throws IOException
80
  {
81
    JSWriter writer = JSWriter.getWriterForResetHandler();
82
    writer.reset( QX_FIELD_SOURCE );
83
    ControlLCAUtil.resetStyleFlags();
84
  }
85
86
  public String getTypePoolId( final Widget widget ) {
87
    // TODO [rh] Disabled pooling. In IE7, using Browser#setText() does not 
88
    //      work when widget was pooled. The previous content is displayed.
89
//    return TYPE_POOL_ID;
90
    return null;
91
  }
92
93
  private static void writeUrl( final Browser browser ) 
76
  private static void writeUrl( final Browser browser ) 
94
    throws IOException 
77
    throws IOException 
95
  {
78
  {

Return to bug 281909