Exemple #1
0
  @Test
  public void testReadLeft() {
    final List<Event> events = new LinkedList<Event>();
    GridColumn[] columns = createGridColumns(grid, 2, SWT.NONE);
    column.addListener(SWT.Move, new LoggingControlListener(events));
    columns[0].addListener(SWT.Move, new LoggingControlListener(events));
    columns[1].addListener(SWT.Move, new LoggingControlListener(events));

    // Simulate request that initializes widgets
    Fixture.fakeNewRequest();
    Fixture.executeLifeCycleFromServerThread();
    // Simulate request that changes column left
    int newLeft = 3;
    Fixture.fakeNewRequest();
    JsonObject parameters = new JsonObject().add("left", newLeft);
    Fixture.fakeCallOperation(getId(columns[0]), "move", parameters);
    Fixture.executeLifeCycleFromServerThread();

    assertEquals(2, events.size());
    Event event = events.get(0);
    assertSame(columns[0], event.widget);
    event = events.get(1);
    assertSame(column, event.widget);
    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(20, message.findSetProperty(column, "left").asInt());
    assertEquals(0, message.findSetProperty(columns[0], "left").asInt());
  }
Exemple #2
0
 @Before
 public void setUp() {
   Fixture.setUp();
   display = new Display();
   shell = new Shell(display);
   grid = new Grid(shell, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
   column = new GridColumn(grid, SWT.NONE);
   lca = (GridColumnLCA) WidgetUtil.getLCA(column);
   Fixture.fakeNewRequest();
 }
 private static void fakeCellToolTipRequest(Table table, String itemId, int column) {
   Fixture.fakeNewRequest();
   JsonObject parameters = new JsonObject().add("item", itemId).add("column", column);
   Fixture.fakeCallOperation(getId(table), "renderToolTipText", parameters);
 }