Beispiel #1
0
  public void testSetDataDisplay() {
    SelectionModel<String> model = new SingleSelectionModel<String>();
    DefaultSelectionEventManager<String> manager =
        DefaultSelectionEventManager.createDefaultManager();
    MockDataProvider<String> provider = new MockDataProvider<String>(null);
    DefaultNodeInfo<String> nodeInfo =
        new DefaultNodeInfo<String>(provider, new TextCell(), model, manager, null);
    MockHasData<String> display = new MockHasData<String>();
    display.setVisibleRange(0, 10);
    display.clearLastRowDataAndRange();
    assertEquals(0, display.getHandlerCount(CellPreviewEvent.getType()));

    // setDataDisplay.
    nodeInfo.setDataDisplay(display);
    assertEquals(1, display.getHandlerCount(CellPreviewEvent.getType()));
    provider.assertLastRangeChanged(display);
    provider.clearLastRangeChanged();

    display.setVisibleRange(0, 5);
    provider.assertLastRangeChanged(display);
    provider.clearLastRangeChanged();

    // unsetDataDisplay.
    nodeInfo.unsetDataDisplay();
    assertEquals(0, display.getHandlerCount(CellPreviewEvent.getType()));
    display.setVisibleRange(0, 5);
    provider.assertLastRangeChanged(null);
  }
Beispiel #2
0
  public void testAccessors() {
    ListDataProvider<String> provider = new ListDataProvider<String>();
    TextCell cell = new TextCell();
    SingleSelectionModel<String> selectionModel = new SingleSelectionModel<String>(null);
    ValueUpdater<String> valueUpdater =
        new ValueUpdater<String>() {
          @Override
          public void update(String value) {}
        };
    DefaultNodeInfo<String> nodeInfo =
        new DefaultNodeInfo<String>(provider, cell, selectionModel, valueUpdater);

    assertEquals(provider, nodeInfo.getProvidesKey());
    assertEquals(cell, nodeInfo.getCell());
    assertEquals(selectionModel, nodeInfo.getSelectionModel());
    assertEquals(valueUpdater, nodeInfo.getValueUpdater());
  }