Search in sources :

Example 1 with DefaultNodeInfo

use of org.gwtproject.view.client.TreeViewModel.DefaultNodeInfo in project gwtproject by treblereel.

the class DefaultNodeInfoTest method testSetDataDisplay.

public void testSetDataDisplay() {
    SelectionModel<String> model = new SingleSelectionModel<String>();
    org.gwtproject.view.client.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(org.gwtproject.view.client.CellPreviewEvent.getType()));
    // setDataDisplay.
    nodeInfo.setDataDisplay(display);
    assertEquals(1, display.getHandlerCount(org.gwtproject.view.client.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);
}
Also used : DefaultNodeInfo(org.gwtproject.view.client.TreeViewModel.DefaultNodeInfo) TextCell(org.gwtproject.cell.client.TextCell) MockDataProvider(org.gwtproject.view.client.AbstractDataProviderTest.MockDataProvider)

Example 2 with DefaultNodeInfo

use of org.gwtproject.view.client.TreeViewModel.DefaultNodeInfo in project gwtproject by treblereel.

the class DefaultNodeInfoTest method testAccessors.

public void testAccessors() {
    org.gwtproject.view.client.ListDataProvider<String> provider = new ListDataProvider<String>();
    TextCell cell = new TextCell();
    org.gwtproject.view.client.SingleSelectionModel<String> selectionModel = new org.gwtproject.view.client.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());
}
Also used : DefaultNodeInfo(org.gwtproject.view.client.TreeViewModel.DefaultNodeInfo) TextCell(org.gwtproject.cell.client.TextCell) ValueUpdater(org.gwtproject.cell.client.ValueUpdater)

Aggregations

TextCell (org.gwtproject.cell.client.TextCell)2 DefaultNodeInfo (org.gwtproject.view.client.TreeViewModel.DefaultNodeInfo)2 ValueUpdater (org.gwtproject.cell.client.ValueUpdater)1 MockDataProvider (org.gwtproject.view.client.AbstractDataProviderTest.MockDataProvider)1