designHandle = new SessionHandle( ULocale.getDefault( ) ).createDesign( ); design = (ReportDesign) designHandle.module;
designHandle = new SessionHandle( ULocale.getDefault( ) ) .createDesign( ); design = (ReportDesign) designHandle.getModule( );
	public void testCopyColumnHeader( ) throws Exception	{		designHandle = new SessionHandle( ULocale.getDefault( ) ).createDesign( );		design = (ReportDesign) designHandle.module;		ElementFactory factory = new ElementFactory( design );		GridHandle grid1 = factory.newGridItem( "grid1", 3, 2 ); //$NON-NLS-1$		GridHandle grid2 = factory.newGridItem( "grid2", 3, 2 ); //$NON-NLS-1$		SlotHandle columns1 = grid1.getColumns( );		// from column 1 to column 1.		ColumnHandle column1InTable1 = (ColumnHandle) columns1.get( 0 );		column1InTable1.setStringProperty( Style.COLOR_PROP,				IColorConstants.AQUA );		// make only 1 column in grid 2.		SlotHandle columns2 = grid2.getColumns( );		int numOfColumnsInTable2 = columns2.getCount( );		for ( int i = 0; i < numOfColumnsInTable2 - 1; i++ )			columns2.dropAndClear( 0 );		ColumnHandle columnInTable2 = (ColumnHandle) columns2.get( 0 );		columnInTable2.setRepeatCount( 3 );		assertEquals( 1, columns2.getCount( ) );		// copy from column 1 to column 1, splitting columns is required.		ColumnBandData data = grid1.copyColumn( 1 );		grid2.pasteColumn( data, 1, true );		assertEquals( 2, columns2.getCount( ) );		ColumnHandle column1InTable2 = (ColumnHandle) columns2.get( 0 );		assertEquals( IColorConstants.AQUA, column1InTable2				.getProperty( Style.COLOR_PROP ) );		ColumnHandle column2InTable2 = (ColumnHandle) columns2.get( 1 );		assertEquals( 2, column2InTable2.getRepeatCount( ) );		assertEquals( IColorConstants.BLACK, column2InTable2				.getProperty( Style.COLOR_PROP ) );		// make only 1 column in grid 2.		numOfColumnsInTable2 = columns2.getCount( );		for ( int i = 0; i < numOfColumnsInTable2 - 1; i++ )			columns2.dropAndClear( 0 );		columnInTable2 = (ColumnHandle) columns2.get( 0 );		columnInTable2.setRepeatCount( 3 );		assertEquals( 1, columns2.getCount( ) );		// copy from column 1 to column 3, splitting columns is required.		data = grid1.copyColumn( 1 );		grid2.pasteColumn( data, 3, true );		assertEquals( 2, columns2.getCount( ) );		column1InTable2 = (ColumnHandle) columns2.get( 0 );		assertEquals( 2, column1InTable2.getRepeatCount( ) );		assertEquals( IColorConstants.BLACK, column1InTable2				.getProperty( Style.COLOR_PROP ) );		column2InTable2 = (ColumnHandle) columns2.get( 1 );		assertEquals( IColorConstants.AQUA, column2InTable2				.getProperty( Style.COLOR_PROP ) );		// make only 1 column in grid 2.		numOfColumnsInTable2 = columns2.getCount( );		columns2.dropAndClear( 1 );		columnInTable2 = (ColumnHandle) columns2.get( 0 );		columnInTable2.setRepeatCount( 3 );		assertEquals( 1, columns2.getCount( ) );		// copy from column 1 to column 2, splitting columns is required.		// Becomes 3 columns		data = grid1.copyColumn( 1 );		grid2.pasteColumn( data, 2, true );		assertEquals( 3, columns2.getCount( ) );		// verify column 1.		column1InTable2 = (ColumnHandle) columns2.get( 0 );		assertEquals( 1, column1InTable2.getRepeatCount( ) );		assertEquals( IColorConstants.BLACK, column1InTable2				.getProperty( Style.COLOR_PROP ) );		// verify column 2.		column2InTable2 = (ColumnHandle) columns2.get( 1 );		assertEquals( 1, column2InTable2.getRepeatCount( ) );		assertEquals( IColorConstants.AQUA, column2InTable2				.getProperty( Style.COLOR_PROP ) );		// verify column 3.		ColumnHandle column3InTable2 = (ColumnHandle) columns2.get( 2 );		assertEquals( 1, column3InTable2.getRepeatCount( ) );		assertEquals( IColorConstants.BLACK, column3InTable2				.getProperty( Style.COLOR_PROP ) );	}