}else if(selTemplate.getThumbnail( ) != null && selTemplate.getThumbnail( ).length != 0) { previewCanvas.setVisible( true ); previewThumbnail.setVisible( false );  byte[] thumbnailData = selTemplate.getThumbnail( ); ByteArrayInputStream inputStream = new ByteArrayInputStream( thumbnailData ); if(thumbnailImage != null) { thumbnailImage.dispose( ); thumbnailImage = null; } thumbnailImage = new Image( null, inputStream );  previewCanvas.clear( ); previewCanvas.loadImage( ( (Image) thumbnailImage ) ); } else { previewCanvas.setVisible( false ); previewThumbnail.setVisible( true );  Control[] children = previewThumbnail.getChildren( ); for ( int i = 0; i < children.length; i++ ) { children[i].dispose( ); } ReportGraphicsViewComposite thumbnail = new ReportGraphicsViewComposite( previewThumbnail, SWT.NULL, ( (Template) templates.get( selectedIndex ) ).getReportDesignHandle( ) );  previewThumbnail.layout( );
		public void handleEvent( Event event )		{			// change description/image			selectedIndex = templateList.getSelectionIndex( );			description.setText( ( (Template) templates.get( selectedIndex ) ).getTemplateDescription( ) );			// we need to relayout if the new text has different number of lines			previewPane.layout( );			Template selTemplate = (Template) templates.get( selectedIndex );			String key = selTemplate.getPictureName( );			Object img = null;			if ( key == null || "".equals( key.trim( ) ) ) //$NON-NLS-1$			{				previewCanvas.setVisible( false );				previewThumbnail.setVisible( true );				Control[] children = previewThumbnail.getChildren( );				for ( int i = 0; i < children.length; i++ )				{					children[i].dispose( );				}				ReportGraphicsViewComposite thumbnail = new ReportGraphicsViewComposite( previewThumbnail,						SWT.NULL,						( (Template) templates.get( selectedIndex ) ).getReportDesignHandle( ) );				previewThumbnail.layout( );			}			else			{				key = selTemplate.getPictureFullName( );				img = imageMap.get( key );				if ( img == null )				{					img = ReportPlugin.getImage( key );					imageMap.put( key, img );				}				previewCanvas.setVisible( true );				previewThumbnail.setVisible( false );				previewCanvas.clear( );				previewCanvas.loadImage( ( (Image) img ) );				previewCanvas.showOriginal( );			}			chkBox.setEnabled( !( ( (Template) templates.get( selectedIndex ) ).getCheatSheetId( )					.equals( "" ) || ( (Template) templates.get( selectedIndex ) ).getCheatSheetId( )					.equals( "org.eclipse.birt.report.designer.ui.cheatsheet.firstreport" ) ) ); //$NON-NLS-1$		}