Java Code Examples for org.eclipse.draw2d.geometry.Dimension#getExpanded()

The following examples show how to use org.eclipse.draw2d.geometry.Dimension#getExpanded() . 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: EditorGuideFigure.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public Dimension getPreferredSize( int wHint, int hHint )
{
	Dimension prefSize;
	if ( isHorizontal( ) )
	{
		prefSize = H_PREFSIZE.getCopy( );
	}
	else
	{
		prefSize = V_PREFSIZE.getCopy( );
	}
	if ( getBorder( ) != null )
	{
		prefSize = prefSize.getExpanded( getInsets( ).getWidth( ),
				getInsets( ).getHeight( ) );
	}
	return prefSize;
}
 
Example 2
Source File: CenterLayout.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint) {
	for (final Object child : container.getChildren()) {
		final Dimension childDimension = ((IFigure) child).getPreferredSize();
		return childDimension.getExpanded(PADDING_X * 2, PADDING_Y * 2);
	}

	return new Dimension(PADDING_X * 2, PADDING_Y * 2);
}