Examples of XMutableGridDataModel


Examples of com.sun.star.awt.grid.XMutableGridDataModel

        // TODO: check all those generic properties for equality

        // the data model and the column model should have been cloned, too
        // in particular, the clone should not share the sub models with the orignal
        final XMutableGridDataModel originalDataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class,
            m_gridControlModel.getPropertyValue( "GridDataModel" ) );
        final XMutableGridDataModel clonedDataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class,
            clonedProps.getPropertyValue( "GridDataModel" ) );
        assertFalse( "data model should not be shared after cloning", UnoRuntime.areSame( originalDataModel, clonedDataModel ) );
        impl_assertEquality( originalDataModel, clonedDataModel );

        final XGridColumnModel originalColumnModel = columnModel;
View Full Code Here

Examples of com.sun.star.awt.grid.XMutableGridDataModel

        test.testUpdateRowHeading();
        test.cleanup();

        // a somehwat less straight-forward test: the data model is expected to implicitly increase its column count
        // when you add a row which has more columns than currently known
        final XMutableGridDataModel dataModel = DefaultGridDataModel.create( m_context );
        dataModel.addRow( 0, new Object[] { 1 } );
        assertEquals( "unexpected column count after adding the most simple row", 1, dataModel.getColumnCount() );
        dataModel.addRow( 1, new Object[] { 1, 2 } );
        assertEquals( "implicit extension of the column count doesn't work", 2, dataModel.getColumnCount() );
    }
View Full Code Here

Examples of com.sun.star.awt.grid.XMutableGridDataModel

        // in the current implementation (not sure this is a good idea at all), the control (more precise: the peer)
        // ensures that if there are no columns in the column model, but in the data model, then the column model
        // will implicitly have the needed columns added.
        // To ensure that clients which rely on this do not break in the future, check this here.
        final XMutableGridDataModel dataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class,
            gridModelProps.getPropertyValue( "GridDataModel" ) );
        assertNotNull( dataModel );
        assertEquals( 0, dataModel.getColumnCount() );

        final XGridColumnModel columnModel = UnoRuntime.queryInterface( XGridColumnModel.class,
            gridModelProps.getPropertyValue( "ColumnModel" ) );
        assertNotNull( columnModel );
        assertEquals( 0, columnModel.getColumnCount() );

        final int columnCount = 3;
        final int rowCount = 2;
        dataModel.addRow( null, new Object[] { 1, 2, 3 } );
        dataModel.addRow( null, new Object[] { 6, 5, 4 } );

        assertEquals( columnCount, dataModel.getColumnCount() );
        assertEquals( columnCount, columnModel.getColumnCount() );

        // some cursor traveling
        final XGridControl gridControl = UnoRuntime.queryInterface( XGridControl.class, control );
        gridControl.goToCell( 0, 0 );
        assertEquals( "wrong 'current column' (1)", 0, gridControl.getCurrentColumn() );
        assertEquals( "wrong 'current row' (1)", 0, gridControl.getCurrentRow() );
        gridControl.goToCell( columnCount - 1, rowCount - 1 );
        assertEquals( "wrong 'current column' (2)", dataModel.getColumnCount() - 1, gridControl.getCurrentColumn() );
        assertEquals( "wrong 'current row' (2)", dataModel.getRowCount() - 1, gridControl.getCurrentRow() );

        // removing the last column, while the active cell is in this very last column, is expected to adjust
        // the active cell
        columnModel.removeColumn( columnCount - 1 );
        assertEquals( "removed the last and active column, active column was not adjusted!",
            columnCount - 2, gridControl.getCurrentColumn() );
        // same holds for rows
        dataModel.removeRow( rowCount - 1 );
        assertEquals( "removed the last and active row, active row was not adjusted!",
            rowCount - 2, gridControl.getCurrentRow() );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.