Package org.eclipse.nebula.widgets.nattable.test.fixture.layer

Examples of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture


        Assert.assertEquals(col1MaxTextWidth, col1AdjustedMaxWidth);
    }

    @Test
    public void getPreferedRowHeights() throws Exception {
        DataLayerFixture dataLayer = new DataLayerFixture(3, 2, 10, 10);
        IDataProvider dataProvider = dataLayer.getDataProvider();

        // Row 0
        dataProvider.setDataValue(0, 0, "..");
        dataProvider.setDataValue(1, 0, "...");
        dataProvider.setDataValue(2, 0, "...");

        // Row 1
        dataProvider.setDataValue(0, 1, "Elephant");
        dataProvider.setDataValue(1, 1, "Cat");
        dataProvider.setDataValue(2, 1, "Rat");

        AutoResizeRowCommandFixture command = new AutoResizeRowCommandFixture();
        GCFactory gcFactory = command.getGCFactory();
        IConfigRegistry registry = command.getConfigRegistry();
        GC gc = gcFactory.createGC();
        int row0MaxTextHeight = new TextPainter().getPreferredHeight(
                new CellFixture(".."), gc, registry);
        int row1MaxTextHeight = new TextPainter().getPreferredHeight(
                new CellFixture("Elephant"), gc, registry);
        gc.dispose();

        int[] maxRowHeights = MaxCellBoundsHelper.getPreferredRowHeights(
                registry, gcFactory, dataLayer, new int[] { 0, 1 });

        // Adjust heights
        int row0AdjustedMaxHeight = dataLayer.getLayerPainter()
                .adjustCellBounds(0, 0,
                        new Rectangle(0, 0, 10, maxRowHeights[0])).height;
        int row1AdjustedMaxHeight = dataLayer.getLayerPainter()
                .adjustCellBounds(0, 1,
                        new Rectangle(0, 0, 10, maxRowHeights[1])).height;

        Assert.assertEquals(row0MaxTextHeight, row0AdjustedMaxHeight);
        Assert.assertEquals(row1MaxTextHeight, row1AdjustedMaxHeight);
View Full Code Here


    }

    @Test
    public void showColumnPositions() throws Exception {
        columnHideShowLayer = new ColumnHideShowLayerFixture(
                new DataLayerFixture(10, 2, 100, 20));

        assertEquals(10, columnHideShowLayer.getColumnCount());

        columnHideShowLayer.hideColumnPositions(Arrays.asList(3, 4, 5));
        assertEquals(7, columnHideShowLayer.getColumnCount());
View Full Code Here

    private DataLayerFixture dataLayer;

    @Before
    public void setUp() {
        // Total width should be 500 and total height should be 280
        dataLayer = new DataLayerFixture(100, 40);
    }
View Full Code Here

    private PropertyChangeListener getPropertyChangeListener() {
        return new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent event) {
                PropertyUpdateEvent<BlinkingRowDataFixture> updateEvent = new PropertyUpdateEvent<BlinkingRowDataFixture>(
                        new DataLayerFixture(),
                        (BlinkingRowDataFixture) event.getSource(),
                        event.getPropertyName(), event.getOldValue(),
                        event.getNewValue());
                layerUnderTest.handleLayerEvent(updateEvent);
            }
View Full Code Here

    private RowHideShowLayer hideShowLayer;
    private ViewportLayer viewportLayer;

    @Before
    public void before() {
        dataLayer = new DataLayerFixture(20, 20, 100, 40);
        hideShowLayer = new RowHideShowLayer(dataLayer);
        viewportLayer = new ViewportLayer(hideShowLayer);
        viewportLayer.setClientAreaProvider(new IClientAreaProvider() {

            @Override
View Full Code Here

    private ColumnResizeEvent event;
    private ViewportLayer viewportLayer;

    @Before
    public void before() {
        DataLayerFixture dataLayer = new DataLayerFixture(20, 20, 100, 40);
        viewportLayer = new ViewportLayer(dataLayer);
        viewportLayer.setClientAreaProvider(new IClientAreaProvider() {

            public Rectangle getClientArea() {
                return new Rectangle(0, 0, 400, 400);
View Full Code Here

    private PositionCoordinate p1;
    private PositionCoordinate p2;

    @Before
    public void setup() {
        ILayer layer = new DataLayerFixture();
        p1 = new PositionCoordinate(layer, 1, 2);
        p2 = new PositionCoordinate(layer, 1, 2);
    }
View Full Code Here

    private BaseColumnReorderLayerFixture reorderLayer;

    @Before
    public void setUp() {
        dataLayer = new DataLayerFixture(100, 40);
        reorderLayer = new BaseColumnReorderLayerFixture(dataLayer);
        layerListener = new LayerListenerFixture();
        reorderLayer.addLayerListener(layerListener);
    }
View Full Code Here

    private ColumnHideShowLayer hideShowLayer;
    private ViewportLayer viewportLayer;

    @Before
    public void before() {
        dataLayer = new DataLayerFixture(20, 20, 100, 40);
        hideShowLayer = new ColumnHideShowLayer(dataLayer);
        viewportLayer = new ViewportLayer(hideShowLayer);
        viewportLayer.setClientAreaProvider(new IClientAreaProvider() {

            public Rectangle getClientArea() {
View Full Code Here

    }

    @Test
    public void shouldPickUpTheDefaultClientAreaIfItHasNotBeenSet()
            throws Exception {
        ViewportLayer viewportLayer = new ViewportLayer(new DataLayerFixture());
        assertEquals(IClientAreaProvider.DEFAULT,
                viewportLayer.getClientAreaProvider());
    }
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.