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

Collapse All | Expand All

(-)src/org/eclipse/rwt/internal/lifecycle/RWTLifeCycle.java (-7 / +12 lines)
Lines 41-49 Link Here
41
  
41
  
42
  private static final String ATTR_SESSION_DISPLAY
42
  private static final String ATTR_SESSION_DISPLAY
43
    = RWTLifeCycle.class.getName() + "#sessionDisplay";
43
    = RWTLifeCycle.class.getName() + "#sessionDisplay";
44
44
  private static final String ATTR_REDRAW_CONTROLS
45
  private static final String REDRAW_CONTROLS
45
    = RWTLifeCycle.class.getName() + "#redrawControls";
46
    = RWTLifeCycle.class.getName() + ".RedrawWidgets";
47
  private static final String INITIALIZED
46
  private static final String INITIALIZED
48
    = RWTLifeCycle.class.getName() + "Initialized";
47
    = RWTLifeCycle.class.getName() + "Initialized";
49
  private static final String CURRENT_PHASE
48
  private static final String CURRENT_PHASE
Lines 439-448 Link Here
439
                                 final boolean redraw )
438
                                 final boolean redraw )
440
  {
439
  {
441
    IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
440
    IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
442
    Set set = ( Set )stateInfo.getAttribute( REDRAW_CONTROLS );
441
    Set set = ( Set )stateInfo.getAttribute( ATTR_REDRAW_CONTROLS );
443
    if( set == null ) {
442
    if( set == null ) {
444
      set = new HashSet();
443
      set = new HashSet();
445
      stateInfo.setAttribute( REDRAW_CONTROLS, set );
444
      stateInfo.setAttribute( ATTR_REDRAW_CONTROLS, set );
446
    }
445
    }
447
    if( redraw ) {
446
    if( redraw ) {
448
      set.add( control );
447
      set.add( control );
Lines 450-459 Link Here
450
      set.remove( control );
449
      set.remove( control );
451
    }
450
    }
452
  }
451
  }
452
  
453
  public static boolean needsFakeRedraw( final Control control ) {
454
    IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
455
    Set set = ( Set )stateInfo.getAttribute( ATTR_REDRAW_CONTROLS );
456
    return set != null && set.contains( control );
457
  }
453
458
454
  private void doRedrawFake() {
459
  private static void doRedrawFake() {
455
    IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
460
    IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
456
    Set set = ( Set )stateInfo.getAttribute( REDRAW_CONTROLS );
461
    Set set = ( Set )stateInfo.getAttribute( ATTR_REDRAW_CONTROLS );
457
    if( set != null ) {
462
    if( set != null ) {
458
      Object[] controls = set.toArray();
463
      Object[] controls = set.toArray();
459
      for( int i = 0; i < controls.length; i++ ) {
464
      for( int i = 0; i < controls.length; i++ ) {
(-)src/org/eclipse/swt/widgets/Table.java (+3 lines)
Lines 2061-2066 Link Here
2061
      adjustFocusIndex();
2061
      adjustFocusIndex();
2062
    }
2062
    }
2063
    updateScrollBars();
2063
    updateScrollBars();
2064
    if( ( style & SWT.VIRTUAL ) != 0 ) {
2065
      redraw();
2066
    }
2064
  }
2067
  }
2065
2068
2066
  ////////////////
2069
  ////////////////
(-)src/org/eclipse/swt/widgets/Table_Test.java (-10 / +27 lines)
Lines 10-18 Link Here
10
 ******************************************************************************/
10
 ******************************************************************************/
11
package org.eclipse.swt.widgets;
11
package org.eclipse.swt.widgets;
12
12
13
import java.util.ArrayList;
14
13
import junit.framework.TestCase;
15
import junit.framework.TestCase;
14
16
15
import org.eclipse.rwt.graphics.Graphics;
17
import org.eclipse.rwt.graphics.Graphics;
18
import org.eclipse.rwt.internal.lifecycle.RWTLifeCycle;
16
import org.eclipse.rwt.lifecycle.PhaseId;
19
import org.eclipse.rwt.lifecycle.PhaseId;
17
import org.eclipse.swt.*;
20
import org.eclipse.swt.*;
18
import org.eclipse.swt.events.*;
21
import org.eclipse.swt.events.*;
Lines 329-344 Link Here
329
    }
332
    }
330
  }
333
  }
331
334
332
  private static boolean find( final int element, final int[] array ) {
333
    boolean result = false;
334
    for( int i = 0; i < array.length; i++ ) {
335
      if( element == array[ i ] ) {
336
        result = true;
337
      }
338
    }
339
    return result;
340
  }
341
342
  public void testReduceSetItemCountWithSelection() {
335
  public void testReduceSetItemCountWithSelection() {
343
    // Create a table that is populated with setItemCount with all selected
336
    // Create a table that is populated with setItemCount with all selected
344
    RWTFixture.fakePhase( PhaseId.PROCESS_ACTION );
337
    RWTFixture.fakePhase( PhaseId.PROCESS_ACTION );
Lines 1438-1443 Link Here
1438
    assertEquals( 0, table.getColumnOrder()[ 0 ] );
1431
    assertEquals( 0, table.getColumnOrder()[ 0 ] );
1439
    assertEquals( 1, table.getColumnOrder()[ 1 ] );
1432
    assertEquals( 1, table.getColumnOrder()[ 1 ] );
1440
  }
1433
  }
1434
  
1435
  public void testRedrawAfterDisposeVirtual() {
1436
    RWTFixture.fakePhase( PhaseId.PROCESS_ACTION );
1437
    Display display = new Display();
1438
    Shell shell = new Shell( display );
1439
    Table table = new Table( shell, SWT.VIRTUAL );
1440
    table.setSize( 100, 100 );
1441
    table.setItemCount( 150 );
1442
    // dispose the first item, this must cause a "redraw" which in turn triggers 
1443
    // a SetData event to populate the newly appeared item at the bottom of the
1444
    // table
1445
    table.getItem( 0 ).dispose();
1446
    assertTrue( RWTLifeCycle.needsFakeRedraw( table ) );
1447
  }
1441
1448
1442
  public void testSetColumnOrderWithInvalidArguments() {
1449
  public void testSetColumnOrderWithInvalidArguments() {
1443
    Display display = new Display();
1450
    Display display = new Display();
Lines 2190-2195 Link Here
2190
    table.remove( 5 );
2197
    table.remove( 5 );
2191
  }
2198
  }
2192
2199
2200
  private static boolean find( final int element, final int[] array ) {
2201
    boolean result = false;
2202
    for( int i = 0; i < array.length; i++ ) {
2203
      if( element == array[ i ] ) {
2204
        result = true;
2205
      }
2206
    }
2207
    return result;
2208
  }
2209
2193
  private static int countResolvedItems( final Table table ) {
2210
  private static int countResolvedItems( final Table table ) {
2194
    Object adapter = table.getAdapter( ITableAdapter.class );
2211
    Object adapter = table.getAdapter( ITableAdapter.class );
2195
    ITableAdapter tableAdapter = ( ITableAdapter )adapter;
2212
    ITableAdapter tableAdapter = ( ITableAdapter )adapter;

Return to bug 276713