Java Code Examples for org.eclipse.draw2d.geometry.Insets#getWidth()

The following examples show how to use org.eclipse.draw2d.geometry.Insets#getWidth() . 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: DropShadowRectangle.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private Rectangle shrink(final Rectangle bounds, final Insets insets) {
    final Rectangle shrinked = bounds.getCopy();

    shrinked.x += insets.left;
    shrinked.y += insets.top;
    shrinked.width -= insets.getWidth();
    shrinked.height -= insets.getHeight();

    return shrinked;
}
 
Example 2
Source File: PrintERDiagramOperation.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private Rectangle shrink(final Rectangle bounds, final Insets insets) {
    final Rectangle shrinked = bounds.getCopy();

    shrinked.x += insets.left;
    shrinked.y += insets.top;
    shrinked.width -= insets.getWidth();
    shrinked.height -= insets.getHeight();

    return shrinked;
}
 
Example 3
Source File: DropShadowRectangle.java    From erflute with Apache License 2.0 5 votes vote down vote up
private Rectangle shrink(Rectangle bounds, Insets insets) {
    final Rectangle shrinked = bounds.getCopy();
    shrinked.x += insets.left;
    shrinked.y += insets.top;
    shrinked.width -= insets.getWidth();
    shrinked.height -= insets.getHeight();

    return shrinked;
}
 
Example 4
Source File: PrintERDiagramOperation.java    From erflute with Apache License 2.0 5 votes vote down vote up
private Rectangle shrink(Rectangle bounds, Insets insets) {
    final Rectangle shrinked = bounds.getCopy();

    shrinked.x += insets.left;
    shrinked.y += insets.top;
    shrinked.width -= insets.getWidth();
    shrinked.height -= insets.getHeight();

    return shrinked;
}
 
Example 5
Source File: ImageFigure.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns the size of the Image that this Figure displays; or (0,0) if no
 * Image has been set.
 * 
 * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
 */
public Dimension getPreferredSize( int wHint, int hHint )
{
	if ( getBorder( ) != null )
	{
		Insets bdInsets = getBorder( ).getInsets( this );

		return new Dimension( size.width + bdInsets.getWidth( ),
				size.height + bdInsets.getHeight( ) );
	}

	return size;
}
 
Example 6
Source File: DropShadowRectangle.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private Rectangle shrink(Rectangle bounds, Insets insets) {
	Rectangle shrinked = bounds.getCopy();

	shrinked.x += insets.left;
	shrinked.y += insets.top;
	shrinked.width -= insets.getWidth();
	shrinked.height -= insets.getHeight();

	return shrinked;
}
 
Example 7
Source File: PrintERDiagramOperation.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private Rectangle shrink(Rectangle bounds, Insets insets) {
	Rectangle shrinked = bounds.getCopy();

	shrinked.x += insets.left;
	shrinked.y += insets.top;
	shrinked.width -= insets.getWidth();
	shrinked.height -= insets.getHeight();

	return shrinked;
}
 
Example 8
Source File: ReportDesignEditPart.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void refreshFigure( )
{

	SimpleMasterPageHandle masterPageHandle = getSimpleMasterPageHandle( );

	Dimension size = getMasterPageSize( masterPageHandle );

	Rectangle bounds = new Rectangle( 0, 0, size.width - 1, size.height - 1 );

	ReportRootFigure figure = (ReportRootFigure) getFigure( );
	figure.setShowMargin( showMargin );

	( (ReportDesignLayout) ( figure.getLayoutManager( ) ) ).setAuto( DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_AUTO_LAYOUT.equals( ( (ReportDesignHandle) getModel( ) ).getLayoutPreference( ) ) );
	/*
	 * Bidi-specific properties are affected only if Bidi Support is enabled
	 */

	( (ReportDesignLayout) ( figure.getLayoutManager( ) ) ).setAuto( DesignChoiceConstants.BIDI_DIRECTION_LTR.equals( ( (ReportDesignHandle) getModel( ) ).getBidiOrientation( ) ) );

	if ( !showMargin )
	{
		Insets mg = getMasterPageInsets( masterPageHandle );

		bounds.width -= mg.getWidth( );
		bounds.height -= mg.getHeight( );
	}
	Insets initInsets = getMasterPageInsets( masterPageHandle );
	( (AbstractPageFlowLayout) getFigure( ).getLayoutManager( ) ).setInitSize( bounds );
	( (AbstractPageFlowLayout) getFigure( ).getLayoutManager( ) ).setInitInsets( initInsets );

	refreshMarginBorder( (ReportDesignMarginBorder) getFigure( ).getBorder( ) );
	// getFigure( ).setBounds( bounds );

	int color = getBackgroundColor( masterPageHandle );
	getFigure( ).setBackgroundColor( getBackGroundColor( color ) );

	refreshBackground( masterPageHandle );
	( (ReportElementFigure) getFigure( ) ).setBackGroundImageSize( getModelAdapter( ).getBackgroundImageWidth( masterPageHandle,
			size,
			getBackImage( masterPageHandle ) ),
			getModelAdapter( ).getBackgroundImageHeight( masterPageHandle,
					size,
					getBackImage( masterPageHandle ) ) );
}
 
