Java Code Examples for org.eclipse.draw2d.IFigure#getMinimumSize()
The following examples show how to use
org.eclipse.draw2d.IFigure#getMinimumSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListLayout.java From birt with Eclipse Public License 1.0 | 5 votes |
protected Dimension calculateMinimumSize( IFigure container, int wHint, int hHint ) { Dimension dim = new Dimension( ); List list = container.getChildren( ); int size = list.size( ); int height = 0; int width = 0; for ( int i = 0; i < size; i++ ) { IFigure figure = (IFigure) list.get( i ); Dimension min = figure.getMinimumSize( wHint, hHint ); height = height + min.height; if ( min.width > width ) { width = min.width; } } if ( height > 0 ) { dim.height = height + container.getInsets( ).getHeight( ) + ( size - 1 ) * verticalSpan; } dim.width = width + container.getInsets( ).getWidth( ); //dim.expand(container.getInsets().getWidth(), // container.getInsets().getHeight()); return dim; }
Example 2
Source File: FixTableLayout.java From birt with Eclipse Public License 1.0 | 4 votes |
private void initRowMinSize( List children ) { int size = children.size( ); //Map map = getOwner( ).getViewer( ).getVisualPartMap( ); for ( int i = 0; i < size; i++ ) { IFigure figure = (IFigure) children.get( i ); //ITableLayoutCell cellPart = (ITableLayoutCell) map.get( figure ); FigureInfomation info = figureInfo.get( figure ); int rowNumber = info.rowNumber; TableLayoutData.RowData rowData = data.findRowData( rowNumber ); if ( rowData.isForce ) { continue; } int columnNumber = info.columnNumber; int columnSpan = info.columnSpan; int rowSpan = info.rowSpan; if ( rowSpan != 1 ) { continue; } int colWidth = getColumnWith( columnNumber, columnSpan ); Dimension dim = figure.getMinimumSize( colWidth, -1 ); if ( rowData.isSetting ) { if ( dim.height > rowData.trueMinRowHeight ) { rowData.trueMinRowHeight = dim.height; rowData.isSetting = true; } } else if ( figure.getChildren( ).size( ) > 0 ) { if ( dim.height > rowData.trueMinRowHeight ) { rowData.trueMinRowHeight = dim.height; } rowData.height = getOwner( ).getFixAllowMinRowHight( ); rowData.isSetting = true; } // else if ( dim.height > rowData.trueMinRowHeight ) // { // rowData.trueMinRowHeight = dim.height; // } } }
Example 3
Source File: ListBandLayout.java From birt with Eclipse Public License 1.0 | 4 votes |
protected Dimension calculateMinimumSize( IFigure container, int wHint, int hHint ) { Dimension dim = new Dimension( ); List list = container.getChildren( ); int size = list.size( ); int height = 0; int width = 0; ReportShowFigure showFigure = null; if ( container instanceof ReportShowFigure ) { showFigure = (ReportShowFigure) container; } for ( int i = 0; i < size; i++ ) { IFigure figure = (IFigure) list.get( i ); if ( showFigure == null || showFigure.getContent( ) != figure || showFigure.isControlShowing( ) ) { Dimension min = figure.getMinimumSize( wHint, hHint ); height = height + min.height; if ( min.width > width ) { width = min.width; } } } if ( height > 0 ) { dim.height = height + container.getInsets( ).getHeight( ) + ( size - 1 ) * verticalSpan; } dim.width = width + container.getInsets( ).getWidth( ); return dim; }
Example 4
Source File: TableLayout.java From birt with Eclipse Public License 1.0 | 4 votes |
private void initRowMinSize( List children ) { int size = children.size( ); //Map map = getOwner( ).getViewer( ).getVisualPartMap( ); for ( int i = 0; i < size; i++ ) { IFigure figure = (IFigure) children.get( i ); FigureInfomation info = figureInfo.get( figure ); int rowNumber = info.rowNumber; int columnNumber = info.columnNumber; int rowSpan = info.rowSpan; int columnSpan = info.columnSpan; TableLayoutData.RowData rowData = data.findRowData( rowNumber ); TableLayoutData.ColumnData columnData = data.findColumnData( columnNumber ); int colWidth = columnData.width; if ( columnSpan > 1 ) { for ( int k = 1; k < columnSpan; k++ ) { TableLayoutData.ColumnData cData = data.findColumnData( columnNumber + k ); if ( cData != null ) { colWidth += cData.width; } } } Dimension dim = figure.getMinimumSize( colWidth, -1 ); if ( dim.height > rowData.minRowHeight && rowSpan == 1 ) { rowData.minRowHeight = dim.height; } if ( dim.height > rowData.trueMinRowHeight && rowSpan == 1 ) { rowData.trueMinRowHeight = dim.height; rowData.isSetting = true; } } }
Example 5
Source File: TableLayout.java From birt with Eclipse Public License 1.0 | 4 votes |
private void initMinSize( List children ) { int size = children.size( ); Map map = getOwner( ).getViewer( ).getVisualPartMap( ); for ( int i = 0; i < size; i++ ) { IFigure figure = (IFigure) children.get( i ); ITableLayoutCell cellPart = (ITableLayoutCell) map.get( figure ); int rowNumber = cellPart.getRowNumber( ); int columnNumber = cellPart.getColumnNumber( ); int rowSpan = cellPart.getRowSpan( ); int columnSpan = cellPart.getColSpan( ); FigureInfomation info = new FigureInfomation( ); info.rowNumber = rowNumber; info.columnNumber = columnNumber; info.rowSpan = rowSpan; info.columnSpan = columnSpan; figureInfo.put( figure, info ); // may be implement a interface // get minimum size of cell figure Dimension dim = figure.getMinimumSize( ); TableLayoutData.RowData rowData = data.findRowData( rowNumber ); TableLayoutData.ColumnData columnData = data.findColumnData( columnNumber ); if ( dim.height > rowData.minRowHeight && rowSpan == 1 ) { rowData.minRowHeight = dim.height; } if ( dim.height > rowData.trueMinRowHeight && rowSpan == 1 ) { rowData.trueMinRowHeight = dim.height; rowData.isSetting = true; } // max(defaultValue,MCW) if ( dim.width > columnData.minColumnWidth && columnSpan == 1 ) { columnData.minColumnWidth = dim.width; } if ( dim.width > columnData.trueMinColumnWidth && columnSpan == 1 ) { columnData.trueMinColumnWidth = dim.width; columnData.isSetting = true; } } }