Java Code Examples for org.eclipse.draw2d.geometry.Rectangle#equals()

The following examples show how to use org.eclipse.draw2d.geometry.Rectangle#equals() . 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: ProcessEditPartFactory.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
public void relocate(CellEditor celleditor) {
	Text text = (Text) celleditor.getControl();
	Rectangle rect = getWrapLabel().getTextBounds().getCopy();
	getWrapLabel().translateToAbsolute(rect);
	if (!text.getFont().isDisposed()) {
		if (getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
			//Adjust editor location
			rect.x = rect.x - 5;
			if (rect.width < 75) {
				rect.width = 75;
			}
			rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
		} else {
			int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
			rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
		}
	}
	if (!rect.equals(new Rectangle(text.getBounds()))) {
		text.setBounds(rect.x, rect.y, rect.width, rect.height);
	}
}
 
Example 2
Source File: EditorRulerFigure.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private Rectangle getEndRect( Rectangle clip )
{
	Rectangle rect = getScaleLeftSpace( );

	Rectangle retValue = new Rectangle( );
	if ( rect.equals( new Rectangle( ) ) )
	{
		return retValue;
	}
	if ( isHorizontal( ) )
	{
		retValue.height = clip.height;
		retValue.y = clip.y;
		if ( clip.right( ) > rect.right( ) )
		{
			retValue.x = rect.right( );
			retValue.width = clip.right( ) - rect.right( );

		}
	}
	else
	{
		retValue.width = clip.width;
		retValue.x = clip.x;
		if ( clip.bottom( ) > rect.bottom( ) )
		{
			retValue.y = rect.bottom( );
			retValue.height = clip.bottom( ) - rect.bottom( );

		}
	}
	return retValue;
}
 
Example 3
Source File: ListLayout.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void setBoundsOfChild( IFigure parent, IFigure child,
		Rectangle bounds )
{
	parent.getClientArea( Rectangle.SINGLETON );
	bounds.translate( Rectangle.SINGLETON.x, Rectangle.SINGLETON.y );

	if ( !bounds.equals( child.getBounds( ) ) )
	{
		child.setBounds( bounds );
	}
}
 
Example 4
Source File: ListBandLayout.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void setBoundsOfChild( IFigure parent, IFigure child,
		Rectangle bounds )
{
	parent.getClientArea( Rectangle.SINGLETON );
	bounds.translate( Rectangle.SINGLETON.x, Rectangle.SINGLETON.y );

	if ( !bounds.equals( child.getBounds( ) ) )
	{
		child.setBounds( bounds );
	}
}
 
Example 5
Source File: ProcessEditPartFactory.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public void relocate(CellEditor celleditor) {
	Text text = (Text) celleditor.getControl();
	Rectangle rect = getLabel().getTextBounds().getCopy();
	getLabel().translateToAbsolute(rect);
	if (!text.getFont().isDisposed()) {
		int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
		rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
	}
	if (!rect.equals(new Rectangle(text.getBounds()))) {
		text.setBounds(rect.x, rect.y, rect.width, rect.height);
	}
}