Bug 214572 Implement IAggregationCellViewProvider for crosstab/chart integration
This interface implements the model logic for the designer UI, when the users design a crosstab with charts. Note that it is independent from the multi-view feature. /** * Return the name of this view */ String getViewName( ); // this should simply return "chart" /** * Returns if the given aggregation cell matches this view */ boolean matchView( AggregationCellHandle cell ); Returns true if chart is supported in this type of aggregation cell /** * Switches given aggregation cell to this view */ void switchView( AggregationCellHandle cell ); create a chart inside the aggregation cell (and remove the data elements). This method is called when the UI tries to switch the cell contents from data element to chart. /** * Restores given aggregation cell to previous view */ void restoreView( AggregationCellHandle cell );
chart/org.eclipse.birt.chart.reportitem.ui/src/org/eclipse/birt/chart/reportitem/ui/ChartReportItemUIImpl.java
double dWidthInPoints = ChartWizard.DEFAULT_CHART_BLOCK_WIDTH;		
			
			final DimensionHandle dhHeight = eih.getHeight( );
			final DimensionHandle dhWidth = eih.getWidth( );
			double dOriginalHeight = dhHeight.getMeasure( );
			String sHeightUnits = dhHeight.getUnits( );
			double dOriginalWidth = dhWidth.getMeasure( );
			String sWidthUnits = dhWidth.getUnits( );
			
			final IDisplayServer idsSWT = ChartUIUtil.getDisplayServer( ); 
			
			if ( sHeightUnits != null )
			{				
				
				
				if ( sHeightUnits == DesignChoiceConstants.UNITS_PX )
				{
					dOriginalHeight = ChartUtil.convertPixelsToPoints( idsSWT,
							dOriginalHeight );
					sHeightUnits = DesignChoiceConstants.UNITS_PT;
				}
				
				if ( sHeightUnits == DesignChoiceConstants.UNITS_PERCENTAGE )
				{
					IFigure parentFigure = ifg.getParent( );
					if ( parentFigure != null )
					{
						int height = (int) ( ( parentFigure.getSize( ).height - parentFigure.getInsets( )
								.getHeight( ) )
								* dOriginalHeight / 100 );