Java Code Examples for org.eclipse.draw2d.IFigure#getInsets()

The following examples show how to use org.eclipse.draw2d.IFigure#getInsets() . 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: LaneFigure.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * This is a copy of the parent method. Only change is that we call getContraintAsRectangle() instead of directly accessing the constraints member.
 */
@Override
protected Dimension calculatePreferredSize(IFigure f, int wHint, int hHint) {
	final Rectangle rect = new Rectangle();
	final ListIterator children = f.getChildren().listIterator();
	while (children.hasNext()) {
		final IFigure child = (IFigure) children.next();
		Rectangle r = getConstraintAsRectangle(child);
		if (r == null)
			continue;

		if ((r.width == -1) || (r.height == -1)) {
			final Dimension preferredSize = child.getPreferredSize(r.width, r.height);
			r = r.getCopy();
			if (r.width == -1)
				r.width = preferredSize.width;
			if (r.height == -1)
				r.height = preferredSize.height;
		}
		rect.union(r);
	}
	final Dimension d = rect.getSize();
	final Insets insets = f.getInsets();
	return new Dimension(d.width + insets.getWidth(), d.height + insets.getHeight()).union(getBorderPreferredSize(f));
}
 
Example 2
Source File: CrosstabRowDragTracker.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected Rectangle getMarqueeSelectionRectangle( )
{
	IFigure figure = getCrosstabTableEditPart( ).getFigure( );
	Insets insets = figure.getInsets( );

	int value = getLocation( ).y - getStartLocation( ).y;
	value = getTrueValueAbsolute( value );

	Point p = getStartLocation( ).getCopy( );
	figure.translateToAbsolute( p );
	figure.translateToRelative( p );
	Rectangle bounds = figure.getBounds( ).getCopy( );
	figure.translateToAbsolute( bounds );

	return new Rectangle( bounds.x + insets.left, value + p.y, bounds.width
			- ( insets.left + insets.right ), 2 );
}
 
Example 3
Source File: CrosstabColumnDragTracker.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected Rectangle getMarqueeSelectionRectangle( )
{
	IFigure figure = getCrosstabTableEditPart( ).getFigure( );
	Insets insets = figure.getInsets( );

	int value = getLocation( ).x - getStartLocation( ).x;
	value = getTrueValueAbsolute( value );

	Point p = getStartLocation( ).getCopy( );
	figure.translateToAbsolute( p );
	figure.translateToRelative( p );
	Rectangle bounds = figure.getBounds( ).getCopy( );
	figure.translateToAbsolute( bounds );

	return new Rectangle( value + p.x,
			bounds.y + insets.top,
			2,
			bounds.height - ( insets.top + insets.bottom ) );
}
 
Example 4
Source File: ColumnDragTracker.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected Rectangle getMarqueeSelectionRectangle( )
{
	IFigure figure = ( (TableEditPart) getSourceEditPart( ) ).getFigure( );
	Insets insets = figure.getInsets( );

	int value = getLocation( ).x - getStartLocation( ).x;
	value = getTrueValueAbsolute( value );

	Point p = getStartLocation( ).getCopy( );
	figure.translateToAbsolute( p );
	figure.translateToRelative( p );
	Rectangle bounds = figure.getBounds( ).getCopy( );
	figure.translateToAbsolute( bounds );

	return new Rectangle( value + p.x,
			bounds.y + insets.top,
			2,
			bounds.height - ( insets.top + insets.bottom ) );

}
 
Example 5
Source File: RowDragTracker.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected Rectangle getMarqueeSelectionRectangle( )
{
	IFigure figure = ( (TableEditPart) getSourceEditPart( ) ).getFigure( );
	Insets insets = figure.getInsets( );

	int value = getLocation( ).y - getStartLocation( ).y;
	value = getTrueValueAbsolute( value );

	Point p = getStartLocation( ).getCopy( );
	figure.translateToAbsolute( p );
	figure.translateToRelative( p );
	Rectangle bounds = figure.getBounds( ).getCopy( );
	figure.translateToAbsolute( bounds );

	return new Rectangle( bounds.x + insets.left, value + p.y, bounds.width
			- ( insets.left + insets.right ), 2 );
}
 
Example 6
Source File: TankFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Dimension calculatePreferredSize(IFigure container, int w,
		int h) {
	Insets insets = container.getInsets();
	Dimension d = new Dimension(64, 4*64);
	d.expand(insets.getWidth(), insets.getHeight());
	return d;
}
 
Example 7
Source File: GaugeFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Dimension calculatePreferredSize(IFigure container, int w,
		int h) {
	Insets insets = container.getInsets();
	Dimension d = new Dimension(256, 256);
	d.expand(insets.getWidth(), insets.getHeight());
	return d;
}
 
Example 8
Source File: ScaledSliderFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Dimension calculatePreferredSize(IFigure container, int w,
		int h) {
	Insets insets = container.getInsets();
	Dimension d = new Dimension(64, 4*64);
	d.expand(insets.getWidth(), insets.getHeight());
	return d;
}
 
Example 9
Source File: ThermometerFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Dimension calculatePreferredSize(IFigure container, int w,
		int h) {
	Insets insets = container.getInsets();
	Dimension d = new Dimension(64, 4*64);
	d.expand(insets.getWidth(), insets.getHeight());
	return d;
}
 
Example 10
Source File: MeterFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Dimension calculatePreferredSize(IFigure container, int w,
		int h) {
	Insets insets = container.getInsets();
	Dimension d = new Dimension(256, 256);
	d.expand(insets.getWidth(), insets.getHeight());
	return d;
}
 
Example 11
Source File: ProgressBarFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Dimension calculatePreferredSize(IFigure container, int w,
		int h) {
	Insets insets = container.getInsets();
	Dimension d = new Dimension(64, 4*64);
	d.expand(insets.getWidth(), insets.getHeight());
	return d;
}
 
Example 12
Source File: KnobFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Dimension calculatePreferredSize(IFigure container, int w,
		int h) {
	Insets insets = container.getInsets();
	Dimension d = new Dimension(256, 256);
	d.expand(insets.getWidth(), insets.getHeight());
	return d;
}
 
Example 13
Source File: ComponentMeterFigure.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
protected Dimension calculatePreferredSize(IFigure container, int w,
        int h) {
    Insets insets = container.getInsets();
    Dimension d = new Dimension(container.getClientArea().width, container.getClientArea().height);
    d.expand(insets.getWidth(), insets.getHeight());
    return d;
}