Example 9
Source File: ReportFlowLayout.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void layout( IFigure parent, WorkingData data )
{
	Iterator iterator = parent.getChildren( ).iterator( );
	int dx;
	int i = 0;
	int display = ReportItemConstraint.BLOCK;
	int lastDisplay = ReportItemConstraint.BLOCK;

	int wHint = parent.getClientArea( ).width;
	int hHint = -1;
	
	while ( iterator.hasNext( ) )
	{
		IFigure f = (IFigure) iterator.next( );

		Insets fmargin = getFigureMargin( f );

		// fix bugzilla 156157
		// always pass hint here, let child process inline/block cases. this
		// is to resovle percentage custom size
		wHint = parent.getClientArea( ).width;

		if ( wHint != -1 )
		{
			wHint = Math.max( 0, wHint - fmargin.getWidth( ) );
		}

		Dimension pref = getChildSize( f, wHint, hHint );

		// Hack to allow in-line label wrap.
		if ( f instanceof LabelFigure
				&& ( pref.width + fmargin.getWidth( ) ) > parent.getClientArea( ).width )
		{
			pref = getChildSize( f,
					Math.max( 0, parent.getClientArea( ).width
							- fmargin.getWidth( ) ),
					hHint );
		}

		Rectangle r = new Rectangle( 0,
				0,
				pref.width + fmargin.getWidth( ),
				pref.height + fmargin.getHeight( ) );

		display = getDisplay( f );

		if ( data.rowCount > data.rowPos )
		{
			if ( ( data.rowWidth + r.width > data.maxWidth )
					|| display == ReportItemConstraint.BLOCK
					|| lastDisplay == ReportItemConstraint.BLOCK )
				layoutRow( parent );
		}
		lastDisplay = display;

		r.x = data.rowX;
		r.y = data.rowY;
		dx = r.width + getMinorSpacing( );
		data.rowX += dx;
		data.rowWidth += dx;
		data.rowHeight = Math.max( data.rowHeight, r.height );
		data.row[data.rowCount] = f;
		data.margin[data.rowCount] = fmargin;
		data.bounds[data.rowCount] = r;
		data.rowCount++;
		i++;
	}
	if ( data.rowCount > data.rowPos )
	{
		layoutRow( parent );
	}
	layoutVertical( parent );
}
 
Example 10
Source File: ReportFlowLayout.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void layout( IFigure parent, WorkingData data )
{
	Iterator iterator = parent.getChildren( ).iterator( );
	int dx;
	int i = 0;

	int display = ReportItemConstraint.BLOCK;
	int lastDisplay = ReportItemConstraint.BLOCK;
	int hHint = -1;
	
	while ( iterator.hasNext( ) )
	{
		int wHint = parent.getClientArea( ).width;
		IFigure f = (IFigure) iterator.next( );

		Insets fmargin = getFigureMargin( f );

		if ( wHint != -1 )
		{
			wHint = Math.max( 0, wHint - fmargin.getWidth( ) );
		}

		Dimension pref = getChildSize( f, wHint, hHint );
		display = getDisplay( f );
		if (display == ReportItemConstraint.INLINE && f instanceof LabelFigure && lastDisplay == ReportItemConstraint.INLINE)
		{
			pref = getChildSize( f,  wHint - data.rowWidth  <=0 ? -1:wHint - data.rowWidth , hHint );
			if (pref.width ==  wHint - data.rowWidth)
			{
				pref = getChildSize( f,  -1, hHint );
			}
		}
		else if (display == ReportItemConstraint.INLINE)
			
		{
			pref = getChildSize( f,  -1, hHint );
		}
		
		Rectangle r = new Rectangle( 0,
				0,
				pref.width + fmargin.getWidth( ),
				pref.height + fmargin.getHeight( ) );

		if ( data.rowCount > data.rowPos )
		{
			if ( ( data.rowWidth + r.width > data.maxWidth ) 
					|| display == ReportItemConstraint.BLOCK 
						|| lastDisplay == ReportItemConstraint.BLOCK)
				layoutRow( parent );
		}
		lastDisplay = display;
		r.x = data.rowX;
		r.y = data.rowY;
		dx = r.width + getMinorSpacing( );
		data.rowX += dx;
		data.rowWidth += dx;
		data.rowHeight = Math.max( data.rowHeight, r.height );
		data.row[data.rowCount] = f;
		data.margin[data.rowCount] = fmargin;
		data.bounds[data.rowCount] = r;
		data.rowCount++;
		i++;
	}
	if ( data.rowCount > data.rowPos )
	{
		layoutRow( parent );
	}
	layoutVertical( parent );
}